Use topic excerpts and category desriptions in meta description tags for crawlers

This commit is contained in:
Neil Lalonde 2014-05-07 11:21:37 -04:00
parent ac21bc9baa
commit 63a1f87806
4 changed files with 4 additions and 2 deletions

View file

@ -252,6 +252,7 @@ class ListController < ApplicationController
end
@category = Category.query_category(slug_or_id, parent_category_id)
@description_meta = @category.description
guardian.ensure_can_see!(@category)

View file

@ -373,6 +373,7 @@ class TopicsController < ApplicationController
respond_to do |format|
format.html do
@description_meta = @topic_view.topic.excerpt
store_preloaded("topic_#{@topic_view.topic.id}", MultiJson.dump(topic_view_serializer))
end

View file

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title><%= content_for?(:title) ? yield(:title) + ' - ' + SiteSetting.title : SiteSetting.title %></title>
<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">
<%- if SiteSetting.enable_escaped_fragments? %>

View file

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title><%= content_for?(:title) ? yield(:title) + ' - ' + SiteSetting.title : SiteSetting.title %></title>
<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">
<%= canonical_link_tag %>