Skip to content

Commit

Permalink
feat: option to plainify summary
Browse files Browse the repository at this point in the history
In the release of [Hugo v0.134](https://github.com/gohugoio/hugo/releases/tag/v0.134.0) they changed the way summaries are done. Not plainifying the summaries leads to layout issues in lists, this fixes that

Signed-off-by: Vegard Hagen <[email protected]>
  • Loading branch information
vehagn committed Oct 28, 2024
1 parent f037da3 commit 08b692f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ forgejoDefaultServer = "https://v8.next.forgejo.org"
layoutBackgroundHeaderSpace = true # only used when heroStyle equals background
showBreadcrumbs = false
showSummary = false
plainifySummary = true # only used when showSummary = true
showViews = false
showLikes = false
showTableOfContents = false
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/article-link/card-related.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@

{{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }}
<div class="py-1 prose dark:prose-invert">
{{- if .Params.plainifySummary | default (.Site.Params.list.plainifySummary | default true) }}
{{ .Summary | plainify }}
{{- else }}
{{ .Summary }}
{{- end }}
</div>
{{ end }}
</div>
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/article-link/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@

{{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }}
<div class="py-1 prose dark:prose-invert">
{{- if .Params.plainifySummary | default (.Site.Params.list.plainifySummary | default true) }}
{{ .Summary | plainify }}
{{- else }}
{{ .Summary }}
{{- end }}
</div>
{{ end }}
</div>
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/article-link/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@
</div>
{{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }}
<div class="py-1 max-w-fit prose dark:prose-invert">
{{- if .Params.plainifySummary | default (.Site.Params.list.plainifySummary | default true) }}
{{ .Summary | plainify }}
{{- else }}
{{ .Summary }}
{{- end }}
</div>
{{ end }}
</div>
Expand Down

0 comments on commit 08b692f

Please sign in to comment.