Use topic excerpts and category desriptions in meta description tags for crawlers
This commit is contained in:
parent
ac21bc9baa
commit
63a1f87806
|
@ -252,6 +252,7 @@ class ListController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@category = Category.query_category(slug_or_id, parent_category_id)
|
@category = Category.query_category(slug_or_id, parent_category_id)
|
||||||
|
@description_meta = @category.description
|
||||||
|
|
||||||
guardian.ensure_can_see!(@category)
|
guardian.ensure_can_see!(@category)
|
||||||
|
|
||||||
|
|
|
@ -373,6 +373,7 @@ class TopicsController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
|
@description_meta = @topic_view.topic.excerpt
|
||||||
store_preloaded("topic_#{@topic_view.topic.id}", MultiJson.dump(topic_view_serializer))
|
store_preloaded("topic_#{@topic_view.topic.id}", MultiJson.dump(topic_view_serializer))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><%= content_for?(:title) ? yield(:title) + ' - ' + SiteSetting.title : SiteSetting.title %></title>
|
<title><%= content_for?(:title) ? yield(:title) + ' - ' + SiteSetting.title : SiteSetting.title %></title>
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||||
<meta content="<%= SiteSetting.site_description %>" name="description">
|
<meta content="<%= @description_meta || SiteSetting.site_description %>" name="description">
|
||||||
<meta content="" name="author">
|
<meta content="" name="author">
|
||||||
|
|
||||||
<%- if SiteSetting.enable_escaped_fragments? %>
|
<%- if SiteSetting.enable_escaped_fragments? %>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><%= content_for?(:title) ? yield(:title) + ' - ' + SiteSetting.title : SiteSetting.title %></title>
|
<title><%= content_for?(:title) ? yield(:title) + ' - ' + SiteSetting.title : SiteSetting.title %></title>
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||||
<meta content="<%= SiteSetting.site_description %>" name="description">
|
<meta content="<%= @description_meta || SiteSetting.site_description %>" name="description">
|
||||||
<meta content="" name="author">
|
<meta content="" name="author">
|
||||||
|
|
||||||
<%= canonical_link_tag %>
|
<%= canonical_link_tag %>
|
||||||
|
|
Loading…
Reference in New Issue