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 · 3 comments · Fixed by #5806
Closed

Fall back to summary set in front matter #5800

mcdee opened this issue Mar 29, 2019 · 3 comments · Fixed by #5806

Comments

@mcdee
Copy link
Contributor

mcdee 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
Copy link
Member

bep 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 this to the v0.55 milestone Mar 29, 2019
@mcdee
Copy link
Contributor Author

mcdee 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
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 as completed in #5806 Apr 5, 2019
bep pushed a commit that referenced this issue Apr 5, 2019
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
@github-actions
Copy link

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 Feb 18, 2022
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.

2 participants