mirror of
https://github.com/docker/docs.git
synced 2026-03-29 07:18:51 +07:00
The `hide_from_sitemap` metadata variable was a custom thing we implemented to add a "noindex" meta-header to pages and to exclude a page from the search auto-complete. However, pages with that option set would still be included in sitemap.xml, resulting in search engines to visit those pages (only to discover they should not index them). This patch replaces the custom `hide_from_sitemap` value for `sitemap: false`, which is a metadata variable that's defined by the "jekyll-sitemap" plugin we use to generate the sitemap.xml; https://github.com/jekyll/jekyll-sitemap/blob/v1.4.0/README.md#exclusions Setting this variable will now: - add a "noindex" metadata header to the page - exclude the page from the sitemap.xml. - exclude the page from /js/metadata.json (used for search autocomplete) Also fixed an issue in the metadata.json where the `notoc` metadata was used to exclude pages, however that variable is meant to disable the in-page TOC (right-hand side navigation with anchor links). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
103 lines
6.5 KiB
HTML
103 lines
6.5 KiB
HTML
{%- if page.title == nil -%}
|
|
{%- comment -%}
|
|
# This is a very hacky way to extract the page title from pages that do not have
|
|
# front-matter yaml, but have a H1 header. We need to take (id-) attributes into
|
|
# account, so some hacking is needed. Taking the following example:
|
|
# <h1 id="docker-run-reference">Docker run reference</h1>
|
|
#
|
|
# a. split on '<h1', which gives us ['content before', '<h1 id="docker-run-reference">Docker run reference</h1>']
|
|
# b. split the last element on '</h1', which gives us ['<h1 id="docker-run-reference">Docker run reference', '</h1', '>']
|
|
# c. split the first element on '>', which gives us ['<h1 id="docker-run-reference"', '>', 'Docker run reference']
|
|
{%- endcomment -%}
|
|
{%- assign a = content | split: '<h1' | last -%}
|
|
{%- assign b = a | split: '</h1' | first -%}
|
|
{%- assign c = b | split: '>' | last -%}
|
|
{%- assign page_title = c | strip_html | strip | truncatewords: 10 | escape_once -%}
|
|
{%- endif -%}
|
|
{%- if page.description == nil and page.datafile != nil and page.datafile != '' -%}
|
|
{%- assign yaml_data = site.data[page.datafolder][page.datafile] -%}
|
|
{%- if yaml_data.long and yaml_data.long != '' -%}
|
|
{%- assign page_description = page.title | append: ': ' | append: yaml_data.long | strip_html | strip | truncatewords: 30 -%}
|
|
{%- elsif yaml_data.short and yaml_data.short != '' -%}
|
|
{%- assign page_description = page.title | append: ': ' | append: yaml_data.short | strip_html | strip | truncatewords: 30 -%}
|
|
{%- else -%}
|
|
{%- assign page_description = content | strip_html | strip | truncatewords: 30 -%}
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
{%- if page.sitemap == false or site.GH_ENV == "gh_pages" %}
|
|
<meta name="robots" content="noindex"/>
|
|
{%- endif %}
|
|
{%- if site.google_analytics != '' -%}{%- include analytics/google_analytics.html GOOGLE_ID=site.google_analytics -%}{%- endif -%}
|
|
<title>{{ page.title | default: page_title }} | Docker Documentation</title>
|
|
<meta name="description" content="{{ page.description | default: page_description | escape}}" />
|
|
<meta name="keywords" content="{{ page.keywords | default: 'docker, docker open source, docker platform, distributed applications, microservices, containers, docker containers, docker software, docker virtualization' }}">
|
|
<link rel="canonical" href="https://docs.docker.com{{ page.url }}" />
|
|
|
|
<!-- favicon -->
|
|
<link rel="icon" type="image/x-icon" href="/favicons/docs@2x.ico" sizes="129x128">
|
|
<link rel="apple-touch-icon" type="image/x-icon" href="/favicons/docs@2x.ico" sizes="129x128">
|
|
<meta name="msapplication-TileImage" content="/favicons/docs@2x.ico">
|
|
<meta property="og:image" content="/favicons/docs@2x.ico"/>
|
|
<meta name="theme-color" content="#2496ed" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
{%- comment -%}
|
|
We put these scripts in the head section, but use "defer" loading to allow the
|
|
browser to start loading them as soon as possible. Actual execution of deferred
|
|
scripts happens once the HTML is fully parsed.
|
|
see https://flaviocopes.com/javascript-async-defer/#with-defer-in-the-head
|
|
{%- endcomment -%}
|
|
{%- if page.landing == true -%}
|
|
<!-- landing page scripts -->
|
|
<script defer src="/js/theme-switcher.js"></script>
|
|
<script defer src="/js/jquery.js"></script>
|
|
<script defer src="/js/bootstrap.min.js"></script>
|
|
<script defer src="/js/search.js"></script>
|
|
{%- else -%}
|
|
<script defer src="/js/theme-switcher.js"></script>
|
|
<script defer src="/js/anchorlinks.js"></script>
|
|
<script defer src="/js/jquery.js"></script>
|
|
<script defer src="/js/bootstrap.min.js"></script>
|
|
<script defer src="/js/docs.js"></script>
|
|
<script defer src="/js/search.js"></script>
|
|
{%- endif -%}
|
|
|
|
{%- comment -%}
|
|
preload fonts: https://www.freecodecamp.org/news/web-fonts-in-2018-f191a48367e8/
|
|
we only preload the "woff2" variants, as older formats (woff, eot) are only used
|
|
by older browsers, and we don't optimize for those.
|
|
{%- endcomment -%}
|
|
<link rel="preload" as="font" href="/fonts/geomanist/hinted-Geomanist-Book.woff2" type="font/woff2" crossorigin="anonymous">
|
|
<link rel="preload" as="font" href="/fonts/geomanist/hinted-Geomanist-Regular.woff2" type="font/woff2" crossorigin="anonymous">
|
|
<link rel="preload" as="font" href="/fonts/glyphicons-halflings-regular.woff2" type="font/woff2" crossorigin="anonymous">
|
|
<link rel="preload" as="font" href="/fonts/fontawesome-webfont.woff2?v=4.7.0" type="font/woff2" crossorigin="anonymous">
|
|
|
|
<link rel="stylesheet" href="/css/font-awesome.min.css">
|
|
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="/css/style.css" id="pagestyle">
|
|
|
|
<!-- SEO stuff -->
|
|
<meta name="twitter:title" itemprop="title name" content="{{ page.title | default: page_title }}"/>
|
|
<meta name="twitter:description" property="og:description" itemprop="description" content="{{ page_description | escape_once }}" />
|
|
<meta name="twitter:card" content="summary"/>
|
|
<meta name="twitter:domain" content="docs.docker.com"/>
|
|
<meta name="twitter:site" content="@docker_docs"/>
|
|
<meta name="twitter:url" content="https://twitter.com/docker_docs"/>
|
|
<meta name="twitter:image:src" content="/images/docs@2x.png"/>
|
|
<meta name="twitter:image:alt" content="Docker Documentation"/>
|
|
<meta property="og:title" content="{{ page.title | default: page_title }}" />
|
|
<meta property="og:description" content="{{ page.description | default: page_description | escape_once }}" />
|
|
<meta property="og:type" content="website"/>
|
|
<meta property="og:updated_time" itemprop="dateUpdated" content="{% if page.date %}{{ page.date | date_to_xmlschema }}{% else %}{{ site.time | date_to_xmlschema }}{% endif %}"/>
|
|
<meta property="og:image" itemprop="image primaryImageOfPage" content="/images/docs@2x.png"/>
|
|
<meta property="og:locale" content="en_US" />
|
|
<meta property="og:url" content="https://docs.docker.com{{ page.url }}" />
|
|
<meta property="og:site_name" content="Docker Documentation" />
|
|
<meta property="article:published_time" itemprop="datePublished" content="{% if page.date %}{{ page.date | date_to_xmlschema }}{% else %}{{ site.time | date_to_xmlschema }}{% endif %}"/>
|
|
<script type="application/ld+json">{"@context":"http://schema.org","@type":"WebPage","headline":{{ page.title | default: page_title | jsonify }},"description":{{ page.description | default: page_description | jsonify }},"url":"https://docs.docker.com{{ page.url }}"}</script>
|
|
<!-- END SEO STUFF -->
|
|
</head>
|