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

Conversation

pedantic-git
Copy link
Contributor

This PR adds a site option called title_on_all_pages - it adds the site.title to the end of all page titles (separated by |), unless the site.title and title are the same string (usually on home pages).

This still contains my commit from #1270 but if you like the idea, and the variable name, I'll tidy it up and remove that commit before you accept it. No worries if you don't want this option in your theme!

@pedantic-git pedantic-git changed the title Add a title_on_all_pages site optoin Add a title_on_all_pages site option Jan 17, 2024
Copy link
Owner

@daattali daattali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I like it. Please remove the changes related to the jekyll version

@@ -12,6 +12,14 @@
{%- endif -%}
{% endcapture %}

{% capture title %}
{%- if site.title_on_all_pages and (site.title != pagetitle) -%}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also check here that site.title exists. Someone who doesn't use this config.yml file might not have a title parameter.

_config.yml Outdated
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming convention for field names in this file is title-on-all-pages

@pedantic-git pedantic-git changed the title Add a title_on_all_pages site option Add a title-on-all-pages site option Jan 20, 2024
@pedantic-git pedantic-git marked this pull request as ready for review January 20, 2024 12:02
@pedantic-git
Copy link
Contributor Author

Hi @daattali - thank you for your support and your review! I've made those requested changes now and unmarked this as draft.

I hope you don't mind - I also changed site.title in your example app to match the page.title of the homepage (it was only a case difference) - that makes it easier for people to see how this works.

CI is still passing in my env so hopefully it should be good to go!

@hami22123

This comment was marked as spam.

@homayouniarieed

This comment was marked as spam.

Repository owner deleted a comment Jan 20, 2024
Repository owner deleted a comment Jan 20, 2024
@daattali
Copy link
Owner

Looks good, thanks! I made small changes and added to changelog.
I'm not sure why this PR was targeted by so much spam...

@daattali daattali merged commit b71c491 into daattali:master Jan 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants