From 8063e9f3fceef14d1413e368ce2285378d23430b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 6 Oct 2020 23:33:55 +0200 Subject: [PATCH 1/3] _includes/head.html: remove duplicate "noindex", and cleanup whitespace Signed-off-by: Sebastiaan van Stijn --- _includes/head.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index 6008892150..5606a46ea6 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -16,9 +16,10 @@ display: block; } - {% if site.google_analytics != '' %}{% include analytics/google_analytics.html GOOGLE_ID=site.google_analytics %}{% endif %} - {% if site.GH_ENV == "gh_pages" %} - {% endif %} + {%- 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" %} + + {%- endif %} @@ -58,5 +59,4 @@ - {% if page.hide_from_sitemap %}{% endif %} From 6329797e25782235095695c045af001008ab9d0c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 6 Oct 2020 23:39:36 +0200 Subject: [PATCH 2/3] _includes/head.html: reorder / regroup metadata fields Signed-off-by: Sebastiaan van Stijn --- _includes/head.html | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index 5606a46ea6..95aec69e32 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -20,43 +20,43 @@ {%- if page.hide_from_sitemap or site.GH_ENV == "gh_pages" %} {%- endif %} + {{ page.title }} | Docker Documentation + + + + - + - - - + + + + + + + + + + + - - - - - - - - - - - - - - - {{ page.title }} | Docker Documentation - - - + + + + + From 7e5352f1ae2dbe7e9d02f8193096d4513de3a2ba Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 6 Oct 2020 23:53:58 +0200 Subject: [PATCH 3/3] _includes/head.html: generate page title from H1 if needed 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. Note that there's also a Jekyll plugin that features similar functionality, but it requires additional dependencies, and we only have a few pages that need this, so for now using this hack. Signed-off-by: Sebastiaan van Stijn --- _includes/head.html | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index 95aec69e32..4ca9a17eb9 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -1,3 +1,19 @@ +{%- 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: + #

Docker run reference

+ # + # a. split on 'Docker run reference'] + # b. split the last element on 'Docker run reference', ''] + # c. split the first element on '>', which gives us ['

', 'Docker run reference'] + {%- endcomment -%} + {%- assign a = content | split: '' | last -%} + {%- assign page_title = c | strip_html | strip | truncatewords: 10 -%} +{%- endif -%}