New lines in auto .Description

When I don’t specify a front-matter description variable, Hugo supplies one anyway from .Content, which is perfect.

Only, even with {{- -}} extra space stops, it seems the automated .Description variable contains new lines?

Is there a setting I missed or some code to pipe .Description through that will strip the new lines?

Are you referring to .Summary? The .Description field is not related to .Content in any way.

Good to know. My mistake. Yes, my code prefers .Description over .Summary, and is in this case without .Description likely then extracting .Summary with newline characters.

I am not sure if you still have a question.

If you want to remove trailing newlines:

{{ chomp .Summary }}

If you want to remove leading and trailing newlines:

{{ trim .Summary "\n" }}

Additionally, when using .Summary, the value depends on how the summary was defined. See this issue comment for more details:
https://github.com/gohugoio/hugo/issues/8910#issuecomment-903158600

Interesting …

In this case, the issue is likely related to ’The built-in mechanisms for summary assignment and rendering have [created confusion](https://discourse.gohugo.io/search?q=summary) for several years. in the link you posted.

The content .Summary is rendering to description meta contains:

<p> ...text... </p>
<p> ...text... </p>
<p> ...text... </p>
<p> ...text... </p>

That introduces a new line character after each p tag, which doesn’t obviously break the site, but messes up anyway the pretty flow I prefer after minification.

Can confirm that’s on the wait list, i.e. ‘check back later’?

Then there is an additional query, something simple I didn’t yet read:
It seems .Description is the same as .Params.description, yes?