-
Notifications
You must be signed in to change notification settings - Fork 295
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
Prefer site.tagline to site.description for page title #356
Conversation
@qwtel Can you add a test for a scenario that doesn't have |
I didn't add one specifically b/c |
Can this be merged now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me. It needs documentation.
# Page title with site title or description appended | ||
# rubocop:disable Metrics/CyclomaticComplexity | ||
def title | ||
@title ||= begin | ||
if site_title && page_title != site_title | ||
page_title + TITLE_SEPARATOR + site_title | ||
elsif site_description && site_title | ||
site_title + TITLE_SEPARATOR + site_description | ||
site_title + TITLE_SEPARATOR + site_tagline_or_description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the only place site_tagline_or_description
is used, I’d suggest inlining the method. Feel free to use parentheses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do that, but it created a style offence:
Metrics/AbcSize: Assignment Branch Condition size for title is too high
Metrics/PerceivedComplexity: Perceived complexity for title is too high
This comment has been minimized.
This comment has been minimized.
I've updated the documentation, how does it look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @qwtel
Can this be merged now? 😉 |
@jekyllbot: merge +minor |
Using
site.description
as part of the title for pages that don't have an explicit title --- typically the landing page of a site --- leads to very long page titles. Thesite.description
field is typically used for search engine or social media previews, which are 100+ characters long, making it a bad choice for the title for pages that use the description field in this way.This PR changes the behavior of this plugin to prefer
site.tagline
oversite.description
when it is available. Sites that do not define asite.tagline
are not affected by this.The name
site.tagline
was chosen as it served the same role in the Hyde theme.