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

tpl: Plainify .Title, .Description and .Summary for meta tags #9856

Closed
wants to merge 8 commits into from
Closed

tpl: Plainify .Title, .Description and .Summary for meta tags #9856

wants to merge 8 commits into from

Conversation

bowman2001
Copy link

@bowman2001 bowman2001 commented May 4, 2022

Opengraph, Schema and Twitter expect strings without markup for their meta tags. The two new internal helper templates plain_title.html and plain_description.html generate them. The direct use of .Title, .Description and .Summary in the internal templates opengraph.html, schema.html and twitter_cards.html is replaced by those helper templates.

Closes #9818
Closes #8698
Closes #8562 at least partially. .Summary is plainified, but there may still remain issues with the resulting formatting.

Opengraph, Schema and Twitter expect Unicode strings without markup for their meta tags. The two new internal helper templates plain_title.html and plain_description.html generate them. The direct use of .Title, .Description and .Summary in the internal templates opengraph.html, schema.html and twitter_cards.html is replaced by those helper templates.

Fixes #9818, #8698 and #8562
@bowman2001 bowman2001 marked this pull request as draft May 6, 2022 08:10
@bowman2001 bowman2001 marked this pull request as ready for review May 6, 2022 08:10
Copy link

@chalin chalin left a comment

Choose a reason for hiding this comment

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

Great! I've long wanted an internal template for the page description, used uniformly across other templates (like Twitter, etc). Being able to override these (esp. for the title) has been a need for some projects I work on. Thanks for the PR, I hope that this gets some traction soon.

@chalin
Copy link

chalin commented Jul 9, 2022

One more thought: consider splitting this into two PRs: one for the description update and one for the title update. I think that the title update might be more contentious, and I'd hate for that to delay the acceptance of the description part of this PR. My 2 cents. Cheers!

As @chalin recommended, there is no need for removing whitespace at the beginning of a line. `chomp` removes a possible trailing newline from the `.Summary`, also recommended by @chalin.
@github-actions
Copy link

This PR has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
Please check https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md#code-contribution and verify that this code contribution fits with the description. If yes, tell is in a comment.
This PR will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the Stale label Sep 16, 2023
@github-actions github-actions bot closed this Nov 11, 2023
@bowman2001 bowman2001 deleted the plainify-strings-for-meta branch January 17, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants