diff options
author | Marcia Ramos <virtua.creative@gmail.com> | 2018-02-28 23:43:25 +0300 |
---|---|---|
committer | Marcia Ramos <virtua.creative@gmail.com> | 2018-02-28 23:43:25 +0300 |
commit | 6931e99d1cd33aa9fca577b502584cb932b63667 (patch) | |
tree | 4a9b4aab0a3aa5d6b310ebb30c40b221ff6a90e4 /layouts | |
parent | 19db3678d11b7c684f97d7f604022bc6846f37ca (diff) |
Adds search results page to the docs
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/404.html | 4 | ||||
-rw-r--r-- | layouts/default.html | 4 | ||||
-rw-r--r-- | layouts/head.html | 126 | ||||
-rw-r--r-- | layouts/header_search_page.html | 32 | ||||
-rw-r--r-- | layouts/home.html | 4 | ||||
-rw-r--r-- | layouts/instantsearch.html | 65 |
6 files changed, 168 insertions, 67 deletions
diff --git a/layouts/404.html b/layouts/404.html index a53fb818..ed4e4a80 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,6 +1,8 @@ <!DOCTYPE HTML> <html lang="en"> - <%= render '/head.*' %> + <head> + <%= render '/head.*' %> + </head> <body> <%= render '/header.*' %> <div class="main class"> diff --git a/layouts/default.html b/layouts/default.html index f68f815b..37ce5690 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -1,7 +1,9 @@ <!DOCTYPE HTML> <html lang="en"> - <%= render '/head.*' %> <body> + <head> + <%= render '/head.*' %> + </head> <%= render '/header.*' %> <div class="wrapper"> <div class="main class js-main-wrapper"> diff --git a/layouts/head.html b/layouts/head.html index 5e02b14d..7496a601 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -1,68 +1,66 @@ -<head> - <meta charset="utf-8"> - <title><%= @item.key?(:title) ? "#{item[:title]} - GitLab Documentation" : "GitLab Documentation" %></title> - <% if @item[:description] %> - <meta name="description" content="<%= @item[:description] %>"> - <% else %> - <meta name="description" content="Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner."> - <% end %> +<meta charset="utf-8"> +<title><%= @item.key?(:title) ? "#{item[:title]} - GitLab Documentation" : "GitLab Documentation" %></title> +<% if @item[:description] %> + <meta name="description" content="<%= @item[:description] %>"> +<% else %> + <meta name="description" content="Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner."> +<% end %> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/bootstrap.min.*'].path %>"> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/font-awesome.min.*'].path %>"> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/stylesheet.*'].path %>"> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/highlight.*'].path %>"> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/footer.*'].path %>"> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/docsearch.min.*'].path %>"> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/toc.*'].path %>"> - <link rel="stylesheet" href="<%= @items['/assets/stylesheets/comments.*'].path %>"> - <script async src="<%= @items['/assets/javascripts/classlist-polyfill.*'].path %>"></script> - <script async src="<%= @items['/assets/javascripts/docs.*'].path %>"></script> - <link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,400italic' rel='stylesheet' type='text/css'> - <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/bootstrap.min.*'].path %>"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/font-awesome.min.*'].path %>"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/stylesheet.*'].path %>"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/highlight.*'].path %>"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/footer.*'].path %>"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/docsearch.min.*'].path %>"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/toc.*'].path %>"> +<link rel="stylesheet" href="<%= @items['/assets/stylesheets/comments.*'].path %>"> +<script async src="<%= @items['/assets/javascripts/classlist-polyfill.*'].path %>"></script> +<script async src="<%= @items['/assets/javascripts/docs.*'].path %>"></script> +<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,400italic' rel='stylesheet' type='text/css'> +<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> - <!-- you don't need to keep this, but it's cool for stats! --> - <meta name="generator" content="Nanoc <%= Nanoc::VERSION %>"> - <script type="application/ld+json"> - { - "@context":"http://schema.org", - "@type":"Organization", - "name":"GitLab", - "legalName":"GitLab Inc.", - "url":"https://about.gitlab.com", - "logo":"https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo.png", - "foundingDate":"2011", - "founders":[ +<!-- you don't need to keep this, but it's cool for stats! --> +<meta name="generator" content="Nanoc <%= Nanoc::VERSION %>"> +<script type="application/ld+json"> +{ + "@context":"http://schema.org", + "@type":"Organization", + "name":"GitLab", + "legalName":"GitLab Inc.", + "url":"https://about.gitlab.com", + "logo":"https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo.png", + "foundingDate":"2011", + "founders":[ + { + "@type":"Person", + "name":"Sid Sijbrandij" + }, + { + "@type":"Person", + "name":"Dmitriy Zaporozhets" + }], + "address": { - "@type":"Person", - "name":"Sid Sijbrandij" + "@type":"PostalAddress", + "streetAddress":"1233 Howard St 2F", + "addressLocality":"San Francisco", + "addressRegion":"CA", + "postalCode":"94103", + "addressCountry":"USA" }, - { - "@type":"Person", - "name":"Dmitriy Zaporozhets" - }], - "address": - { - "@type":"PostalAddress", - "streetAddress":"1233 Howard St 2F", - "addressLocality":"San Francisco", - "addressRegion":"CA", - "postalCode":"94103", - "addressCountry":"USA" - }, - "sameAs":[ - "https://www.facebook.com/gitlab", - "https://twitter.com/gitlab", - "https://www.linkedin.com/company/gitlab-com", - "https://plus.google.com/107491817347842790515/", - "https://www.youtube.com/channel/UCnMGQ8QHMAnVIsI3xJrihhg"] - } - </script> - <script type="application/ld+json"> - { - "@context":"http://schema.org", - "@type": "WebSite", - "name": "GitLab Documentation", - "url": "https://docs.gitlab.com" - } - </script> -</head> + "sameAs":[ + "https://www.facebook.com/gitlab", + "https://twitter.com/gitlab", + "https://www.linkedin.com/company/gitlab-com", + "https://plus.google.com/107491817347842790515/", + "https://www.youtube.com/channel/UCnMGQ8QHMAnVIsI3xJrihhg"] +} +</script> +<script type="application/ld+json"> +{ + "@context":"http://schema.org", + "@type": "WebSite", + "name": "GitLab Documentation", + "url": "https://docs.gitlab.com" +} +</script> diff --git a/layouts/header_search_page.html b/layouts/header_search_page.html new file mode 100644 index 00000000..fdec71d3 --- /dev/null +++ b/layouts/header_search_page.html @@ -0,0 +1,32 @@ +<div class="header"> + <a href="/"> + <img src="<%= @items['/assets/images/gitlab-logo.svg'].path %>" width="50" /> + <p>GitLab Documentation</p> + </a> + <div class="nav-container"> + <a class="nav-toggle" id="docs-nav-toggle">Menu</a> + <ul class="nav"> + <% if ENV['NANOC_ENV'] == 'production' %> + <% @config[:products].each do |name, product| %> + <% if product[:expose] == true %> + <li class="nav-item"> + <a href="<%= @items["/#{product[:slug]}/#{product[:index_file]}"].path %>"> + <%= product[:short_name] %> + </a> + </li> + <% end %> + <% end %> + <% else %> + <% @config[:products].each do |name, product| %> + <% if Dir.exist?("#{@config[:content_dir]}/#{product[:slug]}")%> + <li class="nav-item"> + <a href="<%= @items["/#{product[:slug]}/#{product[:index_file]}"].path %>"> + <%= product[:short_name] %> + </a> + </li> + <% end %> + <% end %> + <% end %> + </ul> + </div> +</div> diff --git a/layouts/home.html b/layouts/home.html index 3acdfee5..3c33a9f9 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -1,6 +1,8 @@ <!DOCTYPE HTML> <html lang="en"> - <%= render '/head.*' %> + <head> + <%= render '/head.*' %> + </head> <body class="landing"> <div class="landing-header"> <svg width="280" height="88" viewBox="0 0 1231 342" xmlns="http://www.w3.org/2000/svg" class="nav-logo"> <g fill="none" fill-rule="evenodd"> <g fill="#fff" class="wordmark"> <path d="M764.367 94.13h-20.803l.066 154.74h84.155v-19.136h-63.352l-.066-135.603zM907.917 221.7c-5.2 5.434-13.946 10.87-25.766 10.87-15.838 0-22.22-7.797-22.22-17.957 0-15.354 10.637-22.678 33.332-22.678 4.255 0 11.11.472 14.655 1.18v28.586zm-21.51-93.787c-16.8 0-32.208 5.952-44.23 15.858l7.352 12.73c8.51-4.962 18.91-9.924 33.802-9.924 17.02 0 24.585 8.742 24.585 23.39v7.56c-3.31-.71-10.164-1.184-14.42-1.184-36.404 0-54.842 12.757-54.842 39.454 0 23.86 14.656 35.908 36.876 35.908 14.97 0 29.314-6.852 34.278-17.954l3.782 15.118h14.657v-79.14c0-25.04-10.874-41.815-41.84-41.815zM995.368 233.277c-7.802 0-14.657-.945-19.858-3.308v-71.58c7.093-5.908 15.84-10.16 26.95-10.16 20.092 0 27.893 14.174 27.893 37.09 0 32.6-12.53 47.957-34.985 47.957m8.742-105.364c-18.592 0-28.6 12.64-28.6 12.64V120.59l-.066-26.458H955.116l.066 150.957c10.164 4.25 24.11 6.613 39.24 6.613 38.768 0 57.442-24.804 57.442-67.564 0-33.783-17.26-56.227-47.754-56.227M538.238 110.904c18.438 0 30.258 6.142 38.06 12.285l8.938-15.477c-12.184-10.678-28.573-16.417-46.053-16.417-44.204 0-75.17 26.932-75.17 81.267 0 56.935 33.407 79.14 71.624 79.14 19.148 0 35.46-4.488 46.096-8.976l-.435-60.832V162.76h-56.734v19.135h36.167l.437 46.184c-4.727 2.362-13 4.252-24.11 4.252-30.73 0-51.297-19.32-51.297-60.006 0-41.34 21.275-61.422 52.478-61.422M684.534 94.13h-20.33l.066 25.988v89.771c0 25.04 10.874 41.814 41.84 41.814 4.28 0 8.465-.39 12.53-1.126v-18.245c-2.943.45-6.083.707-9.455.707-17.02 0-24.585-8.74-24.585-23.387v-61.895h34.04v-17.01H684.6l-.066-36.617zM612.62 248.87h20.33V130.747h-20.33v118.12zM612.62 114.448h20.33V94.13h-20.33v20.318z"></path> </g> <path d="M185.398 341.13l68.013-209.322H117.39L185.4 341.13z" fill="#E24329" class="logo-svg-shape logo-dark-orange-shape"></path> <path d="M185.398 341.13l-68.013-209.322h-95.32L185.4 341.128z" fill="#FC6D26" class="logo-svg-shape logo-orange-shape"></path> <path d="M22.066 131.808l-20.67 63.61c-1.884 5.803.18 12.16 5.117 15.744L185.398 341.13 22.066 131.807z" fill="#FCA326" class="logo-svg-shape logo-light-orange-shape"></path> <path d="M22.066 131.808h95.32L76.42 5.735c-2.107-6.487-11.284-6.487-13.39 0L22.065 131.808z" fill="#E24329" class="logo-svg-shape logo-dark-orange-shape"></path> <path d="M185.398 341.13l68.013-209.322h95.32L185.4 341.128z" fill="#FC6D26" class="logo-svg-shape logo-orange-shape"></path> <path d="M348.73 131.808l20.67 63.61c1.884 5.803-.18 12.16-5.117 15.744L185.398 341.13 348.73 131.807z" fill="#FCA326" class="logo-svg-shape logo-light-orange-shape"></path> <path d="M348.73 131.808h-95.32L294.376 5.735c2.108-6.487 11.285-6.487 13.392 0l40.963 126.073z" fill="#E24329" class="logo-svg-shape logo-dark-orange-shape"></path> </g> </svg> diff --git a/layouts/instantsearch.html b/layouts/instantsearch.html new file mode 100644 index 00000000..c4e8ccdd --- /dev/null +++ b/layouts/instantsearch.html @@ -0,0 +1,65 @@ +<!DOCTYPE HTML> +<html lang="en"> + <head> + <%= render '/head.*' %> + <!-- instantsearch --> + <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.0/dist/instantsearch.min.css"> + <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.0"></script> + <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.0/dist/instantsearch-theme-algolia.min.css"> + <link rel="stylesheet" href="<%= @items['/assets/stylesheets/instantsearch.*'].path %>"> + <!-- end of instantsearch --> + </head> + <body> + <%= render '/header_search_page.*' %> + <div class=wrapper> + <div id="doc-nav" class="doc-nav"> + </div> + <div class="main class instantsearch-input"> + <%= yield %> + <hr> + <div class="clear"></div> + </div> + <%= render '/footer_homepage.*' %> + <%= render '/analytics.*' %> + <%= render '/https_redirect.*' %> + <script type="text/javascript"> + const search = instantsearch({ + appId: 'BH4D9OD16A', + apiKey: 'ce1690e1421303458a1fcbea0cc4a927', + indexName: 'gitlab', + algoliaOptions: { + // Filter by tags as described in https://github.com/algolia/docsearch-configs/blob/master/configs/gitlab.json + 'filters': "tags:ee OR tags:omnibus OR tags:runner", + // Number of results shown in the search dropdown + 'hitsPerPage': 10 + }, + urlSync: true + }); + + search.addWidget( + instantsearch.widgets.searchBox({ + container: '#search-input' + }) + ); + + search.addWidget( + instantsearch.widgets.hits({ + container: '#hits', + hitsPerPage: 10, + templates: { + item: document.getElementById('hit-template').innerHTML, + empty: "We didn't find any results for the search <em>\"{{query}}\"</em>" + } + }) + ); + + search.addWidget( + instantsearch.widgets.pagination({ + container: '#pagination' + }) + ); + + search.start(); + </script> + </body> +</html> |