Skip to content

Commit b71c491

Browse files
authored
Add a title-on-all-pages site option (daattali#1272)
1 parent 403fb13 commit b71c491

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Added instructions and example on how to fix image links in project sites (#1171)
1010
- Pagination buttons: use nicer arrows, and don't show text on small screens (#1221)
1111
- Updated Yelp URL format - if you previously used the `yelp` social network config parameter, you might need to update the config value (#1259)
12+
- Added `title-on-all-pages` config setting, that adds the website title to all page titles (#1272)
1213

1314
## v6.0.1 (2023-06-08)
1415

_config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
############################
1111

1212
# Name of website
13-
title: My Website
13+
title: My website
1414

1515
# Your name to show in the footer
1616
author: Some Person
@@ -100,6 +100,9 @@ share-links-active:
100100
# Remove this if you don't want a link in the footer
101101
url-pretty: "MyWebsite.com"
102102

103+
# Show the site title in the <title> of all pages in addition to the page title
104+
title-on-all-pages: true
105+
103106
# Excerpt word length - Truncate the excerpt of each post on the feed page to the specified number of words
104107
excerpt_length: 50
105108

_includes/head.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<meta charset="utf-8">
33
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
44

5-
{% capture title %}
5+
{% capture pagetitle %}
66
{%- if page.share-title -%}
77
{{ page.share-title | strip_html | xml_escape }}
88
{%- elsif page.title -%}
@@ -12,6 +12,14 @@
1212
{%- endif -%}
1313
{% endcapture %}
1414

15+
{% capture title %}
16+
{%- if site.title and site.title-on-all-pages and (site.title != pagetitle) -%}
17+
{{ pagetitle }} | {{ site.title }}
18+
{%- else -%}
19+
{{ pagetitle }}
20+
{%- endif -%}
21+
{% endcapture %}
22+
1523
{% capture description %}
1624
{%- if page.share-description -%}
1725
{{ page.share-description | strip_html | xml_escape }}

0 commit comments

Comments
 (0)