diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 30ce76c..623ac1f 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,5 +1,5 @@
-
+
@@ -15,19 +15,19 @@
{{ else }}
{{ end }}
- {{ with .Params.author | default .Site.Params.author }}
+ {{ with .Params.author | compare.Default .Site.Params.author }}
{{- $author := . -}}
{{- if reflect.IsSlice . -}}
- {{- $author = delimit . ", " | plainify -}}
+ {{- $author = collections.Delimit . ", " | transform.Plainify -}}
{{- end -}}
{{ end }}
- {{ partial "site-style.html" . }}
- {{ partial "site-scripts.html" . }}
+ {{ partials.Include "site-style.html" . }}
+ {{ partials.Include "site-scripts.html" . }}
{{ block "favicon" . }}
- {{ partialCached "site-favicon.html" . }}
+ {{ partials.IncludeCached "site-favicon.html" . }}
{{ end }}
{{ if .OutputFormats.Get "RSS" }}
@@ -51,16 +51,16 @@
{{ if hugo.IsProduction }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}
- {{ block "head" . }}{{ partial "head-additions.html" . }}{{ end }}
+ {{ block "head" . }}{{ partials.Include "head-additions.html" . }}{{ end }}
- {{- $environment := hugo.Environment | default "production" -}}
-
+ {{- $environment := hugo.Environment | compare.Default "production" -}}
+
- {{ block "header" . }}{{ partial "site-header.html" .}}{{ end }}
+ {{ block "header" . }}{{ partials.Include "site-header.html" .}}{{ end }}
{{ block "main" . }}{{ end }}
- {{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
+ {{ block "footer" . }}{{ partials.IncludeCached "site-footer.html" . }}{{ end }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 961bc5c..cfd38da 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,6 +1,6 @@
{{ define "main" }}
-
+
{{- .Content -}}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 89a2407..cea0ed7 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,12 +1,12 @@
{{ define "header" }}
{{/* We can override any block in the baseof file be defining it in the template */}}
- {{ partial "page-header.html" . }}
+ {{ partials.Include "page-header.html" . }}
{{ end }}
{{ define "main" }}
{{ $page := .}}
{{ $section := .Site.GetPage "section" .Section }}
-
+
- {{- partialCached "social/share.html" . . -}}
+ {{- partials.IncludeCached "social/share.html" . . -}}
{{- .Title -}}
- {{ with .Params.author | default .Site.Params.author }}
+ {{ with .Params.author | compare.Default .Site.Params.author }}
- {{- if eq $page.Language "de" "en" "es" "fr" "it" "no" "pt" -}}
- {{- i18n "by" -}}
+ {{- if compare.Eq $page.Language "de" "en" "es" "fr" "it" "no" "pt" -}}
+ {{- lang.Translate "by" -}}
{{ end -}}
{{- if reflect.IsSlice . -}}
- {{ delimit . ", " | markdownify }}
+ {{ collections.Delimit . ", " | transform.Markdownify }}
{{- else -}}
- {{ . | markdownify }}
+ {{ . | transform.Markdownify }}
{{- end -}}
{{ end }}
{{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}
{{ if not .Date.IsZero }}
-
-
+
{{- .Content -}}
- {{- partial "tags.html" . -}}
+ {{- partials.Include "tags.html" . -}}
{{ if .Site.Config.Services.Disqus.Shortname }}
{{ template "_internal/disqus.html" . }}
{{ end }}
{{ if .Site.Params.commentoEnable }}
- {{- partial "commento.html" . -}}
+ {{- partials.Include "commento.html" . -}}
{{ end }}
diff --git a/layouts/_default/summary-with-image.html b/layouts/_default/summary-with-image.html
index d6a88ce..266feb1 100644
--- a/layouts/_default/summary-with-image.html
+++ b/layouts/_default/summary-with-image.html
@@ -1,16 +1,16 @@
-{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
+{{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
-
+
{{ if $featured_image }}
- {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
-
+ {{/* Trimming the slash and adding absURL make sure the image works no matter collections.Where our site lives */}}
+
{{ end }}
-
+
{{ .Title }}
@@ -19,10 +19,10 @@
{{ .Summary }}
- {{ with .Params.author | default .Site.Params.author }}
+ {{ with .Params.author | compare.Default .Site.Params.author }}
By {{ . }}
{{- end -}}
- {{ $.Param "read_more_copy" | default (i18n "readMore") }}
+ {{ $.Param "read_more_copy" | compare.Default (lang.Translate "readMore") }}
diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html
index 83f095d..c8a904f 100644
--- a/layouts/_default/summary.html
+++ b/layouts/_default/summary.html
@@ -9,6 +9,6 @@
{{ .Summary }}
- {{ $.Param "read_more_copy" | default (i18n "readMore") }}
+ {{ $.Param "read_more_copy" | compare.Default (lang.Translate "readMore") }}
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html
index ab512e6..0186d57 100644
--- a/layouts/_default/taxonomy.html
+++ b/layouts/_default/taxonomy.html
@@ -1,7 +1,7 @@
{{ define "main" }}
-
- {{ i18n "taxonomyPageList" . }}
+
+ {{ lang.Translate "taxonomyPageList" . }}
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
index 093bb53..0385ba4 100644
--- a/layouts/_default/terms.html
+++ b/layouts/_default/terms.html
@@ -1,7 +1,7 @@
{{ define "main" }}
{{ $data := .Data }}
-
+
{{ .Content }}
@@ -10,7 +10,7 @@
{{ range $term := .Data.Pages }}
- {{ $.Data.Singular | humanize }}: {{ $term.LinkTitle }}
+ {{ $.Data.Singular | inflect.Humanize }}: {{ $term.LinkTitle }}
{{ range $term.Pages }}
diff --git a/layouts/index.html b/layouts/index.html
index 9277f6b..732ec7f 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,33 +1,33 @@
{{ define "main" }}
-
+
{{ .Content }}
{{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}}
- {{ $mainSections := site.Params.mainSections | default (slice "post") }}
+ {{ $mainSections := site.Params.mainSections | compare.Default (collections.Slice "post") }}
{{ $show_recent_posts := site.Params.ananke.show_recent_posts }}
- {{ $section := where $.Site.RegularPages "Section" "in" $mainSections }}
+ {{ $section := collections.Where $.Site.RegularPages "Section" "in" $mainSections }}
{{ $section_count := len $section }}
- {{ if and ($show_recent_posts) (ge $section_count 1) }}
+ {{ if and ($show_recent_posts) (compare.Ge $section_count 1) }}
- {{ $n_posts := $.Param "recent_posts_number" | default 3 }}
+ {{ $n_posts := $.Param "recent_posts_number" | compare.Default 3 }}
{{/* Range through the first $n_posts items of the section */}}
- {{ range (first $n_posts $section) }}
+ {{ range (collections.First $n_posts $section) }}
{{ .Render "summary-with-image" }}
{{ end }}
- {{ if ge $section_count (add $n_posts 1) }}
+ {{ if compare.Ge $section_count (math.Add $n_posts 1) }}
- {{ i18n "more" }}
+ {{ lang.Translate "more" }}
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
- {{ range (first 4 (after $n_posts $section)) }}
-
+ {{ range (collections.First 4 (collections.After $n_posts $section)) }}
+
{{ .Title }}
diff --git a/layouts/page/single.html b/layouts/page/single.html
index 825db29..86660c9 100644
--- a/layouts/page/single.html
+++ b/layouts/page/single.html
@@ -1,4 +1,4 @@
-{{ define "header" }}{{ partial "page-header.html" . }}{{ end }}
+{{ define "header" }}{{ partials.Include "page-header.html" . }}{{ end }}
{{ define "main" }}
@@ -7,7 +7,7 @@
{{ .Title }}
-
+
{{ .Content }}
diff --git a/layouts/partials/func/GetFeaturedImage.html b/layouts/partials/func/GetFeaturedImage.html
index 8d250c7..9684d7f 100644
--- a/layouts/partials/func/GetFeaturedImage.html
+++ b/layouts/partials/func/GetFeaturedImage.html
@@ -1,41 +1,41 @@
-{{/*
- GetFeaturedImage
-
- This partial gets the url for featured image for a given page.
-
- If a featured_image was set in the page's front matter, then that will be used.
-
- If not set, this will search page resources to find an image that contains the word
- "cover", and if found, returns the path to that resource.
-
- If no featured_image was set, and there's no "cover" image in page resources, then
- this partial returns an empty string (which evaluates to false).
-
- @return RelPermalink to featured image, or an empty string if not found.
-
-*/}}
-
-{{/* Declare a new string variable, $linkToCover */}}
-{{ $linkToCover := "" }}
-{{ $matches := "feature,cover" }}
-{{/* Use the value from front matter if present */}}
-{{ with .Params.featured_image }}
- {{/* This is the default case, the image lives in the static directory.
- In which case we'll use the static dir */}}
- {{ $linkToCover = trim . "/" | absURL }}
- {{/* If we find a Page Resource matching the exact value, we use it instead. */}}
- {{ with $.Resources.GetMatch . }}
- {{ $linkToCover = .RelPermalink }}
- {{ end }}
-{{/* Find the first image with 'cover' in the name in this page bundle. */}}
-{{ else }}
- {{ with .Resources.ByType "image" }}
- {{ with .GetMatch (printf "**{%s}*" $matches) }}
- {{ $linkToCover = .RelPermalink }}
- {{ end }}
- {{ end }}
-{{ end }}
-
-{{/* return either a permalink, or an empty string. Note that partials can only have a single
-return statement, so this needs to be at the end of the partial (and not in the if block) */}}
-{{ return $linkToCover }}
+{{/*
+ GetFeaturedImage
+
+ This partial gets the url for featured image for a given page.
+
+ If a featured_image was set in the page's front matter, then that will be used.
+
+ If not set, this will search page resources to find an image that contains the word
+ "cover", and if found, returns the path to that resource.
+
+ If no featured_image was set, and there's no "cover" image in page resources, then
+ this partial returns an empty string (which evaluates to false).
+
+ @return RelPermalink to featured image, or an empty string if not found.
+
+*/}}
+
+{{/* Declare a new string variable, $linkToCover */}}
+{{ $linkToCover := "" }}
+{{ $matches := "feature,cover" }}
+{{/* Use the value from front matter if present */}}
+{{ with .Params.featured_image }}
+ {{/* This is the default case, the image lives in the static directory.
+ In which case we'll use the static dir */}}
+ {{ $linkToCover = strings.Trim . "/" | urls.AbsURL }}
+ {{/* If we find a Page Resource matching the exact value, we use it instead. */}}
+ {{ with $.Resources.GetMatch . }}
+ {{ $linkToCover = .RelPermalink }}
+ {{ end }}
+{{/* Find the first image with 'cover' in the name in this page bundle. */}}
+{{ else }}
+ {{ with .Resources.ByType "image" }}
+ {{ with .GetMatch (fmt.Printf "**{%s}*" $matches) }}
+ {{ $linkToCover = .RelPermalink }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+{{/* return either a permalink, or an empty string. Note that partials can only have a single
+return statement, so this needs to be at the end of the partial (and not in the if block) */}}
+{{ return $linkToCover }}
diff --git a/layouts/partials/func/GetLanguageDirection.html b/layouts/partials/func/GetLanguageDirection.html
index e42a423..28da8e5 100644
--- a/layouts/partials/func/GetLanguageDirection.html
+++ b/layouts/partials/func/GetLanguageDirection.html
@@ -1,5 +1,5 @@
{{ $dir := "" }}
-{{ if ge hugo.Version "0.67.1" }}
+{{ if compare.Ge hugo.Version "0.67.1" }}
{{ with site.Language.LanguageDirection }}
{{ $dir = . }}
{{ end }}
diff --git a/layouts/partials/func/style/GetMainCSS.html b/layouts/partials/func/style/GetMainCSS.html
index 025f4e1..ce13c9d 100644
--- a/layouts/partials/func/style/GetMainCSS.html
+++ b/layouts/partials/func/style/GetMainCSS.html
@@ -14,11 +14,11 @@
{{ $main_style := dict }}
{{/* We prepare a slice of resources to be concatenated as one */}}
-{{ $assets_to_concat := slice }}
+{{ $assets_to_concat := collections.Slice }}
{{/* We add locale css files to the slice in the proper order */}}
-{{ range slice "_tachyons.css" "_code.css" "_hugo-internal-templates.css" "_social-icons.css" "_styles.css" }}
- {{ with partialCached "func/style/GetResource.html" . . }}
- {{ $assets_to_concat = $assets_to_concat | append . }}
+{{ range collections.Slice "_tachyons.css" "_code.css" "_hugo-internal-templates.css" "_social-icons.css" "_styles.css" }}
+ {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
{{ end }}
{{ end }}
@@ -26,20 +26,20 @@
{{- $networks := $config.follow.networks -}}
{{- $setups := (collections.Where $config.networks "slug" "in" $networks) }}
{{ with $setups }}
- {{ $socials_rules := slice }}
+ {{ $socials_rules := collections.Slice }}
{{ range $service := . }}
{{ with .color }}
- {{ $rule := printf `
+ {{ $rule := fmt.Printf `
.ananke-socials a.%s:hover {
color: %s !important;
}` $service.slug . }}
- {{ $socials_rules = $socials_rules | append $rule }}
+ {{ $socials_rules = $socials_rules | collections.Append $rule }}
{{ end }}
{{ end }}
{{ with $socials_rules }}
- {{ $socials_rules = delimit . " " }}
+ {{ $socials_rules = collections.Delimit . " " }}
{{ $socials_css := $socials_rules | resources.FromString "ananke/css/generated_socials.css" }}
- {{ $assets_to_concat = $assets_to_concat | append $socials_css }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append $socials_css }}
{{ end }}
{{ end }}
@@ -47,16 +47,16 @@
css asset directory we (unless condition below) add to aforementioned slice */}}
{{ with site.Params.custom_css }}
{{ range . }}
- {{ with partialCached "func/style/GetResource.html" . . }}
- {{ if eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }}
+ {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
+ {{ if compare.Eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }}
{{ if hugo.IsExtended }}
{{/* as we cannot concatenate styles of different types, we sass/scss to be transformed to css beforehand */}}
- {{ $assets_to_concat = $assets_to_concat | append (. | css.Sass) }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append (. | css.Sass) }}
{{ else }}
- {{ partial "func/warn.html" (printf "Processing of stylesheet %s of type %s has been skipped. You need Hugo Extended to process such files." .Name .MediaType.SubType) }}
+ {{ partials.Include "func/warn.html" (fmt.Printf "Processing of stylesheet %s of type %s has been skipped. You need Hugo Extended to process such files." .Name .MediaType.SubType) }}
{{ end }}
{{ else }}
- {{ $assets_to_concat = $assets_to_concat | append . }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
{{ end }}
{{ end }}
{{ end }}
@@ -68,10 +68,10 @@ css asset directory we (unless condition below) add to aforementioned slice */}}
{{/* We then use toCSS to add sourceMap and minify */}}
{{ $options := dict "enableSourceMap" true "precision" 6 }}
- {{ $style = $style | css.Sass $options | minify }}
+ {{ $style = $style | css.Sass $options | resources.Minify }}
{{/* We fingerprint in production for cache busting purposes */}}
{{ if hugo.IsProduction }}
- {{ $style = $style | fingerprint }}
+ {{ $style = $style | resources.Fingerprint }}
{{ end }}
{{/* We're ready to set returning variable with resulting resource */}}
{{ $main_style = $style }}
diff --git a/layouts/partials/func/style/GetResource.html b/layouts/partials/func/style/GetResource.html
index 99ab1bc..098fc0e 100644
--- a/layouts/partials/func/style/GetResource.html
+++ b/layouts/partials/func/style/GetResource.html
@@ -12,7 +12,7 @@
*/}}
{{ $resource := dict }}
-{{ with resources.Get (print "/ananke/css/" .) }}
+{{ with resources.Get (fmt.Print "/ananke/css/" .) }}
{{ $resource = . }}
{{ end }}
diff --git a/layouts/partials/func/warn.html b/layouts/partials/func/warn.html
index 8865dd5..8be191e 100644
--- a/layouts/partials/func/warn.html
+++ b/layouts/partials/func/warn.html
@@ -9,7 +9,7 @@
@access private
@example - Go Template
- {{ partial "func/warn.html" $message }}
+ {{ partials.Include "func/warn.html" $message }}
*/}}
{{ $header := "Ananke Theme Warning" }}
-{{ warnf "\n%s:\n%s" $header . }}
+{{ fmt.Warnf "\n%s:\n%s" $header . }}
diff --git a/layouts/partials/i18nlist.html b/layouts/partials/i18nlist.html
index 080a89a..2ff7aa3 100644
--- a/layouts/partials/i18nlist.html
+++ b/layouts/partials/i18nlist.html
@@ -1,8 +1,8 @@
{{ if .IsTranslated }}
-{{ i18n "translations" }}
-
+{{ lang.Translate "translations" }}
+
{{ range .Translations }}
- -
+
-
{{ .Lang }}
{{ end}}
diff --git a/layouts/partials/menu-contextual.html b/layouts/partials/menu-contextual.html
index ae50dc6..0b7439e 100644
--- a/layouts/partials/menu-contextual.html
+++ b/layouts/partials/menu-contextual.html
@@ -5,7 +5,7 @@
{{- if .Params.toc -}}
- {{ i18n "whatsInThis" . }}
+ {{ lang.Translate "whatsInThis" . }}
{{ .TableOfContents }}
{{- end -}}
@@ -15,11 +15,11 @@
https://gohugo.io/content-management/related/
*/}}
-{{ $related := .Site.RegularPages.Related . | first 15 }}
+{{ $related := .Site.RegularPages.Related . | collections.First 15 }}
{{ with $related }}
- {{ i18n "related" }}
+ {{ lang.Translate "related" }}
{{ range . }}
-
diff --git a/layouts/partials/new-window-icon.html b/layouts/partials/new-window-icon.html
index 8f422ca..1af94b6 100644
--- a/layouts/partials/new-window-icon.html
+++ b/layouts/partials/new-window-icon.html
@@ -1,2 +1,2 @@
{{ $new_window_icon_size := "8px" }}
-{{ partial "svg/new-window.svg" (dict "size" $new_window_icon_size) }}
\ No newline at end of file
+{{ partials.Include "svg/new-window.svg" (dict "size" $new_window_icon_size) }}
\ No newline at end of file
diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html
index 8020370..815cb95 100644
--- a/layouts/partials/page-header.html
+++ b/layouts/partials/page-header.html
@@ -1,14 +1,14 @@
-{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
+{{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
- {{ $featured_image_class := .Params.featured_image_class | default "cover bg-center" }}
- {{ $cover_dimming_class := .Params.cover_dimming_class | default "bg-black-60" }}
+ {{ $featured_image_class := .Params.featured_image_class | compare.Default "cover bg-center" }}
+ {{ $cover_dimming_class := .Params.cover_dimming_class | compare.Default "bg-black-60" }}
- {{ partial "site-navigation.html" . }}
+ {{ partials.Include "site-navigation.html" . }}
{{ if not .Params.omit_header_text }}
- {{ .Title | default .Site.Title }}
+ {{ .Title | compare.Default .Site.Title }}
{{ with .Params.description }}
{{ . }}
@@ -20,8 +20,8 @@
{{ else }}
-
- {{ partial "site-navigation.html" . }}
+
+ {{ partials.Include "site-navigation.html" . }}
{{ end }}
diff --git a/layouts/partials/site-favicon.html b/layouts/partials/site-favicon.html
index b7bb9c1..3171212 100644
--- a/layouts/partials/site-favicon.html
+++ b/layouts/partials/site-favicon.html
@@ -1,3 +1,3 @@
{{ if .Site.Params.favicon }}
-
+
{{ end }}
diff --git a/layouts/partials/site-footer.html b/layouts/partials/site-footer.html
index ce46f14..2ab0b8d 100644
--- a/layouts/partials/site-footer.html
+++ b/layouts/partials/site-footer.html
@@ -1,8 +1,8 @@
-
{{- .Title -}}
- {{ with .Params.author | default .Site.Params.author }} + {{ with .Params.author | compare.Default .Site.Params.author }}- {{- if eq $page.Language "de" "en" "es" "fr" "it" "no" "pt" -}} - {{- i18n "by" -}} + {{- if compare.Eq $page.Language "de" "en" "es" "fr" "it" "no" "pt" -}} + {{- lang.Translate "by" -}} {{ end -}} {{- if reflect.IsSlice . -}} - {{ delimit . ", " | markdownify }} + {{ collections.Delimit . ", " | transform.Markdownify }} {{- else -}} - {{ . | markdownify }} + {{ . | transform.Markdownify }} {{- end -}}
{{ end }} {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}} {{ if not .Date.IsZero }} -
{{ .Title }}
@@ -19,10 +19,10 @@
{{ .Summary }}
- {{ with .Params.author | default .Site.Params.author }}
+ {{ with .Params.author | compare.Default .Site.Params.author }}
By {{ . }}
{{- end -}}
- {{ $.Param "read_more_copy" | default (i18n "readMore") }}
+ {{ $.Param "read_more_copy" | compare.Default (lang.Translate "readMore") }}
{{ i18n "taxonomyPageList" . }}
+{{ lang.Translate "taxonomyPageList" . }}
- {{ $.Data.Singular | humanize }}: {{ $term.LinkTitle }} + {{ $.Data.Singular | inflect.Humanize }}: {{ $term.LinkTitle }}
{{ range $term.Pages }} diff --git a/layouts/index.html b/layouts/index.html index 9277f6b..732ec7f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,33 +1,33 @@ {{ define "main" }} -{{ i18n "more" }}
+{{ lang.Translate "more" }}
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}} - {{ range (first 4 (after $n_posts $section)) }} -
+ {{ range (collections.First 4 (collections.After $n_posts $section)) }}
+
{{ .Title }}
diff --git a/layouts/page/single.html b/layouts/page/single.html
index 825db29..86660c9 100644
--- a/layouts/page/single.html
+++ b/layouts/page/single.html
@@ -1,4 +1,4 @@
-{{ define "header" }}{{ partial "page-header.html" . }}{{ end }}
+{{ define "header" }}{{ partials.Include "page-header.html" . }}{{ end }}
{{ define "main" }}
@@ -7,7 +7,7 @@
{{ .Title }}
-
+
{{ .Content }}
diff --git a/layouts/partials/func/GetFeaturedImage.html b/layouts/partials/func/GetFeaturedImage.html
index 8d250c7..9684d7f 100644
--- a/layouts/partials/func/GetFeaturedImage.html
+++ b/layouts/partials/func/GetFeaturedImage.html
@@ -1,41 +1,41 @@
-{{/*
- GetFeaturedImage
-
- This partial gets the url for featured image for a given page.
-
- If a featured_image was set in the page's front matter, then that will be used.
-
- If not set, this will search page resources to find an image that contains the word
- "cover", and if found, returns the path to that resource.
-
- If no featured_image was set, and there's no "cover" image in page resources, then
- this partial returns an empty string (which evaluates to false).
-
- @return RelPermalink to featured image, or an empty string if not found.
-
-*/}}
-
-{{/* Declare a new string variable, $linkToCover */}}
-{{ $linkToCover := "" }}
-{{ $matches := "feature,cover" }}
-{{/* Use the value from front matter if present */}}
-{{ with .Params.featured_image }}
- {{/* This is the default case, the image lives in the static directory.
- In which case we'll use the static dir */}}
- {{ $linkToCover = trim . "/" | absURL }}
- {{/* If we find a Page Resource matching the exact value, we use it instead. */}}
- {{ with $.Resources.GetMatch . }}
- {{ $linkToCover = .RelPermalink }}
- {{ end }}
-{{/* Find the first image with 'cover' in the name in this page bundle. */}}
-{{ else }}
- {{ with .Resources.ByType "image" }}
- {{ with .GetMatch (printf "**{%s}*" $matches) }}
- {{ $linkToCover = .RelPermalink }}
- {{ end }}
- {{ end }}
-{{ end }}
-
-{{/* return either a permalink, or an empty string. Note that partials can only have a single
-return statement, so this needs to be at the end of the partial (and not in the if block) */}}
-{{ return $linkToCover }}
+{{/*
+ GetFeaturedImage
+
+ This partial gets the url for featured image for a given page.
+
+ If a featured_image was set in the page's front matter, then that will be used.
+
+ If not set, this will search page resources to find an image that contains the word
+ "cover", and if found, returns the path to that resource.
+
+ If no featured_image was set, and there's no "cover" image in page resources, then
+ this partial returns an empty string (which evaluates to false).
+
+ @return RelPermalink to featured image, or an empty string if not found.
+
+*/}}
+
+{{/* Declare a new string variable, $linkToCover */}}
+{{ $linkToCover := "" }}
+{{ $matches := "feature,cover" }}
+{{/* Use the value from front matter if present */}}
+{{ with .Params.featured_image }}
+ {{/* This is the default case, the image lives in the static directory.
+ In which case we'll use the static dir */}}
+ {{ $linkToCover = strings.Trim . "/" | urls.AbsURL }}
+ {{/* If we find a Page Resource matching the exact value, we use it instead. */}}
+ {{ with $.Resources.GetMatch . }}
+ {{ $linkToCover = .RelPermalink }}
+ {{ end }}
+{{/* Find the first image with 'cover' in the name in this page bundle. */}}
+{{ else }}
+ {{ with .Resources.ByType "image" }}
+ {{ with .GetMatch (fmt.Printf "**{%s}*" $matches) }}
+ {{ $linkToCover = .RelPermalink }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+{{/* return either a permalink, or an empty string. Note that partials can only have a single
+return statement, so this needs to be at the end of the partial (and not in the if block) */}}
+{{ return $linkToCover }}
diff --git a/layouts/partials/func/GetLanguageDirection.html b/layouts/partials/func/GetLanguageDirection.html
index e42a423..28da8e5 100644
--- a/layouts/partials/func/GetLanguageDirection.html
+++ b/layouts/partials/func/GetLanguageDirection.html
@@ -1,5 +1,5 @@
{{ $dir := "" }}
-{{ if ge hugo.Version "0.67.1" }}
+{{ if compare.Ge hugo.Version "0.67.1" }}
{{ with site.Language.LanguageDirection }}
{{ $dir = . }}
{{ end }}
diff --git a/layouts/partials/func/style/GetMainCSS.html b/layouts/partials/func/style/GetMainCSS.html
index 025f4e1..ce13c9d 100644
--- a/layouts/partials/func/style/GetMainCSS.html
+++ b/layouts/partials/func/style/GetMainCSS.html
@@ -14,11 +14,11 @@
{{ $main_style := dict }}
{{/* We prepare a slice of resources to be concatenated as one */}}
-{{ $assets_to_concat := slice }}
+{{ $assets_to_concat := collections.Slice }}
{{/* We add locale css files to the slice in the proper order */}}
-{{ range slice "_tachyons.css" "_code.css" "_hugo-internal-templates.css" "_social-icons.css" "_styles.css" }}
- {{ with partialCached "func/style/GetResource.html" . . }}
- {{ $assets_to_concat = $assets_to_concat | append . }}
+{{ range collections.Slice "_tachyons.css" "_code.css" "_hugo-internal-templates.css" "_social-icons.css" "_styles.css" }}
+ {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
{{ end }}
{{ end }}
@@ -26,20 +26,20 @@
{{- $networks := $config.follow.networks -}}
{{- $setups := (collections.Where $config.networks "slug" "in" $networks) }}
{{ with $setups }}
- {{ $socials_rules := slice }}
+ {{ $socials_rules := collections.Slice }}
{{ range $service := . }}
{{ with .color }}
- {{ $rule := printf `
+ {{ $rule := fmt.Printf `
.ananke-socials a.%s:hover {
color: %s !important;
}` $service.slug . }}
- {{ $socials_rules = $socials_rules | append $rule }}
+ {{ $socials_rules = $socials_rules | collections.Append $rule }}
{{ end }}
{{ end }}
{{ with $socials_rules }}
- {{ $socials_rules = delimit . " " }}
+ {{ $socials_rules = collections.Delimit . " " }}
{{ $socials_css := $socials_rules | resources.FromString "ananke/css/generated_socials.css" }}
- {{ $assets_to_concat = $assets_to_concat | append $socials_css }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append $socials_css }}
{{ end }}
{{ end }}
@@ -47,16 +47,16 @@
css asset directory we (unless condition below) add to aforementioned slice */}}
{{ with site.Params.custom_css }}
{{ range . }}
- {{ with partialCached "func/style/GetResource.html" . . }}
- {{ if eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }}
+ {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
+ {{ if compare.Eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }}
{{ if hugo.IsExtended }}
{{/* as we cannot concatenate styles of different types, we sass/scss to be transformed to css beforehand */}}
- {{ $assets_to_concat = $assets_to_concat | append (. | css.Sass) }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append (. | css.Sass) }}
{{ else }}
- {{ partial "func/warn.html" (printf "Processing of stylesheet %s of type %s has been skipped. You need Hugo Extended to process such files." .Name .MediaType.SubType) }}
+ {{ partials.Include "func/warn.html" (fmt.Printf "Processing of stylesheet %s of type %s has been skipped. You need Hugo Extended to process such files." .Name .MediaType.SubType) }}
{{ end }}
{{ else }}
- {{ $assets_to_concat = $assets_to_concat | append . }}
+ {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
{{ end }}
{{ end }}
{{ end }}
@@ -68,10 +68,10 @@ css asset directory we (unless condition below) add to aforementioned slice */}}
{{/* We then use toCSS to add sourceMap and minify */}}
{{ $options := dict "enableSourceMap" true "precision" 6 }}
- {{ $style = $style | css.Sass $options | minify }}
+ {{ $style = $style | css.Sass $options | resources.Minify }}
{{/* We fingerprint in production for cache busting purposes */}}
{{ if hugo.IsProduction }}
- {{ $style = $style | fingerprint }}
+ {{ $style = $style | resources.Fingerprint }}
{{ end }}
{{/* We're ready to set returning variable with resulting resource */}}
{{ $main_style = $style }}
diff --git a/layouts/partials/func/style/GetResource.html b/layouts/partials/func/style/GetResource.html
index 99ab1bc..098fc0e 100644
--- a/layouts/partials/func/style/GetResource.html
+++ b/layouts/partials/func/style/GetResource.html
@@ -12,7 +12,7 @@
*/}}
{{ $resource := dict }}
-{{ with resources.Get (print "/ananke/css/" .) }}
+{{ with resources.Get (fmt.Print "/ananke/css/" .) }}
{{ $resource = . }}
{{ end }}
diff --git a/layouts/partials/func/warn.html b/layouts/partials/func/warn.html
index 8865dd5..8be191e 100644
--- a/layouts/partials/func/warn.html
+++ b/layouts/partials/func/warn.html
@@ -9,7 +9,7 @@
@access private
@example - Go Template
- {{ partial "func/warn.html" $message }}
+ {{ partials.Include "func/warn.html" $message }}
*/}}
{{ $header := "Ananke Theme Warning" }}
-{{ warnf "\n%s:\n%s" $header . }}
+{{ fmt.Warnf "\n%s:\n%s" $header . }}
diff --git a/layouts/partials/i18nlist.html b/layouts/partials/i18nlist.html
index 080a89a..2ff7aa3 100644
--- a/layouts/partials/i18nlist.html
+++ b/layouts/partials/i18nlist.html
@@ -1,8 +1,8 @@
{{ if .IsTranslated }}
-{{ i18n "translations" }}
-
+{{ lang.Translate "translations" }}
+
{{ range .Translations }}
- -
+
-
{{ .Lang }}
{{ end}}
diff --git a/layouts/partials/menu-contextual.html b/layouts/partials/menu-contextual.html
index ae50dc6..0b7439e 100644
--- a/layouts/partials/menu-contextual.html
+++ b/layouts/partials/menu-contextual.html
@@ -5,7 +5,7 @@
{{- if .Params.toc -}}
- {{ i18n "whatsInThis" . }}
+ {{ lang.Translate "whatsInThis" . }}
{{ .TableOfContents }}
{{- end -}}
@@ -15,11 +15,11 @@
https://gohugo.io/content-management/related/
*/}}
-{{ $related := .Site.RegularPages.Related . | first 15 }}
+{{ $related := .Site.RegularPages.Related . | collections.First 15 }}
{{ with $related }}
- {{ i18n "related" }}
+ {{ lang.Translate "related" }}
{{ range . }}
-
diff --git a/layouts/partials/new-window-icon.html b/layouts/partials/new-window-icon.html
index 8f422ca..1af94b6 100644
--- a/layouts/partials/new-window-icon.html
+++ b/layouts/partials/new-window-icon.html
@@ -1,2 +1,2 @@
{{ $new_window_icon_size := "8px" }}
-{{ partial "svg/new-window.svg" (dict "size" $new_window_icon_size) }}
\ No newline at end of file
+{{ partials.Include "svg/new-window.svg" (dict "size" $new_window_icon_size) }}
\ No newline at end of file
diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html
index 8020370..815cb95 100644
--- a/layouts/partials/page-header.html
+++ b/layouts/partials/page-header.html
@@ -1,14 +1,14 @@
-{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
+{{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
- {{ $featured_image_class := .Params.featured_image_class | default "cover bg-center" }}
- {{ $cover_dimming_class := .Params.cover_dimming_class | default "bg-black-60" }}
+ {{ $featured_image_class := .Params.featured_image_class | compare.Default "cover bg-center" }}
+ {{ $cover_dimming_class := .Params.cover_dimming_class | compare.Default "bg-black-60" }}
- {{ partial "site-navigation.html" . }}
+ {{ partials.Include "site-navigation.html" . }}
{{ if not .Params.omit_header_text }}
- {{ .Title | default .Site.Title }}
+ {{ .Title | compare.Default .Site.Title }}
{{ with .Params.description }}
{{ . }}
@@ -20,8 +20,8 @@
{{ else }}
-
- {{ partial "site-navigation.html" . }}
+
+ {{ partials.Include "site-navigation.html" . }}
{{ end }}
diff --git a/layouts/partials/site-favicon.html b/layouts/partials/site-favicon.html
index b7bb9c1..3171212 100644
--- a/layouts/partials/site-favicon.html
+++ b/layouts/partials/site-favicon.html
@@ -1,3 +1,3 @@
{{ if .Site.Params.favicon }}
-
+
{{ end }}
diff --git a/layouts/partials/site-footer.html b/layouts/partials/site-footer.html
index ce46f14..2ab0b8d 100644
--- a/layouts/partials/site-footer.html
+++ b/layouts/partials/site-footer.html
@@ -1,8 +1,8 @@
-
{{ i18n "translations" }}
--
+
- +
- {{ .Lang }} {{ end}} diff --git a/layouts/partials/menu-contextual.html b/layouts/partials/menu-contextual.html index ae50dc6..0b7439e 100644 --- a/layouts/partials/menu-contextual.html +++ b/layouts/partials/menu-contextual.html @@ -5,7 +5,7 @@ {{- if .Params.toc -}}
-
diff --git a/layouts/partials/new-window-icon.html b/layouts/partials/new-window-icon.html
index 8f422ca..1af94b6 100644
--- a/layouts/partials/new-window-icon.html
+++ b/layouts/partials/new-window-icon.html
@@ -1,2 +1,2 @@
{{ $new_window_icon_size := "8px" }}
-{{ partial "svg/new-window.svg" (dict "size" $new_window_icon_size) }}
\ No newline at end of file
+{{ partials.Include "svg/new-window.svg" (dict "size" $new_window_icon_size) }}
\ No newline at end of file
diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html
index 8020370..815cb95 100644
--- a/layouts/partials/page-header.html
+++ b/layouts/partials/page-header.html
@@ -1,14 +1,14 @@
-{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
+{{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
- {{ $featured_image_class := .Params.featured_image_class | default "cover bg-center" }}
- {{ $cover_dimming_class := .Params.cover_dimming_class | default "bg-black-60" }}
+ {{ $featured_image_class := .Params.featured_image_class | compare.Default "cover bg-center" }}
+ {{ $cover_dimming_class := .Params.cover_dimming_class | compare.Default "bg-black-60" }}
- {{ partial "site-navigation.html" . }} + {{ partials.Include "site-navigation.html" . }}{{ if not .Params.omit_header_text }} -{{ .Title | default .Site.Title }}+{{ .Title | compare.Default .Site.Title }}{{ with .Params.description }}{{ . }} @@ -20,8 +20,8 @@ {{ else }}
- - {{ partial "site-navigation.html" . }} ++ {{ partials.Include "site-navigation.html" . }}{{ end }} diff --git a/layouts/partials/site-favicon.html b/layouts/partials/site-favicon.html index b7bb9c1..3171212 100644 --- a/layouts/partials/site-favicon.html +++ b/layouts/partials/site-favicon.html @@ -1,3 +1,3 @@ {{ if .Site.Params.favicon }} - + {{ end }} diff --git a/layouts/partials/site-footer.html b/layouts/partials/site-footer.html index ce46f14..2ab0b8d 100644 --- a/layouts/partials/site-footer.html +++ b/layouts/partials/site-footer.html @@ -1,8 +1,8 @@ -
{{ lang.Translate "translations" }}
+-
{{ range .Translations }}
-
{{ i18n "whatsInThis" . }}
+{{ lang.Translate "whatsInThis" . }}
{{ .TableOfContents }}{{ i18n "related" }}
+{{ lang.Translate "related" }}
-
{{ range . }}