Skip to content

Change paragraph to div for summary#199

Open
crnh wants to merge 1 commit intotomfran:mainfrom
crnh:patch-2
Open

Change paragraph to div for summary#199
crnh wants to merge 1 commit intotomfran:mainfrom
crnh:patch-2

Conversation

@crnh
Copy link
Contributor

@crnh crnh commented Mar 4, 2026

Hugo's automatic and manual summaries (see https://gohugo.io/content-management/summaries/#manual-summary) are wrapped in a paragraph. Nested paragraphs are invalid, so when the browser renders the summary, it will be placed after the .line-summary paragraph, causing the summary to be styled as normal text. Using a div for the summary results in correct styling of these summaries, while keeping the styling for summaries specified in the frontmatter intact.

Hugo's automatic and manual summaries (see https://gohugo.io/content-management/summaries/#manual-summary) are wrapped in a paragraph. Nested paragraphs are invalid, so when the browser renders the summary, it will be placed _after_ the `.line-summary` paragraph, causing the summary to be styled as normal text. Using a `div` for the summary results in correct styling of these summaries, while keeping the styling for summaries specified in the frontmatter intact.
Copilot AI review requested due to automatic review settings March 4, 2026 20:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the post list entry template to avoid invalid nested paragraphs when rendering Hugo automatic/manual summaries, ensuring .line-summary styling applies correctly.

Changes:

  • Replace the .line-summary wrapper element from <p> to <div> to avoid nested <p> invalid HTML in list summaries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


{{ if .Site.Params.listSummaries }}
<p class="line-summary"> {{ .Summary }} </p>
<div class="line-summary"> {{ .Summary }} </div>
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation within the {{ if .Site.Params.listSummaries }} block is inconsistent with the surrounding template (e.g., the earlier showListDate block). Consider indenting the <div class="line-summary"> line one level deeper to match the nesting and improve readability.

Suggested change
<div class="line-summary"> {{ .Summary }} </div>
<div class="line-summary"> {{ .Summary }} </div>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants