Fix recommendations from #1145

This commit is contained in:
Anton Batenev 2013-07-05 15:59:39 +04:00
parent af36d32f7f
commit 694a6f4970
4 changed files with 9 additions and 7 deletions

View File

@ -41,9 +41,9 @@ class TopicsController < ApplicationController
anonymous_etag(@topic_view.topic) do
redirect_to_correct_topic && return if slugs_do_not_match
# render workaround pseudo-static HTML page for Yandex crawler (if enabled)
# render workaround pseudo-static HTML page for old crawlers which ignores <noscript>
# (see http://meta.discourse.org/t/noscript-tag-and-some-search-engines/8078)
return render 'topics/plain', layout: false if (SiteSetting.yandex_workaround && params.has_key?('_escaped_fragment_'))
return render 'topics/plain', layout: false if (SiteSetting.enable_escaped_fragments && params.has_key?('_escaped_fragment_'))
View.create_for(@topic_view.topic, request.remote_ip, current_user)
track_visit_to_topic

View File

@ -78,9 +78,9 @@ module ApplicationHelper
end
end
# Add workaround tag for Yandex crawler
# (see http://help.yandex.ru/webmaster/?id=1125296)
result << tag('meta', name: "fragment", content: "!") if SiteSetting.yandex_workaround
# Add workaround tag for old crawlers which ignores <noscript>
# (see https://developers.google.com/webmasters/ajax-crawling/docs/specification)
result << tag('meta', name: "fragment", content: "!") if SiteSetting.enable_escaped_fragments
result
end

View File

@ -26,7 +26,8 @@ class SiteSetting < ActiveRecord::Base
client_setting(:must_approve_users, false)
client_setting(:ga_tracking_code, "")
client_setting(:ga_domain_name, "")
client_setting(:yandex_workaround, false)
client_setting(:enable_escaped_fragments, false)
client_setting(:enable_noscript_support, true)
client_setting(:enable_long_polling, true)
client_setting(:polling_interval, 3000)
client_setting(:anon_polling_interval, 30000)

View File

@ -500,7 +500,8 @@ en:
must_approve_users: "Admins must approve all users before they gain access"
ga_tracking_code: "Google analytics tracking code code, eg: UA-12345678-9; see http://google.com/analytics"
ga_domain_name: "Google analytics domain name, eg: mysite.com; see http://google.com/analytics"
yandex_workaround: "Enable workaround solution to help Yandex crawler (http://www.yandex.com) index your site. WARNING: enable it only if you are really have to do it."
enable_escaped_fragments: "Enable workaround solution to help old crawlers to index your site. WARNING: enable it only if you are really have to do it."
enable_noscript_support: "Enable supporting &lt;noscipt&gt; tag"
top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|hot|read|favorited|unread|new|posted|categories"
post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply"
share_links: "Determine which items appear on the share dialog, and in what order. Example twitter|facebook|google+|email"