Browse Source

Add web app manifest

Thibaut Courouble 8 years ago
parent
commit
9e97357524
4 changed files with 37 additions and 1 deletions
  1. 1 1
      lib/app.rb
  2. 34 0
      public/manifest.json
  3. 1 0
      views/index.erb
  4. 1 0
      views/other.erb

+ 1 - 1
lib/app.rb

@@ -74,7 +74,7 @@ class App < Sinatra::Application
     use Rack::Deflater
     use Rack::Static,
       root: 'public',
-      urls: %w(/assets /docs/ /images /favicon.ico /robots.txt /opensearch.xml /mathml.css),
+      urls: %w(/assets /docs/ /images /favicon.ico /robots.txt /opensearch.xml /mathml.css /manifest.json),
       header_rules: [
         [:all,           {'Cache-Control' => 'no-cache, max-age=0'}],
         ['/assets',      {'Cache-Control' => 'public, max-age=604800'}],

+ 34 - 0
public/manifest.json

@@ -0,0 +1,34 @@
+{
+  "name": "DevDocs",
+  "short_name": "DevDocs",
+  "description": "API Documentation Browser",
+  "start_url": "/",
+  "display": "standalone",
+  "icons": [
+    {
+      "src": "/images/webapp-icon-32.png",
+      "sizes": "32x32",
+      "type": "image/png"
+    },
+    {
+      "src": "/images/webapp-icon-60.png",
+      "sizes": "60x60",
+      "type": "image/png"
+    },
+    {
+      "src": "/images/webapp-icon-80.png",
+      "sizes": "80x80",
+      "type": "image/png"
+    },
+    {
+      "src": "/images/webapp-icon-128.png",
+      "sizes": "128x128",
+      "type": "image/png"
+    },
+    {
+      "src": "/images/webapp-icon-256.png",
+      "sizes": "256x256",
+      "type": "image/png"
+    }
+  ]
+}

+ 1 - 0
views/index.erb

@@ -17,6 +17,7 @@
   <meta name="robots" content="noodp">
   <title>DevDocs API Documentation</title>
   <link rel="canonical" href="<%= canonical_origin %>">
+  <link rel="manifest" href="<%= App.cdn_origin %>/manifest.json">
   <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="DevDocs Search">
   <link rel="alternate" href="<%= canonical_origin %>/feed" title="DevDocs" type="application/atom+xml">
   <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico">

+ 1 - 0
views/other.erb

@@ -8,6 +8,7 @@
   <meta property="og:image" content="<%= App.cdn_origin %>/images/icon-128.png">
   <title>DevDocs<%= " &mdash; #{@doc['full_name']} documentation (fast, offline)" if doc_index_page? %></title>
   <link rel="canonical" href="<%= canonical_origin %><%= request.path %>">
+  <link rel="manifest" href="<%= App.cdn_origin %>/manifest.json">
   <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico">
   <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs">
   <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>">