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

Fall back to summary set in front matter #5800

Closed
mcdee opened this Issue Mar 29, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@mcdee
Copy link
Contributor

commented Mar 29, 2019

Hugo's auto-generated page .Summary is often of no use to me so I write my own as a page variable. This means, however, that I need to change common templates (e.g. RSS feed) to use said variable.

Is there any interest in a patch that would alter .Summary so that if a page variable called summary was available it used that value rather than auto-generating one from the content?

@bep

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

Hey,

Short answer is yes, and I'm a little bit surprised that we did not already do so.

To create the least amount of surprises, I suggest that we check for summary in the following order:

  1. The summary split option.
  2. The summary value in front matter (new)
  3. Auto-summary as the last resort

@bep bep changed the title Override auto-generate page .Summary? Fall back to summary set in front matter Mar 29, 2019

@bep bep added the Enhancement label Mar 29, 2019

@bep bep added this to the v0.55 milestone Mar 29, 2019

@mcdee

This comment has been minimized.

Copy link
Contributor Author

commented Apr 1, 2019

Okay will take a look at this.

mcdee added a commit to mcdee/hugo that referenced this issue Apr 1, 2019

hugolib: Add parameter option for .Summary
Add the ability to have a `summary` page variable that overrides
the auto-generated summary.  Logic for obtaining summary becomes:

  * if summary divider is present in content use the text above it
  * if summary variables is present in page metadata use that
  * auto-generate summary from first _x_ words of the content

Fixes gohugoio#5800

@bep bep closed this in #5806 Apr 5, 2019

bep added a commit that referenced this issue Apr 5, 2019

hugolib: Consider summary in front matter for .Summary
Add the ability to have a `summary` page variable that overrides
the auto-generated summary.  Logic for obtaining summary becomes:

  * if summary divider is present in content, use the text above it
  * if summary variables is present in page metadata, use that
  * auto-generate summary from first _x_ words of the content

Fixes #5800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.