diff options
author | Marcia Ramos <virtua.creative@gmail.com> | 2018-04-19 23:10:12 +0300 |
---|---|---|
committer | Marcia Ramos <virtua.creative@gmail.com> | 2018-04-19 23:10:12 +0300 |
commit | 9ac5ca8ff24b7d19ba0303296c06ce1daa181698 (patch) | |
tree | 03c33fdfc91d2c4e15cb2ba5f160349b2e6c8aec /layouts | |
parent | 8e1ec002926c75405c8e32f71c7bba6efdf3e49b (diff) |
Fix google search snippet, add search-on-enter feature
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/docsearch.html | 27 | ||||
-rw-r--r-- | layouts/head.html | 2 | ||||
-rw-r--r-- | layouts/header.html | 7 | ||||
-rw-r--r-- | layouts/home.html | 22 |
4 files changed, 31 insertions, 27 deletions
diff --git a/layouts/docsearch.html b/layouts/docsearch.html index d76d93ed..72da891d 100644 --- a/layouts/docsearch.html +++ b/layouts/docsearch.html @@ -1,16 +1,19 @@ <!-- Algolia docsearch https://community.algolia.com/docsearch/ --> <script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script> <script type="text/javascript"> -docsearch({ -apiKey: 'ce1690e1421303458a1fcbea0cc4a927', -indexName: 'gitlab', -inputSelector: '.docsearch', -algoliaOptions: { - // Filter by tags as described in https://github.com/algolia/docsearch-configs/blob/master/configs/gitlab.json - 'filters': "tags:gitlab OR tags:omnibus OR tags:runner", - // Number of results shown in the search dropdown - 'hitsPerPage': 10 -}, -debug: false // Set debug to true if you want to inspect the dropdown - }); +var search = docsearch({ + apiKey: 'ce1690e1421303458a1fcbea0cc4a927', + indexName: 'gitlab', + inputSelector: '.docsearch', + algoliaOptions: { + // Filter by tags as described in https://github.com/algolia/docsearch-configs/blob/master/configs/gitlab.json + 'filters': "tags:gitlab OR tags:omnibus OR tags:runner", + // Number of results shown in the search dropdown + 'hitsPerPage': 10 + }, + debug: false, // Set debug to true if you want to inspect the dropdown + autocompleteOptions: { + 'autoselect': false + } +}); </script> diff --git a/layouts/head.html b/layouts/head.html index 3c336ee1..8604d8ee 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -26,3 +26,5 @@ <meta name="generator" content="Nanoc <%= Nanoc::VERSION %>"> <!-- Algolia Searching from the URL bar https://www.algolia.com/doc/tutorials/search-ui/ux-patterns/search-from-the-url-bar/ --> <link href='/opensearch.xml' rel='search' title='Search through GitLab Docs' type='application/opensearchdescription+xml'> +<!-- Google webmasters verification --> +<meta name="google-site-verification" content="6eFQOFLxYAer08ROqc3I-SAi44F9NmvH7PrUUBR3oCI" /> diff --git a/layouts/header.html b/layouts/header.html index 1d68e6c6..00e27440 100644 --- a/layouts/header.html +++ b/layouts/header.html @@ -9,7 +9,12 @@ </a> <ul class="nav"> <% unless @item.identifier.to_s.split('/')[1] == 'search' %> - <li class="search"><input type="text" class="docsearch" placeholder="Search"></li> + <li class="search"> + <form id="search-form" action="/search/" method="get"> + <input type="text" name="q" class="docsearch" placeholder="Search" required/> + <input type="submit" style="visibility: hidden; position:absolute;" /> + </form> + </li> <% end %> <% if ENV['NANOC_ENV'] == 'production' %> <% @config[:products].each do |name, product| %> diff --git a/layouts/home.html b/layouts/home.html index c97b1a9d..e737d40b 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -8,7 +8,14 @@ <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> <h1>Documentation</h1> - <input type="text" class="docsearch" placeholder="Search the docs"> + <div itemscope itemtype="http://schema.org/WebSite"> + <meta itemprop="url" content="https://docs.gitlab.com"/> + <form id="search-form" action="/search/" method="get" itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction"> + <meta itemprop="target" content="https://docs.gitlab.com/search/?q={q}"/> + <input itemprop="query-input" type="text" name="q" class="docsearch" placeholder="Search the docs" required/> + <input type="submit" style="visibility: hidden; position:absolute;"/> + </form> + </div> </div> <%= yield %> @@ -17,18 +24,5 @@ <%= render '/analytics.*' %> <%= render '/https_redirect.*' %> <%= render '/schema-microdata.*' %> - <script type="application/ld+json"> //this homepage only - { - "@context":"http://schema.org", - "@type": "WebSite", - "name": "GitLab Documentation", - "url": "https://docs.gitlab.com/", - "potentialAction": { - "@type": "SearchAction", - "target": "https://docs.gitlab.com/search/?q={search_term_string}", - "query-input": "required name=search_term_string" - } - } - </script> </body> </html> |