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

Newlines in SEO description get replaced with zero whitespace #2354

Closed
efung opened this issue Dec 24, 2019 · 1 comment
Closed

Newlines in SEO description get replaced with zero whitespace #2354

efung opened this issue Dec 24, 2019 · 1 comment

Comments

@efung
Copy link
Contributor

efung commented Dec 24, 2019

For a post in which I have not defined my own description, I rely on the page.excerpt to populate the seo_description variable in the seo.html include file.

However, I have noticed that if my first paragraph has newlines, the generated description does not have whitespace where the newline used to be. Sample first paragraph of post body:

I made a superb
dessert (in my humble opinion, but also everyone who tasted it). It was high
effort, but also high reward. Read on to see how I made it.

Generated description (from HTML head):

<meta name="description" content="I made a superbdessert (in my humble opinion, but also everyone who tasted it). It was higheffort, but also high reward. Read on to see how I made it.">

Note that there is no space between "superb" and "dessert", nor between "high" and "effort".

@efung
Copy link
Contributor Author

efung commented Dec 24, 2019

One possible fix in seo.html is to replace the use of the Liquid filter strip_newlines with the suggestion in this StackOverflow answer, namely:

newline_to_br | strip_newlines | replace: '<br />', ' '

iBug added a commit to iBug/minimal-mistakes that referenced this issue Jan 8, 2020
kevinashworth added a commit to kevinashworth/aws-kevinashworth-com that referenced this issue Mar 18, 2020
jesuswasrasta pushed a commit to jesuswasrasta/jesuswasrasta.github.io that referenced this issue Jul 8, 2020
mzaffran pushed a commit to mzaffran/mzaffran.github.io that referenced this issue Jan 4, 2021
kaitokikuchi pushed a commit to kaitokikuchi/kaitokikuchi.github.io that referenced this issue Sep 4, 2023
chukycheese pushed a commit to chukycheese/chukycheese.github.io that referenced this issue Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants