diff --git a/exampleSite/content/shortcodes/attachments/index.en.md b/exampleSite/content/shortcodes/attachments/index.en.md index 7f8ecaba5b..3bf8824551 100644 --- a/exampleSite/content/shortcodes/attachments/index.en.md +++ b/exampleSite/content/shortcodes/attachments/index.en.md @@ -27,7 +27,7 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/attachments.html" (dict - "context" . + "page" . "sort" "asc" )}} ```` diff --git a/exampleSite/content/shortcodes/badge.en.md b/exampleSite/content/shortcodes/badge.en.md index d49b098dcc..1cb515e667 100644 --- a/exampleSite/content/shortcodes/badge.en.md +++ b/exampleSite/content/shortcodes/badge.en.md @@ -31,30 +31,30 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "content" "Important" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "style" "primary" "title" "Version" "content" "6.6.6" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "style" "red" - "icon" "angle-double-up" + "icon" "angle-double-up" "content" "Captain" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "style" "info" "content" "New" )}} {{ partial "shortcodes/badge.html" (dict - "context" . + "page" . "color" "fuchsia" - "icon" "fab fa-hackerrank" + "icon" "fab fa-hackerrank" "content" "Awesome" )}} ```` diff --git a/exampleSite/content/shortcodes/button.en.md b/exampleSite/content/shortcodes/button.en.md index 5d95b83231..f7bd7887db 100644 --- a/exampleSite/content/shortcodes/button.en.md +++ b/exampleSite/content/shortcodes/button.en.md @@ -25,12 +25,12 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/button.html" (dict - "context" . + "page" . "href" "https://gohugo.io/" "content" "Get Hugo" )}} {{ partial "shortcodes/button.html" (dict - "context" . + "page" . "href" "https://gohugo.io/" "style" "warning" "icon" "dragon" diff --git a/exampleSite/content/shortcodes/children/_index.en.md b/exampleSite/content/shortcodes/children/_index.en.md index 4397a3d68d..048342d2ed 100644 --- a/exampleSite/content/shortcodes/children/_index.en.md +++ b/exampleSite/content/shortcodes/children/_index.en.md @@ -24,7 +24,7 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/children.html" (dict - "context" . + "page" . "sort" "weight" )}} ```` diff --git a/exampleSite/content/shortcodes/expand.en.md b/exampleSite/content/shortcodes/expand.en.md index 9e0ead6e09..f89147b8ce 100644 --- a/exampleSite/content/shortcodes/expand.en.md +++ b/exampleSite/content/shortcodes/expand.en.md @@ -46,7 +46,7 @@ While the examples are using shortcodes with named parameter you are free to use ````go {{ partial "shortcodes/expand.html" (dict - "context" . + "page" . "title" "Expand me..." "content" "Thank you!" )}} diff --git a/exampleSite/content/shortcodes/highlight.en.md b/exampleSite/content/shortcodes/highlight.en.md index ed4e857185..b46b2b5416 100644 --- a/exampleSite/content/shortcodes/highlight.en.md +++ b/exampleSite/content/shortcodes/highlight.en.md @@ -52,7 +52,7 @@ print("Hello World!") ````go {{ partial "shortcodes/highlight.html" (dict - "context" . + "page" . "content" "print(\"Hello World!\")" "lineNos" "true" "type" "py" @@ -66,7 +66,7 @@ print("Hello World!") ````go {{ partial "shortcodes/highlight.html" (dict - "context" . + "page" . "content" "print(\"Hello World!\")" "options" "lineNos=true,wrap=true" "type" "py" diff --git a/exampleSite/content/shortcodes/icon.en.md b/exampleSite/content/shortcodes/icon.en.md index 74b093f8a4..3b5de79ff1 100644 --- a/exampleSite/content/shortcodes/icon.en.md +++ b/exampleSite/content/shortcodes/icon.en.md @@ -37,15 +37,15 @@ While the examples are using shortcodes with positional parameter you are free t ````go {{ partial "shortcodes/icon.html" (dict - "context" . + "page" . "icon" "exclamation-triangle" )}} {{ partial "shortcodes/icon.html" (dict - "context" . + "page" . "icon" "angle-double-up" )}} {{ partial "shortcodes/icon.html" (dict - "context" . + "page" . "icon" "skull-crossbones" )}} ```` diff --git a/exampleSite/content/shortcodes/include.en.md b/exampleSite/content/shortcodes/include.en.md index 95bc43555e..9be81a5cae 100644 --- a/exampleSite/content/shortcodes/include.en.md +++ b/exampleSite/content/shortcodes/include.en.md @@ -28,7 +28,7 @@ While the examples are using shortcodes with named parameter you are free to use ````go {{ partial "shortcodes/include .html" (dict - "context" . + "page" . "file" "shortcodes/INCLUDE_ME.md" )}} ```` diff --git a/exampleSite/content/shortcodes/math.en.md b/exampleSite/content/shortcodes/math.en.md index 22b78b10db..b4de6083a4 100644 --- a/exampleSite/content/shortcodes/math.en.md +++ b/exampleSite/content/shortcodes/math.en.md @@ -46,7 +46,7 @@ $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \ ````go {{ partial "shortcodes/math.html" (dict - "context" . + "page" . "content" "$$left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$" "align" "center" )}} diff --git a/exampleSite/content/shortcodes/mermaid.en.md b/exampleSite/content/shortcodes/mermaid.en.md index 905d81ac01..f350fce57d 100644 --- a/exampleSite/content/shortcodes/mermaid.en.md +++ b/exampleSite/content/shortcodes/mermaid.en.md @@ -56,7 +56,7 @@ graph LR; ````go {{ partial "shortcodes/mermaid.html" (dict - "context" . + "page" . "content" "graph LR;\nIf --> Then\nThen --> Else" "align" "center" "zoom" "true" diff --git a/exampleSite/content/shortcodes/notice.en.md b/exampleSite/content/shortcodes/notice.en.md index 50a022da35..285b6234ef 100644 --- a/exampleSite/content/shortcodes/notice.en.md +++ b/exampleSite/content/shortcodes/notice.en.md @@ -36,7 +36,7 @@ It is all about the boxes. ````go {{ partial "shortcodes/notice.html" (dict - "context" . + "page" . "style" "primary" "title" "There may be pirates" "icon" "skull-crossbones" diff --git a/exampleSite/content/shortcodes/openapi/_index.en.md b/exampleSite/content/shortcodes/openapi/_index.en.md index db73bc22da..9ee621e78a 100644 --- a/exampleSite/content/shortcodes/openapi/_index.en.md +++ b/exampleSite/content/shortcodes/openapi/_index.en.md @@ -25,8 +25,8 @@ While the examples are using shortcodes with named parameter you are free to als ````go {{ partial "shortcodes/openapi.html" (dict - "context" . - "src" "https://petstore3.openapi.io/api/v3/openapi.json" + "page" . + "src" "https://petstore3.openapi.io/api/v3/openapi.json" )}} ```` diff --git a/exampleSite/content/shortcodes/siteparam.en.md b/exampleSite/content/shortcodes/siteparam.en.md index 5a6462a7b1..47a94a662b 100644 --- a/exampleSite/content/shortcodes/siteparam.en.md +++ b/exampleSite/content/shortcodes/siteparam.en.md @@ -29,7 +29,7 @@ While the examples are using shortcodes with named parameter you are free to use ````go {{ partial "shortcodes/siteparam.html" (dict - "context" . + "page" . "name" "editURL" )}} ```` diff --git a/exampleSite/content/shortcodes/tab.en.md b/exampleSite/content/shortcodes/tab.en.md index c78742c5c9..8864ccf69e 100644 --- a/exampleSite/content/shortcodes/tab.en.md +++ b/exampleSite/content/shortcodes/tab.en.md @@ -37,7 +37,7 @@ printf("Hello World!"); ````go {{ partial "shortcodes/tab.html" (dict - "context" . + "page" . "title" "c" "content" ("```c\nprintf(\"Hello World!\")\n```" | .RenderString) )}} diff --git a/exampleSite/content/shortcodes/tabs.en.md b/exampleSite/content/shortcodes/tabs.en.md index 0c1d12f5f9..31e19a1faf 100644 --- a/exampleSite/content/shortcodes/tabs.en.md +++ b/exampleSite/content/shortcodes/tabs.en.md @@ -67,7 +67,7 @@ printf"Hello World!"); ````go {{ partial "shortcodes/tabs.html" (dict - "context" . + "page" . "title" "hello." "content" (slice (dict diff --git a/exampleSite/layouts/partials/shortcodes/piratify.html b/exampleSite/layouts/partials/shortcodes/piratify.html index 5eddc533c8..cfeee0d4cc 100644 --- a/exampleSite/layouts/partials/shortcodes/piratify.html +++ b/exampleSite/layouts/partials/shortcodes/piratify.html @@ -1,21 +1,26 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'piratify' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $content := .content }} {{- $pagefield := cond (ne $content nil) nil (.pagefield | default "Content") }} {{- $writenotice := cond (ne .writenotice nil) .writenotice false }} {{- $langtrg := "pir" }} -{{- $langsrc := cond (eq $context.Lang $langtrg) (.langsrc | default "en") $context.Lang }} +{{- $langsrc := cond (eq $page.Lang $langtrg) (.langsrc | default "en") $page.Lang }} {{- $baseURL := urls.Parse site.BaseURL }} {{- $baseURLpath := $baseURL.Path | default "/" }} -{{- $l := $context.RelPermalink }} +{{- $l := $page.RelPermalink }} {{- $c := "" }} +{{- $srcPage := "" }} {{- if ne $content nil }} {{- $c = $content }} {{- else if eq $pagefield "Content" }} - {{- $c = $context.Content }} + {{- $c = $page.Content }} {{- else if eq $pagefield "TableOfContents" }} - {{- $c = $context.TableOfContents }} + {{- $c = $page.TableOfContents }} {{- end }} -{{- range $context.AllTranslations }} +{{- range $page.AllTranslations }} {{- if eq .Language.Lang $langsrc }} {{- $l = .RelPermalink }} {{- if ne $content nil }} @@ -29,10 +34,10 @@ {{- break }} {{- end }} {{- end }} -{{- if eq $context.Lang $langtrg }} +{{- if eq $page.Lang $langtrg }} {{- if $writenotice }} {{- partial "shortcodes/notice.html" (dict - "context" $context + "page" $page "content" "

Fello' pirrrates, grog made us dizzy! Be awarrre some stuff may look weird in this trrranslat'n. Like Merrrmaids, do'n math or chemistrrry and stuff.

\n" "icon" "skull-crossbones" "style" "warning" @@ -128,9 +133,9 @@ {{- end }} {{- $c = replaceRE (printf "(src|href)=\"([^\"]*?)/%s/([^\"]*?.files/[^\"]*?\")" $langtrg) "${1}=\"${2}/${3}" $c }} {{- if $srcPage }} - {{- $context.Store.Set "hasMathJax" (or ($context.Store.Get "hasMathJax") ($srcPage.Store.Get "hasMathJax")) }} - {{- $context.Store.Set "hasMermaid" (or ($context.Store.Get "hasMermaid") ($srcPage.Store.Get "hasMermaid")) }} - {{- $context.Store.Set "hasOpenapi" (or ($context.Store.Get "hasOpenapi") ($srcPage.Store.Get "hasOpenapi")) }} + {{- $page.Store.Set "hasMathJax" (or ($page.Store.Get "hasMathJax") ($srcPage.Store.Get "hasMathJax")) }} + {{- $page.Store.Set "hasMermaid" (or ($page.Store.Get "hasMermaid") ($srcPage.Store.Get "hasMermaid")) }} + {{- $page.Store.Set "hasOpenapi" (or ($page.Store.Get "hasOpenapi") ($srcPage.Store.Get "hasOpenapi")) }} {{- end }} {{- end }} {{ $c | safeHTML }} \ No newline at end of file diff --git a/exampleSite/layouts/partials/toc.html b/exampleSite/layouts/partials/toc.html index 517fbcf460..97a5fc0c46 100644 --- a/exampleSite/layouts/partials/toc.html +++ b/exampleSite/layouts/partials/toc.html @@ -15,7 +15,7 @@ {{- else }} {{- partial "shortcodes/piratify.html" (dict - "context" . + "page" . "pagefield" "TableOfContents" ) }} {{- end }} diff --git a/exampleSite/layouts/shortcodes/piratify.html b/exampleSite/layouts/shortcodes/piratify.html index 09e409a670..ccf63fccc1 100644 --- a/exampleSite/layouts/shortcodes/piratify.html +++ b/exampleSite/layouts/shortcodes/piratify.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/piratify.html" (dict - "context" .Page + "page" .Page "pagefield" "Content" "writenotice" (.Get "writenotice" | default (.Get 0)) ) }} \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html index f82c1c3b89..e8c1103847 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -66,7 +66,7 @@
-

4{{ partial "shortcodes/icon.html" (dict "context" . "icon" "far fa-frown" )}}4

+

4{{ partial "shortcodes/icon.html" (dict "page" . "icon" "far fa-frown" )}}4

{{ T "title-404" }}

{{ T "message-404" }}

diff --git a/layouts/_default/_markup/render-codeblock-math.html b/layouts/_default/_markup/render-codeblock-math.html index 566b662035..0cadcf928c 100644 --- a/layouts/_default/_markup/render-codeblock-math.html +++ b/layouts/_default/_markup/render-codeblock-math.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/math.html" (dict - "context" .Page + "page" .Page "content" .Inner "align" (index .Attributes "align") ) }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html index 196cac09f1..676a6d83bd 100644 --- a/layouts/_default/_markup/render-codeblock-mermaid.html +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/mermaid.html" (dict - "context" .Page + "page" .Page "content" .Inner "align" (index .Attributes "align") ) }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html index fa5570d87c..2760287be0 100644 --- a/layouts/_default/_markup/render-codeblock.html +++ b/layouts/_default/_markup/render-codeblock.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/highlight.html" (dict - "context" .Page + "page" .Page "attributes" .Attributes "content" .Inner "options" .Options diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index bb4f848b4a..db609b56fe 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -6,7 +6,7 @@ {{- $id = "" }} {{- end }} {{- partial "shortcodes/image.html" (dict - "context" .Page + "page" .Page "url" .Destination "title" .Title "alt" .Text diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 01ab9f9306..ec188b8f08 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,5 +1,5 @@ {{- partial "shortcodes/link.html" (dict - "context" .Page + "page" .Page "url" .Destination "title" .Title "content" .Text diff --git a/layouts/partials/body.searchpage.html b/layouts/partials/body.searchpage.html index ac4f1484a9..ef1a9e7adc 100644 --- a/layouts/partials/body.searchpage.html +++ b/layouts/partials/body.searchpage.html @@ -10,7 +10,7 @@ {{- partial "shortcodes/button.html" (dict - "context" $page + "page" $page "type" "submit" "style" "secondary" "icon" "search" diff --git a/layouts/partials/make-random-md5.hugo b/layouts/partials/make-random-md5.hugo index e6dba739df..60fc793bf0 100644 --- a/layouts/partials/make-random-md5.hugo +++ b/layouts/partials/make-random-md5.hugo @@ -1,5 +1,5 @@ -{{- $context := . }} -{{- if (ne $context.Site.Params.disableRandomIds true) }} +{{- $page := . }} +{{- if (ne $page.Site.Params.disableRandomIds true) }} {{- $random := "" }} {{- $set := split "012345abcdefghijklmnopqrstuvwxyz" "" }} {{- range (seq 16) }} diff --git a/layouts/partials/shortcodes/attachments.html b/layouts/partials/shortcodes/attachments.html index 41557cd46f..78fbe705b9 100644 --- a/layouts/partials/shortcodes/attachments.html +++ b/layouts/partials/shortcodes/attachments.html @@ -1,7 +1,11 @@ {{- $version := split hugo.Version "." }} {{- $major := int (index $version 0) }} {{- $minor := int (index $version 1) }} -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'attachments' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $color := .color | default "" }} {{- $content := .content }} {{- $style := .style | default "default" }} @@ -24,19 +28,19 @@ {{- end }} {{- $sort := .sort | default "asc" }} {{- $pattern := .pattern | default "" }} -{{- $defaultUrlPrefix := strings.TrimRight "/" $context.RelPermalink }} +{{- $defaultUrlPrefix := strings.TrimRight "/" $page.RelPermalink }} {{- if .IsTranslated -}} - {{- $defaultLanguage := (index $context.Site.Home.AllTranslations 0).Lang }} - {{- $defaultLanguagePage := index (where $context.AllTranslations "Language.Lang" $defaultLanguage) 0 }} + {{- $defaultLanguage := (index $page.Site.Home.AllTranslations 0).Lang }} + {{- $defaultLanguagePage := index (where $page.AllTranslations "Language.Lang" $defaultLanguage) 0 }} {{- $defaultUrlPrefix = strings.TrimRight "/" $defaultLanguagePage.RelPermalink }} {{- end }} -{{- $urlPrefix := strings.TrimRight "/" $context.RelPermalink }} -{{- with $context }} +{{- $urlPrefix := strings.TrimRight "/" $page.RelPermalink }} +{{- with $page }} {{- if ne .BundleType "leaf" }} {{- if or (and (eq $major 0) (ge $minor 112)) (gt $major 0) }} - {{- warnf "%q: UNSUPPORTED usage of 'attachments' shortcode found while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $context.File.Path }} + {{- warnf "%q: UNSUPPORTED usage of 'attachments' shortcode found while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $page.File.Path }} {{- else }} - {{- warnf "%q: DEPRECATED usage of 'attachments' shortcode found which will not be compatible while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $context.File.Path }} + {{- warnf "%q: DEPRECATED usage of 'attachments' shortcode found which will not be compatible while using Hugo >= 0.112.0, use a leaf bundle instead; see https://mcshelby.github.io/hugo-theme-relearn/shortcodes/attachments/index.html#single-language" $page.File.Path }} {{- end }} {{- end }}
diff --git a/layouts/partials/shortcodes/badge.html b/layouts/partials/shortcodes/badge.html index d38a4da73a..bb1f56400f 100644 --- a/layouts/partials/shortcodes/badge.html +++ b/layouts/partials/shortcodes/badge.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'badge' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $color := .color | default "" }} {{- $content := .content }} {{- $style := .style | default "default" }} @@ -15,6 +19,6 @@ {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }} {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} -{{- with $context -}} +{{- with $page -}} {{ if or $icon $title }}{{ if $icon }}{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | .RenderString }}{{ end }}{{ end }}{{ $content }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/button.html b/layouts/partials/shortcodes/button.html index 7f4a345c7d..d14ed42f8d 100644 --- a/layouts/partials/shortcodes/button.html +++ b/layouts/partials/shortcodes/button.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'button' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $color := .color | default "" }} {{- $content := .content }} {{- $href := (trim .href " ") | default "" }} @@ -17,8 +21,8 @@ {{- end }} {{- else if and (eq (len $target) 0) (or (strings.HasPrefix $href "http://") (strings.HasPrefix $href "https://") ) }} {{- $target = "_blank" }} - {{- if isset $context.Site.Params "externallinktarget" }} - {{- $target = $context.Site.Params.externalLinkTarget }} + {{- if isset $page.Site.Params "externallinktarget" }} + {{- $target = $page.Site.Params.externalLinkTarget }} {{- end }} {{- end }} {{- $title := .title | default ($content) | default ($style | T) }} @@ -35,7 +39,7 @@ {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} {{- $iconposition := .iconposition | default "left" }} -{{- with $context }} +{{- with $page }} {{- if $isButton }} diff --git a/layouts/partials/shortcodes/children.html b/layouts/partials/shortcodes/children.html index 384ccd6017..1f09c4753b 100644 --- a/layouts/partials/shortcodes/children.html +++ b/layouts/partials/shortcodes/children.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'children' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $showhidden := .showhidden | default false }} {{- if eq (printf "%T" $showhidden) "string" }} {{- $showhidden = (eq $showhidden "true") }} @@ -15,30 +19,30 @@ {{- $containerstyle = "div" }} {{- end }} -{{- with $context }} +{{- with $page }} {{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }} {{- $pages := .Pages }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := $sortTerm | default (.Params.ordersectionsby | default $defaultOrdersectionsby) }} {{- if eq $currentOrdersectionsby "weight" }} - {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if or (eq $currentOrdersectionsby "name") (eq $currentOrdersectionsby "title") }} - {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if eq $currentOrdersectionsby "publishdate" }} - {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if eq $currentOrdersectionsby "date" }} - {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else if eq $currentOrdersectionsby "length" }} - {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- else }} - {{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "context" . }} + {{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{- end }} {{ (printf "" $containerstyle)|safeHTML }} {{- end }} {{- define "childs" }} - {{ $context := .context }} + {{ $page := .page }} {{- range .menu }} {{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }} {{- if not $hidden }} @@ -88,17 +92,17 @@ {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := $.sortTerm | default (.Params.ordersectionsby | default $defaultOrdersectionsby) }} {{- if eq $currentOrdersectionsby "weight" }} - {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if or (eq $.currentOrdersectionsby "name") (eq $.currentOrdersectionsby "title") }} - {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if eq $.currentOrdersectionsby "publishdate" }} - {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if eq $.currentOrdersectionsby "date" }} - {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else if eq $.currentOrdersectionsby "length" }} - {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages.ByLength "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- else }} - {{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "context" $context }} + {{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- end }} {{- if eq $.style "li" }} diff --git a/layouts/partials/shortcodes/expand.html b/layouts/partials/shortcodes/expand.html index d5f5f379dc..9e60974077 100644 --- a/layouts/partials/shortcodes/expand.html +++ b/layouts/partials/shortcodes/expand.html @@ -1,4 +1,8 @@ -{{- $context := .context }} +{{- $page := .page }} +{{- if and (not $page) .context }} + {{- $page = .context }} + {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'expand' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180-2023-07-27" $page.File.Path }} +{{- end }} {{- $content := .content }} {{- $title := .title | default (T "Expand-title") }} {{- $title = trim $title " " }} @@ -6,8 +10,8 @@ {{- if eq (printf "%T" $expanded) "string" }} {{- $expanded = (eq $expanded "true") }} {{- end }} -{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $context) .id }} -{{- with $context }} +{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }} +{{- with $page }}