Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a title-on-all-pages site option #1272

Merged
merged 6 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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