mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:10:46 -06:00
UX: Cleanup crawler styles, improve schema.org markup (#7668)
* Cleaning up crawler styles, improving some schema.org markup * Cleaning up crawler styles, improving some schema.org markup * additional styling * add space for pagination
This commit is contained in:
parent
984516fdc3
commit
98336de266
@ -6,28 +6,115 @@ body.crawler {
|
|||||||
z-index: z("max");
|
z-index: z("max");
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
box-shadow: shadow("header");
|
box-shadow: none;
|
||||||
|
border-bottom: 1px solid $primary-low-mid;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
div.topic-list div[itemprop="itemListElement"] {
|
|
||||||
padding: 10px 0;
|
|
||||||
border-bottom: 1px solid #e9e9e9;
|
|
||||||
.page-links a {
|
|
||||||
padding: 0 4px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
div#main-outlet {
|
div#main-outlet {
|
||||||
div.post {
|
div.post {
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
img {
|
img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
footer nav {
|
|
||||||
margin: 50px 0;
|
.raw-topic-link {
|
||||||
|
display: block;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-list {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawler-topic-title {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawler-post {
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 2em;
|
||||||
|
padding-top: 1.5em;
|
||||||
|
border-top: 1px solid $primary-low;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawler-post-meta {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
.creator {
|
||||||
|
word-break: break-all;
|
||||||
a {
|
a {
|
||||||
padding: 15px;
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
@include breakpoint(tablet) {
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 0.25em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.crawler-post-infos {
|
||||||
|
color: $primary-high;
|
||||||
|
display: inline-block;
|
||||||
|
@include breakpoint(tablet, min-width) {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
[itemprop="position"] {
|
||||||
|
float: left;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#breadcrumbs {
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
font-size: $font-up-1;
|
||||||
|
> div {
|
||||||
|
margin-bottom: 0.15em;
|
||||||
|
}
|
||||||
|
.badge-category-bg {
|
||||||
|
background-color: $secondary-high;
|
||||||
|
}
|
||||||
|
.category-title {
|
||||||
|
color: $primary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawler-tags-list {
|
||||||
|
span {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 0.15em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawler-linkback-list {
|
||||||
|
margin-top: 1em;
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
padding: 0.5em 0;
|
||||||
|
border-top: 1px solid $primary-low;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin-top: 3em;
|
||||||
|
border-top: 1px solid $primary-low-mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawler-nav {
|
||||||
|
margin: 1em 0;
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.5em 1em 0.5em 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -892,22 +892,3 @@ span.highlighted {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.crawler-post {
|
|
||||||
.post-time {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.post-likes {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#breadcrumbs {
|
|
||||||
.badge-category-bg {
|
|
||||||
background-color: $secondary-high;
|
|
||||||
}
|
|
||||||
.category-title {
|
|
||||||
color: $primary;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -35,11 +35,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<footer class="container wrap">
|
<footer class="container wrap">
|
||||||
<nav class='crawler-nav' itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
<nav class='crawler-nav' itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||||
<a href='<%= path "/" %>'><%= t 'home_title' %></a>
|
<ul>
|
||||||
<%= link_to t('js.filters.categories.title'), path("/categories") %>
|
<li itemprop="name"><a href='<%= path "/" %>' itemprop="url"><%= t 'home_title' %> </a></li>
|
||||||
<%= link_to t('guidelines_topic.title'), path("/guidelines") %>
|
<li itemprop="name"><a href='<%= path "/categories" %>' itemprop="url"><%= t 'js.filters.categories.title' %> </a></li>
|
||||||
<%= link_to t('tos_topic.title'), path("/tos") %>
|
<li itemprop="name"><a href='<%= path "/guidelines" %>' itemprop="url"><%= t 'guidelines_topic.title' %> </a></li>
|
||||||
<%= link_to t('privacy_topic.title'), path("/privacy") %>
|
<li itemprop="name"><a href='<%= path "/tos" %>' itemprop="url"><%= t 'tos_topic.title' %> </a></li>
|
||||||
|
<li itemprop="name"><a href='<%= path "/privacy" %>' itemprop="url"><%= t 'privacy_topic.title' %> </a></li>
|
||||||
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<p class='powered-by-link'><%= t 'powered_by_html' %></p>
|
<p class='powered-by-link'><%= t 'powered_by_html' %></p>
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<h1>
|
<h1 class="crawler-topic-title">
|
||||||
<%= render_topic_title(@topic_view.topic) %>
|
<%= render_topic_title(@topic_view.topic) %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
@ -22,12 +22,11 @@
|
|||||||
<% if SiteSetting.tagging_enabled %>
|
<% if SiteSetting.tagging_enabled %>
|
||||||
<% @tags = @topic_view.topic.tags %>
|
<% @tags = @topic_view.topic.tags %>
|
||||||
<% if @tags.present? %>
|
<% if @tags.present? %>
|
||||||
<div class='tags-list' itemscope itemtype='http://schema.org/ItemList'>
|
<div class='crawler-tags-list' itemscope itemtype='http://schema.org/DiscussionForumPosting'>
|
||||||
<% @tags.each do |tag| %>
|
<% @tags.each_with_index do |tag, i| %>
|
||||||
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
<div itemprop='keywords'>
|
||||||
<meta itemprop='url' content='<%= "#{Discourse.base_url}/tags/#{tag.name}" %>'>
|
<a href='<%= "#{Discourse.base_url}/tags/#{tag.name}" %>' rel="tag">
|
||||||
<a href='<%= "#{Discourse.base_url}/tags/#{tag.name}" %>' itemprop='item'>
|
<span itemprop='headline'><%= tag.name -%></span>
|
||||||
<span itemprop='name'><%= tag.name -%></span>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -35,7 +34,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<%= server_plugin_outlet "topic_header" %>
|
<%= server_plugin_outlet "topic_header" %>
|
||||||
|
|
||||||
<%- if include_crawler_content? %>
|
<%- if include_crawler_content? %>
|
||||||
@ -43,9 +41,9 @@
|
|||||||
<% @topic_view.posts.each do |post| %>
|
<% @topic_view.posts.each do |post| %>
|
||||||
<div itemscope itemtype='http://schema.org/DiscussionForumPosting' class='topic-body crawler-post'>
|
<div itemscope itemtype='http://schema.org/DiscussionForumPosting' class='topic-body crawler-post'>
|
||||||
<% if (u = post.user) %>
|
<% if (u = post.user) %>
|
||||||
<div class='creator'>
|
<div class='crawler-post-meta'>
|
||||||
<span>
|
<span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||||
<a href='<%= Discourse.base_uri %>/u/<%= u.username %>'><b itemprop='author'><%= u.username %></b></a>
|
<a itemprop="url" href='<%= Discourse.base_uri %>/u/<%= u.username %>'><span itemprop='name'><%= u.username %></span></a>
|
||||||
<%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
|
<%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
|
||||||
<%
|
<%
|
||||||
who_username = post.custom_fields["action_code_who"] || ""
|
who_username = post.custom_fields["action_code_who"] || ""
|
||||||
@ -53,6 +51,9 @@
|
|||||||
%>
|
%>
|
||||||
<%= t("js.action_codes.#{post.action_code}", when: "", who: who_username).html_safe %>
|
<%= t("js.action_codes.#{post.action_code}", when: "", who: who_username).html_safe %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="crawler-post-infos">
|
||||||
<% if post.updated_at > post.created_at %>
|
<% if post.updated_at > post.created_at %>
|
||||||
<meta itemprop='datePublished' content='<%= post.created_at.to_formatted_s(:iso8601) %>'>
|
<meta itemprop='datePublished' content='<%= post.created_at.to_formatted_s(:iso8601) %>'>
|
||||||
<time itemprop='dateModified' datetime='<%= post.updated_at.to_formatted_s(:iso8601) %>' class='post-time'>
|
<time itemprop='dateModified' datetime='<%= post.updated_at.to_formatted_s(:iso8601) %>' class='post-time'>
|
||||||
@ -63,26 +64,42 @@
|
|||||||
<%= l post.created_at, format: :long %>
|
<%= l post.created_at, format: :long %>
|
||||||
</time>
|
</time>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
|
||||||
<span itemprop='position'>#<%= post.post_number %></span>
|
<span itemprop='position'>#<%= post.post_number %></span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='post' itemprop='articleBody'>
|
<div class='post' itemprop='articleBody'>
|
||||||
<%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
|
<%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
|
||||||
</div>
|
</div>
|
||||||
<meta itemprop='interactionCount' content='UserLikes:<%= post.like_count %>'>
|
|
||||||
<meta itemprop='interactionCount' content='UserComments:<%= post.reply_count %>'>
|
|
||||||
<meta itemprop='headline' content='<%= @topic_view.title %>'>
|
<meta itemprop='headline' content='<%= @topic_view.title %>'>
|
||||||
<div class='clearfix'>
|
|
||||||
<span class='post-likes'><%= post.like_count > 0 ? t('post.has_likes', count: post.like_count) : '' %></span>
|
<div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">
|
||||||
</div>
|
<meta itemprop="interactionType" content="http://schema.org/LikeAction"/>
|
||||||
<% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].length > 0 %>
|
<meta itemprop="userInteractionCount" content="<%= post.like_count %>" />
|
||||||
<% @topic_view.link_counts[post.id].each do |link| %>
|
<span class='post-likes'><%= post.like_count > 0 ? t('post.has_likes', count: post.like_count) : '' %></span>
|
||||||
<% if link[:reflection] && link[:title].present? %>
|
</div>
|
||||||
<a href="<%=link[:url]%>"><%=link[:title]%></a>
|
|
||||||
<hr>
|
<div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">
|
||||||
<% end %>
|
<meta itemprop="interactionType" content="http://schema.org/CommentAction"/>
|
||||||
<% end %>
|
<meta itemprop="userInteractionCount" content="<%= post.reply_count %>" />
|
||||||
<% end %>
|
</div>
|
||||||
|
|
||||||
|
<% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].length > 0 %>
|
||||||
|
<div class='crawler-linkback-list' itemscope itemtype='http://schema.org/ItemList'>
|
||||||
|
<% @topic_view.link_counts[post.id].each_with_index do |link, i| %>
|
||||||
|
<% if link[:reflection] && link[:title].present? %>
|
||||||
|
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
||||||
|
<a href="<%=link[:url]%>" itemprop='item'>
|
||||||
|
<meta itemprop='url' content='<%=link[:url]%>'>
|
||||||
|
<meta itemprop='position' content='<%= i+1 %>'>
|
||||||
|
<span itemprop='name'><%=link[:title]%></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -63,7 +63,7 @@ en:
|
|||||||
topics: "Topics"
|
topics: "Topics"
|
||||||
posts: "posts"
|
posts: "posts"
|
||||||
loading: "Loading"
|
loading: "Loading"
|
||||||
powered_by_html: 'Powered by <a href="https://www.discourse.org">Discourse</a>, best viewed with JavaScript enabled'
|
powered_by_html: 'Powered by <a rel="nofollow" href="https://www.discourse.org">Discourse</a>, best viewed with JavaScript enabled'
|
||||||
log_in: "Log In"
|
log_in: "Log In"
|
||||||
submit: "Submit"
|
submit: "Submit"
|
||||||
purge_reason: "Automatically deleted as abandoned, deactivated account"
|
purge_reason: "Automatically deleted as abandoned, deactivated account"
|
||||||
|
Loading…
Reference in New Issue
Block a user