mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user