Skip to content

Commit

Permalink
theme: unify description #845
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Apr 24, 2024
1 parent ebe1dd1 commit 82f9466
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
8 changes: 7 additions & 1 deletion exampleSite/content/basics/migration/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ This document shows you what's new in the latest release and flags it with one o

You may experience slight changes for some icons. In addition you have additional ~1700 icons [to chose](https://fontawesome.com/v6/search?m=free) from.

- {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`include` shortcode](shortcodes/include) is now able to resolve links to resources as well as to files in the file system (the old behavior). You can configure to generate warnings or errors during build by setting `include.errorlevel` to either `warning` or `error` in your `hugo.toml` if a path can not be resolved.
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`children` shortcode](shortcodes/children) was fixed to adhere to its documentation generating the description based on this rule: When no description or summary exists for the page, the first 70 words of the content is taken.

Previously, the summary erroneously was ignored which now can lead to different output if you set `description=true` as a parameter.

In addition, all places where descriptions are printed, now behave in the same way.

- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The [`include` shortcode](shortcodes/include) is now able to resolve links to resources as well as to files in the file system (the old behavior). You can configure to generate warnings or errors during build by setting `include.errorlevel` to either `warning` or `error` in your `hugo.toml` if a path can not be resolved.

- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Math is now usable without enclosing it in a shortcode or codefence by using Hugo's [passthrough configuration](shortcodes/math#passthrough-configuration).

Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"title" (partial "pageHelper/title.hugo" (dict "page" .))
"tags" .Params.tags
"breadcrumb" (trim ((partial "breadcrumbs.html" (dict "page" . "dirOnly" true)) | plainify | htmlUnescape) "\n\r\t ")
"description" .Description
"description" (or .Description .Summary site.Params.Description)
"content" (.Plain | htmlUnescape)
) }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/index.search.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"title" (partial "pageHelper/title.hugo" (dict "page" .))
"tags" .Params.tags
"breadcrumb" (trim ((partial "breadcrumbs.html" (dict "page" . "dirOnly" true)) | plainify | htmlUnescape) "\n\r\t ")
"description" .Description
"description" (or .Description .Summary site.Params.Description)
"content" (.Plain | htmlUnescape)
) }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
<meta name="robots" content="noindex, nofollow, noarchive, noimageindex">
{{- end }}
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}">
<meta name="description" content="{{ with or .Description .Summary site.Params.Description }}{{ . }}{{ end }}">
{{- $authorName := partialCached "authorname.hugo" . }}
<meta name="author" content="{{ $authorName }}">
{{- partial "twitter_cards.html" . }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{- end }}
<meta property="og:title" content="{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}">

{{- with or .Description .Summary site.Params.description | plainify }}
{{- with or .Description .Summary site.Params.Description | plainify }}
<meta property="og:description" content="{{ . }}">
{{- end }}

Expand Down
18 changes: 6 additions & 12 deletions layouts/partials/shortcodes/children.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,24 @@
{{- $numn := add $num $.count }}
{{ (printf "<h%d>" $numn)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }}
{{- if $.description }}
{{- if .Description -}}
<p>{{ .Description }}</p>
{{- else -}}
<p>{{ .Summary }}</p>
{{- with or .Description .Summary site.Params.Description -}}
<p>{{ . }}</p>
{{- end }}
{{- end }}

{{- else if eq $.style "li" }}
{{ (printf "<%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}
{{- if $.description }}
{{- if .Description -}}
<p>{{ .Description }}</p>
{{- else -}}
<p>{{ .Summary }}</p>
{{- with or .Description .Summary site.Params.Description -}}
<p>{{ . }}</p>
{{- end }}
{{- end }}

{{- else }}
{{ (printf "<%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }}
{{- if $.description }}
{{- if .Description -}}
<p>{{ .Description }}</p>
{{- else -}}
<p>{{ .Summary }}</p>
{{- with or .Description .Summary site.Params.Description -}}
<p>{{ . }}</p>
{{- end }}
{{- end }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/twitter_cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="twitter:card" content="summary">
{{- end }}
<meta name="twitter:title" content="{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }}">
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
<meta name="twitter:description" content="{{ with or .Description .Summary site.Params.Description }}{{ . }}{{ end }}">

{{- $twitterSite := "" }}
{{- with site.Params.social }}
Expand Down

0 comments on commit 82f9466

Please sign in to comment.