discourse/app/views/email/_post.html.erb
Natalie Tay e8aa2b8d9a
DEV: Add a nofollow to /u so user profiles don't get added as a target for crawling (#30693)
In some sites, we are noticing that /u routes are getting indexed.

This commit adds a
["nofollow"](https://developers.google.com/search/docs/crawling-indexing/qualify-outbound-links)
on user profiles so that Google will not index these user profile URLs.
2025-01-13 13:50:00 +08:00

29 lines
1.3 KiB
Plaintext

<div class='post-wrapper <%= post.whisper? ? "whisper" : "" %> <%= use_excerpt ? "excerpt" : ""%>'>
<table>
<tr>
<td class='user-avatar'>
<img src="<%= post.user.small_avatar_url %>" title="<%= post.user.username%>">
</td>
<td>
<%- if SiteSetting.prioritize_username_in_ux %>
<a rel='nofollow' class="username username-link" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.username %></a>
<%- if show_name_on_post(post) %>
<span class='user-name username-title'><%= post.user.name %></span>
<% end %>
<%- else %>
<a rel='nofollow' class="username username-link" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.name %></a>
<%- if show_username_on_post(post) %>
<span class='username username-title'><%= post.user.username %></span>
<% end %>
<%- end %>
<%- if post.user.title.present? %>
<span class='user-title'><%= post.user.title %></span>
<% end %>
<br>
<span class='notification-date'><%= short_date(post.created_at) %></span>
</td>
</tr>
</table>
<div class='body'><%= format_for_email(post, use_excerpt) %></div>
</div>