Skip to content

Commit

Permalink
Add a title-on-all-pages site option (daattali#1272)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedantic-git authored Jan 20, 2024
1 parent 403fb13 commit b71c491
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Added instructions and example on how to fix image links in project sites (#1171)
- Pagination buttons: use nicer arrows, and don't show text on small screens (#1221)
- Updated Yelp URL format - if you previously used the `yelp` social network config parameter, you might need to update the config value (#1259)
- Added `title-on-all-pages` config setting, that adds the website title to all page titles (#1272)

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

Expand Down
5 changes: 4 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
############################

# Name of website
title: My Website
title: My website

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

# Show the site title in the <title> of all pages in addition to the page title
title-on-all-pages: true

# Excerpt word length - Truncate the excerpt of each post on the feed page to the specified number of words
excerpt_length: 50

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 and 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 b71c491

Please sign in to comment.