docs/_includes/head.html

72 lines
4.9 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 site.google_analytics != '' -%}{%- include analytics/google_analytics.html GOOGLE_ID=site.google_analytics -%}{%- endif -%}
{%- if page.hide_from_sitemap or site.GH_ENV == "gh_pages" %}
<meta name="robots" content="noindex"/>
{%- 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">
<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">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans">
<!-- 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>