Skip to content

Commit

Permalink
Add title_on_all_pages option
Browse files Browse the repository at this point in the history
  • Loading branch information
pedantic-git committed Jan 20, 2024
1 parent 403fb13 commit 8d63090
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

# Name of website
title: My Website
# Show the site title in the <title> of all pages in addition to the page title
title_on_all_pages: false

# Your name to show in the footer
author: Some Person
Expand Down
10 changes: 9 additions & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
Expand All @@ -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 }}
Expand Down

0 comments on commit 8d63090

Please sign in to comment.