Generalize search.xml (#8250)

This commit is contained in:
Michael Kohl 2020-06-03 19:49:25 +07:00 committed by GitHub
parent 046e26e721
commit 1c4c88f295
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 10 deletions

View file

@ -7,3 +7,4 @@
// = link administrate/application.css
// = link administrate/application.js
// = link katex.css
// = link search.xml

View file

@ -0,0 +1,9 @@
<% helper = Module.new { extend ApplicationHelper } %>
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName><%= helper.community_name %> Search</ShortName>
<Description>Find posts from the <%= helper.community_qualified_name %>.</Description>
<Contact><%= SiteConfig.email_addresses[:default] %></Contact>
<Url type="text/html"
template="<%= URL.url("search") %>?q={searchTerms}"/>
</OpenSearchDescription>

View file

@ -44,7 +44,7 @@
<meta property="fb:pages" content="568966383279687" />
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="/manifest.json" />
<link rel="search" href="<%= app_url("search.xml") %>" type="application/opensearchdescription+xml" title="<%= community_qualified_name %>" />
<link rel="search" href="<%= asset_path("search.xml") %>" type="application/opensearchdescription+xml" title="<%= community_qualified_name %>" />
<% end %>
</head>
<% unless internal_navigation? %>

View file

@ -9,6 +9,8 @@ Rails.application.config.assets.version = "1.1"
# Add Yarn node_modules folder to the asset load path
Rails.application.config.assets.paths << Rails.root.join("node_modules")
Rails.application.config.assets.paths << Rails.root.join("app/assets/xml")
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>DEV Search</ShortName>
<Description>Find posts from the DEV community.</Description>
<Tags>software development</Tags>
<Contact>yo@dev.to</Contact>
<Url type="text/html"
template="https://dev.to/search?q={searchTerms}"/>
</OpenSearchDescription>