Use doc full name (incl. version) in app html

Ref #25.
pull/308/merge
Thibaut Courouble 9 years ago
parent b67a02ed35
commit fd2907d1bc

@ -27,8 +27,14 @@ class App < Sinatra::Application
set :docs_host, -> { File.join('', docs_prefix) }
set :docs_path, -> { File.join(public_folder, docs_prefix) }
set :docs_manifest_path, -> { File.join(docs_path, 'docs.json') }
set :docs, -> { Hash[JSON.parse(File.read(docs_manifest_path)).map! { |doc| [doc['slug'], doc] }] }
set :default_docs, %w(css dom dom_events html http javascript)
set :docs, -> {
Hash[JSON.parse(File.read(docs_manifest_path)).map! { |doc|
doc['full_name'] = doc['name'].dup
doc['full_name'] << " #{doc['version']}" if doc['version']
[doc['slug'], doc]
}]
}
set :news_path, -> { File.join(root, assets_prefix, 'javascripts', 'news.json') }
set :news, -> { JSON.parse(File.read(news_path)) }

@ -8,7 +8,7 @@
<div class="_search-tag"></div>
</form>
<h1 class="_logo">
<a href="/" class="_nav-link" title="Offline API Documentation Browser">DevDocs</a><%= "/ #{@doc['name']}" if @doc %>
<a href="/" class="_nav-link" title="Offline API Documentation Browser">DevDocs</a><%= "/ #{@doc['full_name']}" if @doc %>
</h1>
<nav class="_nav">
<a href="/offline" class="_nav-link">Offline</a>
@ -21,7 +21,7 @@
<div class="_list">
<% unless @doc %>
<% App.docs.each do |slug, doc| %>
<a href="/<%= slug %>/" class="_list-item"><span class="_list-arrow"></span><%= doc['name'] %></a>
<a href="/<%= slug %>/" class="_list-item"><span class="_list-arrow"></span><%= doc['full_name'] %></a>
<% end %>
<% end %>
</div>

@ -3,10 +3,10 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<% if doc_index_page? %><meta name="description" content="<%= @doc['name'] %> API documentation with instant search, offline mode, keyboard shortcuts, mobile version, and more."><% else %><meta name="robots" content="noindex"><% end %>
<% if doc_index_page? %><meta name="description" content="<%= @doc['full_name'] %> API documentation with instant search, offline mode, keyboard shortcuts, mobile version, and more."><% else %><meta name="robots" content="noindex"><% end %>
<meta name="format-detection" content="telephone=no">
<meta property="og:image" content="http://cdn.devdocs.io/images/icon-128.png">
<title>DevDocs<%= " - #{@doc['name']} documentation" if doc_index_page? %></title>
<title>DevDocs<%= " - #{@doc['full_name']} documentation" if doc_index_page? %></title>
<link rel="canonical" href="http://devdocs.io<%= request.path %>">
<link rel="icon" type="image/x-icon" href="//cdn.devdocs.io/favicon.ico">
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs">

Loading…
Cancel
Save