mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 12:45:24 +08: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:
21
app/controllers/metadata_controller.rb
Normal file
21
app/controllers/metadata_controller.rb
Normal file
@ -0,0 +1,21 @@
|
||||
class MetadataController < ApplicationController
|
||||
layout false
|
||||
skip_before_filter :preload_json, :check_xhr, :redirect_to_login_if_required
|
||||
|
||||
def manifest
|
||||
manifest = {
|
||||
short_name: SiteSetting.title,
|
||||
display: 'standalone',
|
||||
orientation: 'portrait',
|
||||
start_url: "#{Discourse.base_uri}/",
|
||||
background_color: "##{ColorScheme.hex_for_name('secondary')}",
|
||||
theme_color: "##{ColorScheme.hex_for_name('header_background')}"
|
||||
}
|
||||
|
||||
render json: manifest.to_json
|
||||
end
|
||||
|
||||
def opensearch
|
||||
render file: "#{Rails.root}/app/views/metadata/opensearch.xml"
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user