You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If not a bug, it's at least an interesting quirk. I recently started using semantic line breaks in all my markdown files, including my blog. I tend to use Hugo's <!--more--> feature to generate a post summary, and this summary gets used in a number internal templates for Schema.org, Twitter cards, and OpenGraph metadata. These internal templates are preserving the hard line breaks, which then show up in link previews in chat apps and on social media.
Back in April I was lucky to get an early invite to
[Polywork](https://www.polywork.com/)
and I'm really liking the platform so far.
If you've ever wished you could point people to a single site that shows
all the cool stuff you've done and some more cool stuff you're working on,
Polywork is for you.
The post itself renders fine, but when I shared the post in Discord, the summary text had kept all the hard line breaks:
Definitely not what I was going for. I poked around in devtools on that page and noticed that <meta name="description" ...> behaves normally, but <meta name="twitter:description" ...> and <meta itemprop="description" ...> maintain the hard line breaks.
Hugo's internal templates for Schema.org, Twitter cards, and OpenGraph don't use plainify on summary text, and that seems to explain why they're all maintaining the hard line breaks, which then get grabbed by third parties and rendered in link previews.
Would it make sense to call plainify on the summary text in these internal templates? If so, I'd be willing to open a PR with the change.
The text was updated successfully, but these errors were encountered:
This issue 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.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
If not a bug, it's at least an interesting quirk. I recently started using semantic line breaks in all my markdown files, including my blog. I tend to use Hugo's
<!--more-->
feature to generate a post summary, and this summary gets used in a number internal templates for Schema.org, Twitter cards, and OpenGraph metadata. These internal templates are preserving the hard line breaks, which then show up in link previews in chat apps and on social media.I'll use the example of a recent blog post I wrote (archived here). Here's that post's summary text with semantic line breaks:
The post itself renders fine, but when I shared the post in Discord, the summary text had kept all the hard line breaks:
Definitely not what I was going for. I poked around in devtools on that page and noticed that
<meta name="description" ...>
behaves normally, but<meta name="twitter:description" ...>
and<meta itemprop="description" ...>
maintain the hard line breaks.It turns out that in my site's theme,
<meta name="description" ...>
uses theplainify
function on the summary:Hugo's internal templates for Schema.org, Twitter cards, and OpenGraph don't use plainify on summary text, and that seems to explain why they're all maintaining the hard line breaks, which then get grabbed by third parties and rendered in link previews.
Would it make sense to call plainify on the summary text in these internal templates? If so, I'd be willing to open a PR with the change.
The text was updated successfully, but these errors were encountered: