FEATURE: Add /search discovery

The opensearch.xml results in a "site search engine" being added to
Chrome, while the sitelinks search tag results in "Search this website"
being added to Google Search.
This commit is contained in:
Kane York
2016-02-13 10:29:53 -08:00
parent c650c2a16f
commit f2ddd44712
9 changed files with 73 additions and 18 deletions

View File

@@ -157,6 +157,20 @@ module ApplicationHelper
result.join("\n")
end
def render_sitelinks_search_tag
json = {
'@context': 'http://schema.org',
'@type': 'WebSite',
url: Discourse.base_url,
potentialAction: {
'@type': 'SearchAction',
target: "#{Discourse.base_url}/search?q={search_term_string}",
'query-input': 'required name=search_term_string',
}
}
content_tag(:script, MultiJson.dump(json).html_safe, type: 'application/ld+json'.freeze)
end
def application_logo_url
@application_logo_url ||= (mobile_view? && SiteSetting.mobile_logo_url) || SiteSetting.logo_url
end