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

summaryLength applies differently since 0.134.0 #12837

Closed
McShelby opened this issue Sep 5, 2024 · 6 comments · Fixed by #12844
Closed

summaryLength applies differently since 0.134.0 #12837

McShelby opened this issue Sep 5, 2024 · 6 comments · Fixed by #12844

Comments

@McShelby
Copy link

McShelby commented Sep 5, 2024

Setting a summaryLength=10 in my hugo.toml does not have any effect since 0.134.0.

To test this, my page Markdown was

+++
title = "Branding"
+++

The Relearn theme provides configuration options to change your site's colors, favicon and logo. This allows you to easily align your site visuals to your desired style. Most of these options are exposed through so called color variants.

A color variant lets you customize various visual effects of your site like almost any color, used fonts, color schemes of print, syntax highligtning, Mermaid and the OpenAPI shortcode, etc. It contains of a CSS file and optional configuration options in your `hugo.toml`.

0.134.0

The Relearn theme provides configuration options to change your site’s colors, favicon and logo. This allows you to easily align your site visuals to your desired style. Most of these options are exposed through so called color variants.

0.133.1

The Relearn theme provides configuration options to change your site’s colors, favicon and logo.

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.134.0-77df7bbbff8ce6b56ed693270088de973a87d5ce+extended windows/amd64 BuildDate=2024-09-03T09:54:22Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes. It was fine with 0.133.1

@bep
Copy link
Member

bep commented Sep 5, 2024

I'm pretty sure that the title of this issue is not correct. So, the implementation is simpler:

  1. The old implementation converted HTML to plain text, then truncated to whole sentence closest to summaryLength.
  2. The new implementation do no conversion to plain, but truncates the HTML to the paragraph closest to summaryLength.

@bep bep added this to the v0.134.1 milestone Sep 5, 2024
@McShelby McShelby changed the title summaryLength is not respected by .Summary summaryLength behaves differently since 0.134.0 Sep 5, 2024
@McShelby
Copy link
Author

McShelby commented Sep 5, 2024

I am okay with it, if this is desired behavior. Although a notice in the release notes would have been great.

I've changed the title of this issue accordingly.

@bep
Copy link
Member

bep commented Sep 5, 2024

Although a notice in the release notes would have been great.

Yea, well, this isn't my day job.

@bep bep closed this as completed Sep 5, 2024
@McShelby McShelby changed the title summaryLength behaves differently since 0.134.0 summaryLength applies differently since 0.134.0 Sep 5, 2024
@bep
Copy link
Member

bep commented Sep 5, 2024

For others reading this; there is a truncate func (https://gohugo.io/functions/strings/truncate/) that understands HTML that can be used for more ... fine grained control over the length.

@jmooring
Copy link
Member

jmooring commented Sep 5, 2024

I've updated the documentation to reflect the behavioral change:

@bep bep self-assigned this Sep 9, 2024
@bep bep modified the milestones: v0.134.1, v0.134.2 Sep 9, 2024
@bep bep reopened this Sep 9, 2024
bep added a commit to bep/hugo that referenced this issue Sep 10, 2024
This commit also fixes a bug where a `</picture>` end tag was wrongly used to detect a end paragraph. This should be very rare, though.

Closes gohugoio#12837
bep added a commit to bep/hugo that referenced this issue Sep 10, 2024
This commit also fixes a bug where a `</picture>` end tag was wrongly used to detect a end paragraph. This should be very rare, though.

Closes gohugoio#12837
bep added a commit to bep/hugo that referenced this issue Sep 10, 2024
This commit also fixes a bug where a `</picture>` end tag was wrongly used to detect a end paragraph. This should be very rare, though.

Closes gohugoio#12837
@bep bep closed this as completed in 3d6baed Sep 10, 2024
Copy link

github-actions bot commented Oct 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants