Skip to content

Commit

Permalink
Generalize search.xml (forem#8250)
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen428 authored Jun 3, 2020
1 parent 046e26e commit 1c4c88f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
// = link administrate/application.css
// = link administrate/application.js
// = link katex.css
// = link search.xml
9 changes: 9 additions & 0 deletions app/assets/xml/search.xml.erb
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion app/views/shell/_top.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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? %>
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# 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.
Expand Down
9 changes: 0 additions & 9 deletions public/search.xml

This file was deleted.

0 comments on commit 1c4c88f

Please sign in to comment.