refactor: move all template methods to proper GoHugo methods

Signed-off-by: Patrick Kollitsch <patrick@davids-neighbour.com>
This commit is contained in:
Patrick Kollitsch 2025-03-10 16:29:18 +07:00
parent 7a7de28a52
commit 180471112e
No known key found for this signature in database
GPG Key ID: 01A2661D61A772CA
32 changed files with 196 additions and 196 deletions

View File

@ -1,4 +1,4 @@
{{ define "header" }}{{ partial "page-header.html" . }}{{ end }} {{ define "header" }}{{ partials.Include "page-header.html" . }}{{ end }}
{{ define "main" }} {{ define "main" }}
<article class="center cf pv5 measure-wide-l"> <article class="center cf pv5 measure-wide-l">
<h1> <h1>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ site.Language.LanguageCode }}" {{- with partialCached "func/GetLanguageDirection.html" "GetLanguageDirection" }} dir="{{ . }}" {{- end }}> <html lang="{{ site.Language.LanguageCode }}" {{- with partials.IncludeCached "func/GetLanguageDirection.html" "GetLanguageDirection" }} dir="{{ . }}" {{- end }}>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@ -15,19 +15,19 @@
{{ else }} {{ else }}
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
{{ end }} {{ end }}
{{ with .Params.author | default .Site.Params.author }} {{ with .Params.author | compare.Default .Site.Params.author }}
{{- $author := . -}} {{- $author := . -}}
{{- if reflect.IsSlice . -}} {{- if reflect.IsSlice . -}}
{{- $author = delimit . ", " | plainify -}} {{- $author = collections.Delimit . ", " | transform.Plainify -}}
{{- end -}} {{- end -}}
<meta name="author" content="{{ $author }}"> <meta name="author" content="{{ $author }}">
{{ end }} {{ end }}
{{ partial "site-style.html" . }} {{ partials.Include "site-style.html" . }}
{{ partial "site-scripts.html" . }} {{ partials.Include "site-scripts.html" . }}
{{ block "favicon" . }} {{ block "favicon" . }}
{{ partialCached "site-favicon.html" . }} {{ partials.IncludeCached "site-favicon.html" . }}
{{ end }} {{ end }}
{{ if .OutputFormats.Get "RSS" }} {{ if .OutputFormats.Get "RSS" }}
@ -51,16 +51,16 @@
{{ if hugo.IsProduction }} {{ if hugo.IsProduction }}
{{ template "_internal/google_analytics.html" . }} {{ template "_internal/google_analytics.html" . }}
{{ end }} {{ end }}
{{ block "head" . }}{{ partial "head-additions.html" . }}{{ end }} {{ block "head" . }}{{ partials.Include "head-additions.html" . }}{{ end }}
</head> </head>
{{- $environment := hugo.Environment | default "production" -}} {{- $environment := hugo.Environment | compare.Default "production" -}}
<body class="ma0 {{ $.Param "body_classes" | default "avenir bg-near-white"}} {{ $environment }}"> <body class="ma0 {{ $.Param "body_classes" | compare.Default "avenir bg-near-white"}} {{ $environment }}">
{{ block "header" . }}{{ partial "site-header.html" .}}{{ end }} {{ block "header" . }}{{ partials.Include "site-header.html" .}}{{ end }}
<main class="pb7" role="main"> <main class="pb7" role="main">
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</main> </main>
{{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }} {{ block "footer" . }}{{ partials.IncludeCached "site-footer.html" . }}{{ end }}
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
{{ define "main" }} {{ define "main" }}
<article class="pa3 pa4-ns nested-copy-line-height"> <article class="pa3 pa4-ns nested-copy-line-height">
<section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}"> <section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | compare.Default "mid-gray" }}">
{{- .Content -}} {{- .Content -}}
</section> </section>
<section class="flex-ns flex-wrap justify-around mt5"> <section class="flex-ns flex-wrap justify-around mt5">

View File

@ -1,12 +1,12 @@
{{ define "header" }} {{ define "header" }}
{{/* We can override any block in the baseof file be defining it in the template */}} {{/* 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 }} {{ end }}
{{ define "main" }} {{ define "main" }}
{{ $page := .}} {{ $page := .}}
{{ $section := .Site.GetPage "section" .Section }} {{ $section := .Site.GetPage "section" .Section }}
<article class="flex-l flex-wrap justify-between mw8 center ph3"> <article class="flex-wrap justify-between flex-l mw8 center ph3">
<header class="mt4 w-100"> <header class="mt4 w-100">
<aside class="instapaper_ignoref b helvetica tracked ttu"> <aside class="instapaper_ignoref b helvetica tracked ttu">
{{/* {{/*
@ -15,27 +15,27 @@
*/}} */}}
{{ .CurrentSection.Title }} {{ .CurrentSection.Title }}
</aside> </aside>
{{- partialCached "social/share.html" . . -}} {{- partials.IncludeCached "social/share.html" . . -}}
<h1 class="f1 athelas mt3 mb1"> <h1 class="f1 athelas mt3 mb1">
{{- .Title -}} {{- .Title -}}
</h1> </h1>
{{ with .Params.author | default .Site.Params.author }} {{ with .Params.author | compare.Default .Site.Params.author }}
<p class="tracked"> <p class="tracked">
{{- if eq $page.Language "de" "en" "es" "fr" "it" "no" "pt" -}} {{- if compare.Eq $page.Language "de" "en" "es" "fr" "it" "no" "pt" -}}
{{- i18n "by" -}} {{- lang.Translate "by" -}}
{{ end -}} <strong> {{ end -}} <strong>
{{- if reflect.IsSlice . -}} {{- if reflect.IsSlice . -}}
{{ delimit . ", " | markdownify }} {{ collections.Delimit . ", " | transform.Markdownify }}
{{- else -}} {{- else -}}
{{ . | markdownify }} {{ . | transform.Markdownify }}
{{- end -}} {{- end -}}
</strong> </strong>
</p> </p>
{{ end }} {{ end }}
{{/* Hugo uses Go's date formatting is set by example. Here are two formats */}} {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}
{{ if not .Date.IsZero }} {{ if not .Date.IsZero }}
<time class="f6 mv4 dib tracked" {{ printf `datetime="%s"` (.Date.Format "2006-01-02T15:04:05Z07:00") | safeHTMLAttr }}> <time class="f6 mv4 dib tracked" {{ fmt.Printf `datetime="%s"` (.Date.Format "2006-01-02T15:04:05Z07:00") | safe.HTMLAttr }}>
{{- .Date | time.Format (default "January 2, 2006" .Site.Params.date_format) -}} {{- .Date | time.Format (compare.Default "January 2, 2006" .Site.Params.date_format) -}}
</time> </time>
{{end}} {{end}}
@ -45,26 +45,26 @@
2) A section front matter value is set `show_reading_time = true` 2) A section front matter value is set `show_reading_time = true`
3) A page front matter value is set `show_reading_time = true` 3) A page front matter value is set `show_reading_time = true`
*/}} */}}
{{ if (or (eq (.Param "show_reading_time") true) (eq $section.Params.show_reading_time true) )}} {{ if (or (compare.Eq (.Param "show_reading_time") true) (compare.Eq $section.Params.show_reading_time true) )}}
<span class="f6 mv4 dib tracked"> - {{ i18n "readingTime" .ReadingTime }} </span> <span class="f6 mv4 dib tracked"> - {{ lang.Translate "readingTime" .ReadingTime }} </span>
<span class="f6 mv4 dib tracked"> - {{ i18n "wordCount" .WordCount }} </span> <span class="f6 mv4 dib tracked"> - {{ lang.Translate "wordCount" .WordCount }} </span>
{{ end }} {{ end }}
</header> </header>
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f4 nested-links {{ $.Param "text_color" | default "mid-gray" }} {{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl4-l" "pr4-l" }} w-two-thirds-l"> <div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | compare.Default "serif"}} f4 nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }} {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pl4-l" "pr4-l" }} w-two-thirds-l">
{{- .Content -}} {{- .Content -}}
{{- partial "tags.html" . -}} {{- partials.Include "tags.html" . -}}
<div class="mt6 instapaper_ignoref"> <div class="mt6 instapaper_ignoref">
{{ if .Site.Config.Services.Disqus.Shortname }} {{ if .Site.Config.Services.Disqus.Shortname }}
{{ template "_internal/disqus.html" . }} {{ template "_internal/disqus.html" . }}
{{ end }} {{ end }}
{{ if .Site.Params.commentoEnable }} {{ if .Site.Params.commentoEnable }}
{{- partial "commento.html" . -}} {{- partials.Include "commento.html" . -}}
{{ end }} {{ end }}
</div> </div>
</div> </div>
<aside class="w-30-l mt6-l"> <aside class="w-30-l mt6-l">
{{- partial "menu-contextual.html" . -}} {{- partials.Include "menu-contextual.html" . -}}
</aside> </aside>
</article> </article>

View File

@ -1,16 +1,16 @@
{{ $featured_image := partial "func/GetFeaturedImage.html" . }} {{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
<article class="bb b--black-10"> <article class="bb b--black-10">
<div class="db pv4 ph3 ph0-l no-underline dark-gray"> <div class="no-underline db pv4 ph3 ph0-l dark-gray">
<div class="flex flex-column flex-row-ns"> <div class="flex flex-column flex-row-ns">
{{ if $featured_image }} {{ 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 */}}
<div class="{{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl3-ns" "pr3-ns" }} mb4 mb0-ns w-100 w-40-ns"> <div class="{{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pl3-ns" "pr3-ns" }} mb4 mb0-ns w-100 w-40-ns">
<a href="{{.RelPermalink}}" class="db grow"> <a href="{{.RelPermalink}}" class="db grow">
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}"> <img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
</a> </a>
</div> </div>
{{ end }} {{ end }}
<div class="blah w-100{{ if $featured_image }} w-60-ns {{ cond (eq $.Site.Language.LanguageDirection "rtl") "pr3-ns" "pl3-ns" }}{{ end }}"> <div class="blah w-100{{ if $featured_image }} w-60-ns {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pr3-ns" "pl3-ns" }}{{ end }}">
<h1 class="f3 fw1 athelas mt0 lh-title"> <h1 class="f3 fw1 athelas mt0 lh-title">
<a href="{{.RelPermalink}}" class="color-inherit dim link"> <a href="{{.RelPermalink}}" class="color-inherit dim link">
{{ .Title }} {{ .Title }}
@ -19,10 +19,10 @@
<div class="f6 f5-l lh-copy nested-copy-line-height nested-links"> <div class="f6 f5-l lh-copy nested-copy-line-height nested-links">
{{ .Summary }} {{ .Summary }}
</div> </div>
{{ with .Params.author | default .Site.Params.author }} {{ with .Params.author | compare.Default .Site.Params.author }}
<p class="f6 lh-copy mv0">By {{ . }}</p> <p class="f6 lh-copy mv0">By {{ . }}</p>
{{- end -}} {{- end -}}
<a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a> <a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | compare.Default (lang.Translate "readMore") }}</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -9,6 +9,6 @@
<div class="nested-links f5 lh-copy nested-copy-line-height"> <div class="nested-links f5 lh-copy nested-copy-line-height">
{{ .Summary }} {{ .Summary }}
</div> </div>
<a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a> <a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | compare.Default (lang.Translate "readMore") }}</a>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
{{ define "main" }} {{ define "main" }}
<article class="cf pa3 pa4-m pa4-l"> <article class="cf pa3 pa4-m pa4-l">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links {{ $.Param "text_color" | default "mid-gray" }}"> <div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }}">
<p>{{ i18n "taxonomyPageList" . }}</p> <p>{{ lang.Translate "taxonomyPageList" . }}</p>
</div> </div>
</article> </article>
<div class="mw8 center"> <div class="mw8 center">

View File

@ -1,7 +1,7 @@
{{ define "main" }} {{ define "main" }}
{{ $data := .Data }} {{ $data := .Data }}
<article class="cf pa3 pa4-m pa4-l"> <article class="cf pa3 pa4-m pa4-l">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links {{ $.Param "text_color" | default "mid-gray" }}"> <div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }}">
{{ .Content }} {{ .Content }}
</div> </div>
</article> </article>
@ -10,7 +10,7 @@
{{ range $term := .Data.Pages }} {{ range $term := .Data.Pages }}
<h2 class="f1"> <h2 class="f1">
<a href="{{ $term.RelPermalink }}" class="link blue hover-black"> <a href="{{ $term.RelPermalink }}" class="link blue hover-black">
{{ $.Data.Singular | humanize }}: {{ $term.LinkTitle }} {{ $.Data.Singular | inflect.Humanize }}: {{ $term.LinkTitle }}
</a> </a>
</h2> </h2>
{{ range $term.Pages }} {{ range $term.Pages }}

View File

@ -1,33 +1,33 @@
{{ define "main" }} {{ define "main" }}
<article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}"> <article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | compare.Default "mid-gray" }}">
{{ .Content }} {{ .Content }}
</article> </article>
{{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}} {{/* 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 }} {{ $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 }} {{ $section_count := len $section }}
{{ if and ($show_recent_posts) (ge $section_count 1) }} {{ if and ($show_recent_posts) (compare.Ge $section_count 1) }}
<div class="pa3 pa4-ns w-100 w-70-ns center"> <div class="pa3 pa4-ns w-100 w-70-ns center">
{{ $n_posts := $.Param "recent_posts_number" | default 3 }} {{ $n_posts := $.Param "recent_posts_number" | compare.Default 3 }}
<section class="w-100 mw8"> <section class="w-100 mw8">
{{/* Range through the first $n_posts items of the section */}} {{/* Range through the first $n_posts items of the section */}}
{{ range (first $n_posts $section) }} {{ range (collections.First $n_posts $section) }}
<div class="relative w-100 mb4"> <div class="relative w-100 mb4">
{{ .Render "summary-with-image" }} {{ .Render "summary-with-image" }}
</div> </div>
{{ end }} {{ end }}
</section> </section>
{{ if ge $section_count (add $n_posts 1) }} {{ if compare.Ge $section_count (math.Add $n_posts 1) }}
<section class="w-100"> <section class="w-100">
<h1 class="f3">{{ i18n "more" }}</h1> <h1 class="f3">{{ lang.Translate "more" }}</h1>
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}} {{/* 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)) }}
<h2 class="f5 fw4 mb4 dib {{ cond (eq $.Site.Language.LanguageDirection "rtl") "ml3" "mr3" }}"> <h2 class="f5 fw4 mb4 dib {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "ml3" "mr3" }}">
<a href="{{ .RelPermalink }}" class="link black dim"> <a href="{{ .RelPermalink }}" class="link black dim">
{{ .Title }} {{ .Title }}
</a> </a>

View File

@ -1,4 +1,4 @@
{{ define "header" }}{{ partial "page-header.html" . }}{{ end }} {{ define "header" }}{{ partials.Include "page-header.html" . }}{{ end }}
{{ define "main" }} {{ define "main" }}
<div class="flex-l mt2 mw8 center"> <div class="flex-l mt2 mw8 center">
<article class="center cf pv5 ph3 ph4-ns mw7"> <article class="center cf pv5 ph3 ph4-ns mw7">
@ -7,7 +7,7 @@
{{ .Title }} {{ .Title }}
</h1> </h1>
</header> </header>
<div class="nested-copy-line-height lh-copy f4 nested-links {{ $.Param "text_color" | default "mid-gray" }}"> <div class="nested-copy-line-height lh-copy f4 nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }}">
{{ .Content }} {{ .Content }}
</div> </div>
</article> </article>

View File

@ -22,7 +22,7 @@
{{ with .Params.featured_image }} {{ with .Params.featured_image }}
{{/* This is the default case, the image lives in the static directory. {{/* This is the default case, the image lives in the static directory.
In which case we'll use the static dir */}} In which case we'll use the static dir */}}
{{ $linkToCover = trim . "/" | absURL }} {{ $linkToCover = strings.Trim . "/" | urls.AbsURL }}
{{/* If we find a Page Resource matching the exact value, we use it instead. */}} {{/* If we find a Page Resource matching the exact value, we use it instead. */}}
{{ with $.Resources.GetMatch . }} {{ with $.Resources.GetMatch . }}
{{ $linkToCover = .RelPermalink }} {{ $linkToCover = .RelPermalink }}
@ -30,7 +30,7 @@
{{/* Find the first image with 'cover' in the name in this page bundle. */}} {{/* Find the first image with 'cover' in the name in this page bundle. */}}
{{ else }} {{ else }}
{{ with .Resources.ByType "image" }} {{ with .Resources.ByType "image" }}
{{ with .GetMatch (printf "**{%s}*" $matches) }} {{ with .GetMatch (fmt.Printf "**{%s}*" $matches) }}
{{ $linkToCover = .RelPermalink }} {{ $linkToCover = .RelPermalink }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -1,5 +1,5 @@
{{ $dir := "" }} {{ $dir := "" }}
{{ if ge hugo.Version "0.67.1" }} {{ if compare.Ge hugo.Version "0.67.1" }}
{{ with site.Language.LanguageDirection }} {{ with site.Language.LanguageDirection }}
{{ $dir = . }} {{ $dir = . }}
{{ end }} {{ end }}

View File

@ -14,11 +14,11 @@
{{ $main_style := dict }} {{ $main_style := dict }}
{{/* We prepare a slice of resources to be concatenated as one */}} {{/* 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 */}} {{/* 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" }} {{ range collections.Slice "_tachyons.css" "_code.css" "_hugo-internal-templates.css" "_social-icons.css" "_styles.css" }}
{{ with partialCached "func/style/GetResource.html" . . }} {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
{{ $assets_to_concat = $assets_to_concat | append . }} {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -26,20 +26,20 @@
{{- $networks := $config.follow.networks -}} {{- $networks := $config.follow.networks -}}
{{- $setups := (collections.Where $config.networks "slug" "in" $networks) }} {{- $setups := (collections.Where $config.networks "slug" "in" $networks) }}
{{ with $setups }} {{ with $setups }}
{{ $socials_rules := slice }} {{ $socials_rules := collections.Slice }}
{{ range $service := . }} {{ range $service := . }}
{{ with .color }} {{ with .color }}
{{ $rule := printf ` {{ $rule := fmt.Printf `
.ananke-socials a.%s:hover { .ananke-socials a.%s:hover {
color: %s !important; color: %s !important;
}` $service.slug . }} }` $service.slug . }}
{{ $socials_rules = $socials_rules | append $rule }} {{ $socials_rules = $socials_rules | collections.Append $rule }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ with $socials_rules }} {{ with $socials_rules }}
{{ $socials_rules = delimit . " " }} {{ $socials_rules = collections.Delimit . " " }}
{{ $socials_css := $socials_rules | resources.FromString "ananke/css/generated_socials.css" }} {{ $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 }}
{{ end }} {{ end }}
@ -47,16 +47,16 @@
css asset directory we (unless condition below) add to aforementioned slice */}} css asset directory we (unless condition below) add to aforementioned slice */}}
{{ with site.Params.custom_css }} {{ with site.Params.custom_css }}
{{ range . }} {{ range . }}
{{ with partialCached "func/style/GetResource.html" . . }} {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
{{ if eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }} {{ if compare.Eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }}
{{ if hugo.IsExtended }} {{ if hugo.IsExtended }}
{{/* as we cannot concatenate styles of different types, we sass/scss to be transformed to css beforehand */}} {{/* 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 }} {{ 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 }} {{ end }}
{{ else }} {{ else }}
{{ $assets_to_concat = $assets_to_concat | append . }} {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
{{ end }} {{ end }}
{{ end }} {{ 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 */}} {{/* We then use toCSS to add sourceMap and minify */}}
{{ $options := dict "enableSourceMap" true "precision" 6 }} {{ $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 */}} {{/* We fingerprint in production for cache busting purposes */}}
{{ if hugo.IsProduction }} {{ if hugo.IsProduction }}
{{ $style = $style | fingerprint }} {{ $style = $style | resources.Fingerprint }}
{{ end }} {{ end }}
{{/* We're ready to set returning variable with resulting resource */}} {{/* We're ready to set returning variable with resulting resource */}}
{{ $main_style = $style }} {{ $main_style = $style }}

View File

@ -12,7 +12,7 @@
*/}} */}}
{{ $resource := dict }} {{ $resource := dict }}
{{ with resources.Get (print "/ananke/css/" .) }} {{ with resources.Get (fmt.Print "/ananke/css/" .) }}
{{ $resource = . }} {{ $resource = . }}
{{ end }} {{ end }}

View File

@ -9,7 +9,7 @@
@access private @access private
@example - Go Template @example - Go Template
{{ partial "func/warn.html" $message }} {{ partials.Include "func/warn.html" $message }}
*/}} */}}
{{ $header := "Ananke Theme Warning" }} {{ $header := "Ananke Theme Warning" }}
{{ warnf "\n%s:\n%s" $header . }} {{ fmt.Warnf "\n%s:\n%s" $header . }}

View File

@ -1,8 +1,8 @@
{{ if .IsTranslated }} {{ if .IsTranslated }}
<h4>{{ i18n "translations" }}</h4> <h4>{{ lang.Translate "translations" }}</h4>
<ul class="{{ cond (eq $.Site.Language.LanguageDirection "rtl") "pr0 ml3" "pl0 mr3" }}"> <ul class="{{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pr0 ml3" "pl0 mr3" }}">
{{ range .Translations }} {{ range .Translations }}
<li class="list f5 f4-ns fw4 dib {{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl3" "pr3" }}"> <li class="list f5 f4-ns fw4 dib {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pl3" "pr3" }}">
<a class="hover-white no-underline white-90" href="{{ .RelPermalink }}">{{ .Lang }}</a> <a class="hover-white no-underline white-90" href="{{ .RelPermalink }}">{{ .Lang }}</a>
</li> </li>
{{ end}} {{ end}}

View File

@ -5,7 +5,7 @@
{{- if .Params.toc -}} {{- if .Params.toc -}}
<div class="bg-light-gray pa3 nested-list-reset nested-copy-line-height nested-links"> <div class="bg-light-gray pa3 nested-list-reset nested-copy-line-height nested-links">
<p class="f5 b mb3">{{ i18n "whatsInThis" . }}</p> <p class="f5 b mb3">{{ lang.Translate "whatsInThis" . }}</p>
{{ .TableOfContents }} {{ .TableOfContents }}
</div> </div>
{{- end -}} {{- end -}}
@ -15,11 +15,11 @@
https://gohugo.io/content-management/related/ https://gohugo.io/content-management/related/
*/}} */}}
{{ $related := .Site.RegularPages.Related . | first 15 }} {{ $related := .Site.RegularPages.Related . | collections.First 15 }}
{{ with $related }} {{ with $related }}
<div class="bg-light-gray pa3 nested-list-reset nested-copy-line-height nested-links"> <div class="bg-light-gray pa3 nested-list-reset nested-copy-line-height nested-links">
<p class="f5 b mb3">{{ i18n "related" }}</p> <p class="f5 b mb3">{{ lang.Translate "related" }}</p>
<ul class="pa0 list"> <ul class="pa0 list">
{{ range . }} {{ range . }}
<li class="mb2"> <li class="mb2">

View File

@ -1,2 +1,2 @@
{{ $new_window_icon_size := "8px" }} {{ $new_window_icon_size := "8px" }}
<span class="new-window">{{ partial "svg/new-window.svg" (dict "size" $new_window_icon_size) }}</span> <span class="new-window">{{ partials.Include "svg/new-window.svg" (dict "size" $new_window_icon_size) }}</span>

View File

@ -1,14 +1,14 @@
{{ $featured_image := partial "func/GetFeaturedImage.html" . }} {{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
{{ if $featured_image }} {{ 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 where our site lives */}}
{{ $featured_image_class := .Params.featured_image_class | default "cover bg-center" }} {{ $featured_image_class := .Params.featured_image_class | compare.Default "cover bg-center" }}
{{ $cover_dimming_class := .Params.cover_dimming_class | default "bg-black-60" }} {{ $cover_dimming_class := .Params.cover_dimming_class | compare.Default "bg-black-60" }}
<header class="{{ $featured_image_class }}" style="background-image: url('{{ $featured_image }}');"> <header class="{{ $featured_image_class }}" style="background-image: url('{{ $featured_image }}');">
<div class="{{ $cover_dimming_class }}"> <div class="{{ $cover_dimming_class }}">
{{ partial "site-navigation.html" . }} {{ partials.Include "site-navigation.html" . }}
<div class="tc-l pv6 ph3 ph4-ns"> <div class="tc-l pv6 ph3 ph4-ns">
{{ if not .Params.omit_header_text }} {{ if not .Params.omit_header_text }}
<div class="f2 f1-l fw2 white-90 mb0 lh-title">{{ .Title | default .Site.Title }}</div> <div class="f2 f1-l fw2 white-90 mb0 lh-title">{{ .Title | compare.Default .Site.Title }}</div>
{{ with .Params.description }} {{ with .Params.description }}
<div class="fw1 f5 f3-l white-80 measure-wide-l center lh-copy mt3 mb4"> <div class="fw1 f5 f3-l white-80 measure-wide-l center lh-copy mt3 mb4">
{{ . }} {{ . }}
@ -20,8 +20,8 @@
</header> </header>
{{ else }} {{ else }}
<header> <header>
<div class="{{ .Site.Params.background_color_class | default "bg-black" }}"> <div class="{{ .Site.Params.background_color_class | compare.Default "bg-black" }}">
{{ partial "site-navigation.html" . }} {{ partials.Include "site-navigation.html" . }}
</div> </div>
</header> </header>
{{ end }} {{ end }}

View File

@ -1,3 +1,3 @@
{{ if .Site.Params.favicon }} {{ if .Site.Params.favicon }}
<link rel="shortcut icon" href="{{ relURL ($.Site.Params.favicon) }}" type="image/x-icon" /> <link rel="shortcut icon" href="{{ urls.RelURL ($.Site.Params.favicon) }}" type="image/x-icon" />
{{ end }} {{ end }}

View File

@ -1,8 +1,8 @@
<footer class="{{ .Site.Params.background_color_class | default "bg-black" }} bottom-0 w-100 pa3" role="contentinfo"> <footer class="{{ .Site.Params.background_color_class | compare.Default "bg-black" }} bottom-0 w-100 pa3" role="contentinfo">
<div class="flex justify-between"> <div class="flex justify-between">
<a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="{{ .Site.Home.Permalink }}" > <a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="{{ .Site.Home.Permalink }}" >
&copy; {{ with .Site.Copyright | default .Site.Title }} {{ . | safeHTML }} {{ now.Format "2006"}} {{ end }} &copy; {{ with .Site.Copyright | compare.Default .Site.Title }} {{ . | safe.HTML }} {{ now.Format "2006"}} {{ end }}
</a> </a>
<div>{{ partialCached "social/follow.html" . }}</div> <div>{{ partials.IncludeCached "social/follow.html" . }}</div>
</div> </div>
</footer> </footer>

View File

@ -1,14 +1,14 @@
{{ $featured_image := partial "func/GetFeaturedImage.html" . }} {{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
{{ if $featured_image }} {{ 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 where our site lives */}}
{{ $featured_image_class := site.Params.featured_image_class | default "cover bg-top" }} {{ $featured_image_class := site.Params.featured_image_class | compare.Default "cover bg-top" }}
<header class="{{ $featured_image_class }}" style="background-image: url('{{ $featured_image }}');"> <header class="{{ $featured_image_class }}" style="background-image: url('{{ $featured_image }}');">
{{ $cover_dimming_class := site.Params.cover_dimming_class | default "bg-black-60" }} {{ $cover_dimming_class := site.Params.cover_dimming_class | compare.Default "bg-black-60" }}
<div class="{{ $cover_dimming_class }}"> <div class="{{ $cover_dimming_class }}">
{{ partial "site-navigation.html" .}} {{ partials.Include "site-navigation.html" .}}
<div class="tc-l pv4 pv6-l ph3 ph4-ns"> <div class="tc-l pv4 pv6-l ph3 ph4-ns">
<h1 class="f2 f-subheadline-l fw2 white-90 mb0 lh-title"> <h1 class="f2 f-subheadline-l fw2 white-90 mb0 lh-title">
{{ .Title | default .Site.Title }} {{ .Title | compare.Default .Site.Title }}
</h1> </h1>
{{ with .Params.description }} {{ with .Params.description }}
<h2 class="fw1 f5 f3-l white-80 measure-wide-l center mt3"> <h2 class="fw1 f5 f3-l white-80 measure-wide-l center mt3">
@ -20,11 +20,11 @@
</header> </header>
{{ else }} {{ else }}
<header> <header>
<div class="pb3-m pb6-l {{ .Site.Params.background_color_class | default "bg-black" }}"> <div class="pb3-m pb6-l {{ .Site.Params.background_color_class | compare.Default "bg-black" }}">
{{ partial "site-navigation.html" . }} {{ partials.Include "site-navigation.html" . }}
<div class="tc-l pv3 ph3 ph4-ns"> <div class="tc-l pv3 ph3 ph4-ns">
<h1 class="f2 f-subheadline-l fw2 light-silver mb0 lh-title"> <h1 class="f2 f-subheadline-l fw2 light-silver mb0 lh-title">
{{ .Title | default .Site.Title }} {{ .Title | compare.Default .Site.Title }}
</h1> </h1>
{{ with .Params.description }} {{ with .Params.description }}
<h2 class="fw1 f5 f3-l white-80 measure-wide-l center lh-copy mt3 mb4"> <h2 class="fw1 f5 f3-l white-80 measure-wide-l center lh-copy mt3 mb4">

View File

@ -2,25 +2,25 @@
<div class="flex-l justify-between items-center center"> <div class="flex-l justify-between items-center center">
<a href="{{ .Site.Home.RelPermalink }}" class="f3 fw2 hover-white no-underline white-90 dib"> <a href="{{ .Site.Home.RelPermalink }}" class="f3 fw2 hover-white no-underline white-90 dib">
{{ with .Site.Params.site_logo }} {{ with .Site.Params.site_logo }}
<img src="{{ relURL . }}" class="w100 mw5-ns" alt="{{ $.Site.Title }}" /> <img src="{{ urls.RelURL . }}" class="w100 mw5-ns" alt="{{ $.Site.Title }}" />
{{ else }} {{ else }}
{{ .Site.Title }} {{ .Site.Title }}
{{ end }} {{ end }}
</a> </a>
<div class="flex-l items-center"> <div class="flex-l items-center">
{{ partial "i18nlist.html" . }} {{ partials.Include "i18nlist.html" . }}
{{ if .Site.Menus.main }} {{ if .Site.Menus.main }}
<ul class="{{ cond (eq $.Site.Language.LanguageDirection "rtl") "pr0 ml3" "pl0 mr3" }}"> <ul class="{{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pr0 ml3" "pl0 mr3" }}">
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
<li class="list f5 f4-ns fw4 dib {{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl3" "pr3" }}"> <li class="list f5 f4-ns fw4 dib {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pl3" "pr3" }}">
<a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ i18n "pageTitle" . }}"> <a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ lang.Translate "pageTitle" . }}">
{{ .Name }} {{ .Name }}
</a> </a>
</li> </li>
{{ end }} {{ end }}
</ul> </ul>
{{ end }} {{ end }}
{{ partialCached "social/follow.html" . }} {{ partials.IncludeCached "social/follow.html" . }}
</div> </div>
</div> </div>
</nav> </nav>

View File

@ -1,9 +1,9 @@
{{ with partialCached "func/style/GetMainCSS.html" "style/GetMainCSS" }} {{ with partials.IncludeCached "func/style/GetMainCSS.html" "style/GetMainCSS" }}
<link rel="stylesheet" href="{{ .RelPermalink }}" > <link rel="stylesheet" href="{{ .RelPermalink }}" >
{{ end }} {{ end }}
{{ range site.Params.custom_css }} {{ range site.Params.custom_css }}
{{ with partialCached "func/style/GetResource.html" . . }}{{ else }} {{ with partials.IncludeCached "func/style/GetResource.html" . . }}{{ else }}
<link rel="stylesheet" href="{{ relURL (.) }}"> <link rel="stylesheet" href="{{ urls.RelURL (.) }}">
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -6,27 +6,27 @@
<div class="ananke-socials"> <div class="ananke-socials">
{{- range $networks -}} {{- range $networks -}}
{{- $network := . -}} {{- $network := . -}}
{{- $setup := index $config.networks $network -}} {{- $setup := collections.Index $config.networks $network -}}
{{- $profile := index $config $network -}} {{- $profile := collections.Index $config $network -}}
{{- $rel := $profile.rel | default "" -}} {{- $rel := $profile.rel | compare.Default "" -}}
{{- $label := $profile.label | default $setup.label -}} {{- $label := $profile.label | compare.Default $setup.label -}}
{{- $link := (printf $setup.profile $profile.username) -}} {{- $link := (fmt.Printf $setup.profile $profile.username) -}}
{{- with $profile.profilelink -}} {{- with $profile.profilelink -}}
{{- $link = $profile.profilelink -}} {{- $link = $profile.profilelink -}}
{{- end -}} {{- end -}}
{{- $languageDirection := cond (eq $.Site.Language.LanguageDirection "rtl") "ml1" "mr1" -}} {{- $languageDirection := compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "ml1" "mr1" -}}
<a href="{{ $link }}" target="_blank" rel="noopener{{- with $rel }} {{ . -}}{{- end -}}" <a href="{{ $link }}" target="_blank" rel="noopener{{- with $rel }} {{ . -}}{{- end -}}"
class="ananke-social-link link-transition {{ $network }} link dib z-999 pt3 pt0-l {{ $languageDirection }}" class="ananke-social-link link-transition {{ $network }} link dib z-999 pt3 pt0-l {{ $languageDirection }}"
title="follow on {{ $label }} - Opens in a new window" title="follow on {{ $label }} - Opens in a new window"
aria-label="follow on {{ $label }} - Opens in a new window"> aria-label="follow on {{ $label }} - Opens in a new window">
{{/* @todo add the following lines to a partial, reused in social/share.html */}} {{/* @todo add the following lines to a partial, reused in social/share.html */}}
{{- with $setup.icon -}} {{- with $setup.icon -}}
{{- $icon := resources.Get (printf "ananke/socials/%s.svg" .) -}} {{- $icon := resources.Get (fmt.Printf "ananke/socials/%s.svg" .) -}}
{{- with $icon -}} {{- with $icon -}}
<span class="icon"> <span class="icon">
{{ .Content | safeHTML }} {{ .Content | safe.HTML }}
{{/* @todo indicator for missing or misconfigured icon */}} {{/* @todo indicator for missing or misconfigured icon */}}
</span> </span>
{{- end -}} {{- end -}}
@ -34,7 +34,7 @@
{{- $label -}} {{- $label -}}
{{- end -}} {{- end -}}
{{- with $config.follow.new_window_icon -}} {{- with $config.follow.new_window_icon -}}
{{- partial "new-window-icon.html" . -}} {{- partials.Include "new-window-icon.html" . -}}
{{- end -}} {{- end -}}
</a> </a>
{{- end -}} {{- end -}}

View File

@ -1,45 +1,45 @@
{{- $context := . -}} {{- $context := . -}}
{{- $disabled := $context.Params.disable_share | default "false" -}} {{- $disabled := $context.Params.disable_share | compare.Default "false" -}}
{{- $config := site.Params.ananke.social -}} {{- $config := site.Params.ananke.social -}}
{{- with $config.share.disable_share -}} {{- with $config.share.disable_share -}}
{{- $disabled := . -}} {{- $disabled := . -}}
{{- end -}} {{- end -}}
{{- if eq "false" $disabled -}} {{- if compare.Eq "false" $disabled -}}
{{- $title := $context.Title -}} {{- $title := $context.Title -}}
{{- $url := printf "%s" $context.Permalink | absLangURL -}} {{- $url := fmt.Printf "%s" $context.Permalink | urls.AbsLangURL -}}
{{- $networks := $config.share.networks -}} {{- $networks := $config.share.networks -}}
{{- $hasLabel := $config.share.sharetext | default "true" -}} {{- $hasLabel := $config.share.sharetext | compare.Default "true" -}}
{{- $hasIcon := $config.share.icons | default "true" -}} {{- $hasIcon := $config.share.icons | compare.Default "true" -}}
<div id="sharing" class="mt3 ananke-socials"> <div id="sharing" class="mt3 ananke-socials">
{{- range $networks -}} {{- range $networks -}}
{{- $network := . -}} {{- $network := . -}}
{{- $setup := index $config.networks $network -}} {{- $setup := collections.Index $config.networks $network -}}
{{/* @todo i18n $sharetext := lang.Translate (fmt.Printf "share_on_%s" $setup.slug) */}} {{/* @todo lang.Translate $sharetext := lang.Translate (fmt.Printf "share_on_%s" $setup.slug) */}}
{{- $label := "" -}} {{- $label := "" -}}
{{ with $config.share.sharetext -}} {{ with $config.share.sharetext -}}
{{- $label = printf "Share on %s" $setup.label -}} {{- $label = fmt.Printf "Share on %s" $setup.label -}}
{{- end -}} {{- end -}}
{{ if eq $setup.share "false" | default "true" -}} {{ if compare.Eq $setup.share "false" | compare.Default "true" -}}
{{- continue -}} {{- continue -}}
{{/* @todo notification into CLI that a network is configured but not supported */}} {{/* @todo notification into CLI that a network is configured but not supported */}}
{{- end -}} {{- end -}}
{{- $options := (dict "context" page "setup" $setup) }} {{- $options := (dict "context" page "setup" $setup) }}
{{- $href := partial "func/social/getShareLink.html" $options -}} {{- $href := partials.Include "func/social/getShareLink.html" $options -}}
<a href="{{ $href }}" <a href="{{ $href }}"
class="ananke-social-link {{ $setup.slug }} no-underline" class="ananke-social-link {{ $setup.slug }} no-underline"
title="{{ $label }}" aria-label="{{ $label }}" title="{{ $label }}" aria-label="{{ $label }}"
target="_blank" rel="nofollow noopener noreferrer"> target="_blank" rel="nofollow noopener noreferrer">
{{ with $config.share.icons -}} {{ with $config.share.icons -}}
{{/* @todo add the following lines to a partial, reused in social/follow.html */}} {{/* @todo add the following lines to a partial, reused collections.In social/follow.html */}}
{{- with $setup.icon -}} {{- with $setup.icon -}}
{{- $icon := resources.Get (printf "ananke/socials/%s.svg" .) -}} {{- $icon := resources.Get (fmt.Printf "ananke/socials/%s.svg" .) -}}
{{- with $icon -}} {{- with $icon -}}
<span class="icon"> <span class="icon">
{{ .Content | safeHTML }} {{ .Content | safe.HTML }}
{{/* @todo indicator for missing or misconfigured icon */}} {{/* @todo indicator for missing or misconfigured icon */}}
</span> </span>
{{- end -}} {{- end -}}
@ -53,4 +53,4 @@
{{- end -}} {{- end -}}
</div> </div>
{{- end -}} {{/* if eq "true" $disabled */}} {{- end -}} {{/* if compare.Eq "true" $disabled */}}

View File

@ -1,19 +1,19 @@
{{ partial "func/warn.html" `You are currently using 'partial "summary-with-image"' in your project templates. {{ partials.Include "func/warn.html" `You are currently using 'partial "summary-with-image"' in your project templates.
You should replace it with '.Render "summary-with-image"' as the use of this partial will be deprecated in future releases. You should replace it with '.Render "summary-with-image"' as the use of this partial will be deprecated in future releases.
More info here: https://github.com/theNewDynamic/gohugo-theme-ananke/releases/tag/v2.8.1` }} More info here: https://github.com/theNewDynamic/gohugo-theme-ananke/releases/tag/v2.8.1` }}
{{ $featured_image := partial "func/GetFeaturedImage.html" . }} {{ $featured_image := partials.Include "func/GetFeaturedImage.html" . }}
<article class="bb b--black-10"> <article class="bb b--black-10">
<div class="db pv4 ph3 ph0-l no-underline dark-gray"> <div class="no-underline db pv4 ph3 ph0-l dark-gray">
<div class="flex flex-column flex-row-ns"> <div class="flex flex-column flex-row-ns">
{{ if $featured_image }} {{ 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 where our site lives */}}
<div class="{{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl3-ns" "pr3-ns" }} mb4 mb0-ns w-100 w-40-ns"> <div class="{{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pl3-ns" "pr3-ns" }} mb4 mb0-ns w-100 w-40-ns">
<a href="{{.RelPermalink}}" class="db grow"> <a href="{{.RelPermalink}}" class="db grow">
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}"> <img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
</a> </a>
</div> </div>
{{ end }} {{ end }}
<div class="blah w-100{{ if $featured_image }} w-60-ns {{ cond (eq $.Site.Language.LanguageDirection "rtl") "pr3-ns" "pl3-ns" }}{{ end }}"> <div class="blah w-100{{ if $featured_image }} w-60-ns {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pr3-ns" "pl3-ns" }}{{ end }}">
<h1 class="f3 fw1 athelas mt0 lh-title"> <h1 class="f3 fw1 athelas mt0 lh-title">
<a href="{{.RelPermalink}}" class="color-inherit dim link"> <a href="{{.RelPermalink}}" class="color-inherit dim link">
{{ .Title }} {{ .Title }}
@ -22,10 +22,10 @@ More info here: https://github.com/theNewDynamic/gohugo-theme-ananke/releases/ta
<div class="f6 f5-l lh-copy nested-copy-line-height nested-links"> <div class="f6 f5-l lh-copy nested-copy-line-height nested-links">
{{ .Summary }} {{ .Summary }}
</div> </div>
{{ with .Params.author | default .Site.Params.author }} {{ with .Params.author | compare.Default .Site.Params.author }}
<p class="f6 lh-copy mv0">By {{ . }}</p> <p class="f6 lh-copy mv0">By {{ . }}</p>
{{- end -}} {{- end -}}
<a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a> <a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | compare.Default (lang.Translate "readMore") }}</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,9 +1,9 @@
{{ partial "func/warn.html" `You are currently using 'partial "summary"' in your project templates. {{ partials.Include "func/warn.html" `You are currently using 'partial "summary"' in your project templates.
You should replace it with '.Render "summary"' as the use of this partial will be deprecated in future releases. You should replace it with '.Render "summary"' as the use of this partial will be deprecated in future releases.
More info here: https://github.com/theNewDynamic/gohugo-theme-ananke/releases/tag/v2.8.1` }} More info here: https://github.com/theNewDynamic/gohugo-theme-ananke/releases/tag/v2.8.1` }}
<div class="relative w-100 mb4 bg-white nested-copy-line-height"> <div class="relative bg-white w-100 mb4 nested-copy-line-height">
<div class="bg-white mb3 pa4 gray overflow-hidden"> <div class="overflow-hidden bg-white mb3 pa4 gray">
<span class="f6 db">{{ humanize .Section }}</span> <span class="f6 db">{{ inflect.Humanize .Section }}</span>
<h1 class="f3 near-black"> <h1 class="f3 near-black">
<a href="{{ .RelPermalink }}" class="link black dim"> <a href="{{ .RelPermalink }}" class="link black dim">
{{ .Title }} {{ .Title }}

View File

@ -3,12 +3,12 @@
This template is the same as the default and is here to demonstrate that if you have a content directory called "post" you can create a layouts directory, just for that section. This template is the same as the default and is here to demonstrate that if you have a content directory called "post" you can create a layouts directory, just for that section.
*/}} */}}
<article class="pa3 pa4-ns nested-copy-line-height"> <article class="pa3 pa4-ns nested-copy-line-height">
<section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}"> <section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | compare.Default "mid-gray" }}">
{{ .Content }} {{ .Content }}
</section> </section>
<aside class="flex-ns flex-wrap justify-around mt5"> <aside class="flex-wrap justify-around flex-ns mt5">
{{ range .Paginator.Pages }} {{ range .Paginator.Pages }}
<div class="relative w-100 w-30-l mb4 bg-white"> <div class="relative bg-white w-100 w-30-l mb4">
{{ .Render "summary" }} {{ .Render "summary" }}
</div> </div>
{{ end }} {{ end }}

View File

@ -1,7 +1,7 @@
<div class="mb3 pa4 {{ $.Param "text_color" | default "mid-gray" }} overflow-hidden"> <div class="mb3 pa4 {{ $.Param "text_color" | compare.Default "mid-gray" }} overflow-hidden">
{{ if .Date }} {{ if .Date }}
<div class="f6"> <div class="f6">
{{ .Date | time.Format (default "January 2, 2006" .Site.Params.date_format) }} {{ .Date | time.Format (compare.Default "January 2, 2006" .Site.Params.date_format) }}
</div> </div>
{{ end }} {{ end }}
<h1 class="f3 near-black"> <h1 class="f3 near-black">
@ -12,5 +12,5 @@
<div class="nested-links f5 lh-copy nested-copy-line-height"> <div class="nested-links f5 lh-copy nested-copy-line-height">
{{ .Summary }} {{ .Summary }}
</div> </div>
<a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a> <a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | compare.Default (lang.Translate "readMore") }}</a>
</div> </div>

View File

@ -2,7 +2,7 @@ User-agent: *
{{/* robotstxt.org - if we are in production, allow access, else deny */ -}} {{/* robotstxt.org - if we are in production, allow access, else deny */ -}}
{{ if hugo.IsProduction -}} {{ if hugo.IsProduction -}}
Allow: / Allow: /
Sitemap: {{ "/sitemap.xml" | absURL }} Sitemap: {{ "/sitemap.xml" | urls.AbsURL }}
{{ else -}} {{ else -}}
Disallow: / Disallow: /
{{ end -}} {{ end -}}

View File

@ -3,18 +3,18 @@
<form class="black-80 sans-serif" accept-charset="UTF-8" action="{{ .Get "action" }}" method="POST" role="form"> <form class="black-80 sans-serif" accept-charset="UTF-8" action="{{ .Get "action" }}" method="POST" role="form">
<label class="{{ $.Scratch.Get "labelClasses" }}" for="name">{{ i18n "yourName" }}</label> <label class="{{ $.Scratch.Get "labelClasses" }}" for="name">{{ lang.Translate "yourName" }}</label>
<input type="text" id="name" name="name" class="{{ $.Scratch.Get "inputClasses" }}" required placeholder=" " aria-labelledby="name"/> <input type="text" id="name" name="name" class="{{ $.Scratch.Get "inputClasses" }}" required placeholder=" " aria-labelledby="name"/>
<label class="{{ $.Scratch.Get "labelClasses" }}" for="email">{{ i18n "emailAddress" }}</label> <label class="{{ $.Scratch.Get "labelClasses" }}" for="email">{{ lang.Translate "emailAddress" }}</label>
<input type="email" id="email" name="email" class="{{ $.Scratch.Get "inputClasses" }}" required placeholder=" " aria-labelledby="email"/> <input type="email" id="email" name="email" class="{{ $.Scratch.Get "inputClasses" }}" required placeholder=" " aria-labelledby="email"/>
<div class="requirements f6 gray glow i ph3 overflow-hidden"> <div class="requirements f6 gray glow i ph3 overflow-hidden">
{{ i18n "emailRequiredNote" }} {{ lang.Translate "emailRequiredNote" }}
</div> </div>
<label class="{{ $.Scratch.Get "labelClasses" }}" for="message">{{ i18n "message" }}</label> <label class="{{ $.Scratch.Get "labelClasses" }}" for="message">{{ lang.Translate "message" }}</label>
<textarea id="message" name="message" class="{{ $.Scratch.Get "inputClasses" }} h4" aria-labelledby="message"></textarea> <textarea id="message" name="message" class="{{ $.Scratch.Get "inputClasses" }} h4" aria-labelledby="message"></textarea>
<input class="db w-100 mv2 white pa3 bn hover-shadow hover-bg-black bg-animate bg-black" type="submit" value="{{ i18n "send" }}" /> <input class="db w-100 mv2 white pa3 bn hover-shadow hover-bg-black bg-animate bg-black" type="submit" value="{{ lang.Translate "send" }}" />
</form> </form>