From 8d630908002b53bdcf6ab05036d050bdc5c7d274 Mon Sep 17 00:00:00 2001 From: Quinn Daley Date: Fri, 12 Jan 2024 18:03:42 +0000 Subject: [PATCH] Add title_on_all_pages option --- _config.yml | 2 ++ _includes/head.html | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 27eeffa52b17..38a850799b5e 100644 --- a/_config.yml +++ b/_config.yml @@ -11,6 +11,8 @@ # Name of website title: My Website +# Show the site title in the of all pages in addition to the page title +title_on_all_pages: false # Your name to show in the footer author: Some Person diff --git a/_includes/head.html b/_includes/head.html index 679c95e07eca..b5e253b8411f 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -2,7 +2,7 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> - {% capture title %} + {% capture pagetitle %} {%- if page.share-title -%} {{ page.share-title | strip_html | xml_escape }} {%- elsif page.title -%} @@ -12,6 +12,14 @@ {%- endif -%} {% endcapture %} + {% capture title %} + {%- if site.title_on_all_pages and (site.title != pagetitle) -%} + {{ pagetitle }} | {{ site.title }} + {%- else -%} + {{ pagetitle }} + {%- endif -%} + {% endcapture %} + {% capture description %} {%- if page.share-description -%} {{ page.share-description | strip_html | xml_escape }}