Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/budparr/gohugo-theme-ananke.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegis Philibert <login@regisphilibert.com>2022-01-19 19:24:13 +0300
committerGitHub <noreply@github.com>2022-01-19 19:24:13 +0300
commit8cd36f504e1824895a0ab60db52179319a668172 (patch)
treed091cfd0855493af31bcc710fd410fc8a4e54618
parentd644dfbe42c0ca0089828d579cda968ae055cdb4 (diff)
Use .Render for summary and summary-with-image throughout (#498)
-rwxr-xr-xlayouts/_default/list.html2
-rw-r--r--layouts/_default/summary-with-image.html29
-rw-r--r--layouts/_default/summary.html13
-rw-r--r--layouts/_default/terms.html2
-rwxr-xr-xlayouts/index.html2
-rw-r--r--layouts/partials/func/warn.html15
-rw-r--r--layouts/partials/summary-with-image.html3
-rw-r--r--layouts/partials/summary.html3
-rw-r--r--layouts/post/list.html3
-rw-r--r--layouts/post/summary-with-image.html20
10 files changed, 66 insertions, 26 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index b4bc8de..713192f 100755
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -6,7 +6,7 @@
<section class="flex-ns flex-wrap justify-around mt5">
{{ range .Paginator.Pages }}
<div class="relative w-100 w-30-l mb4 bg-white">
- {{- partial "summary.html" . -}}
+ {{ .Render "summary" }}
</div>
{{ end }}
</section>
diff --git a/layouts/_default/summary-with-image.html b/layouts/_default/summary-with-image.html
new file mode 100644
index 0000000..94666db
--- /dev/null
+++ b/layouts/_default/summary-with-image.html
@@ -0,0 +1,29 @@
+{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
+<article class="bb b--black-10">
+ <div class="db pv4 ph3 ph0-l no-underline dark-gray">
+ <div class="flex flex-column flex-row-ns">
+ {{ if $featured_image }}
+ {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
+ {{ $featured_image := (trim $featured_image "/") | absURL }}
+ <div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
+ <a href="{{.RelPermalink}}" class="db grow">
+ <img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
+ </a>
+ </div>
+ {{ end }}
+ <div class="blah w-100{{ if $featured_image }} w-60-ns pl3-ns{{ end }}">
+ <h1 class="f3 fw1 athelas mt0 lh-title">
+ <a href="{{.RelPermalink}}" class="color-inherit dim link">
+ {{ .Title }}
+ </a>
+ </h1>
+ <div class="f6 f5-l lh-copy nested-copy-line-height nested-links">
+ {{ .Summary }}
+ </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>
+ {{/* TODO: add author
+ <p class="f6 lh-copy mv0">By {{ .Author }}</p> */}}
+ </div>
+ </div>
+ </div>
+</article>
diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html
new file mode 100644
index 0000000..fb77404
--- /dev/null
+++ b/layouts/_default/summary.html
@@ -0,0 +1,13 @@
+<div class="relative w-100 mb4 bg-white nested-copy-line-height">
+ <div class="bg-white mb3 pa4 gray overflow-hidden">
+ <span class="f6 db">{{ humanize .Section }}</span>
+ <h1 class="f3 near-black">
+ <a href="{{ .RelPermalink }}" class="link black dim">
+ {{ .Title }}
+ </a>
+ </h1>
+ <div class="nested-links f5 lh-copy nested-copy-line-height">
+ {{ .Summary }}
+ </div>
+ </div>
+</div>
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
index e448fca..31560f1 100644
--- a/layouts/_default/terms.html
+++ b/layouts/_default/terms.html
@@ -14,7 +14,7 @@
</a>
</h2>
{{ range $value.Pages }}
- {{ partial "summary.html" . }}
+ {{ .Render "summary" }}
{{ end }}
{{ end }}
</section>
diff --git a/layouts/index.html b/layouts/index.html
index 2fbe6cd..2e51d10 100755
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -26,7 +26,7 @@
{{/* Range through the first $n_posts items of the section */}}
{{ range (first $n_posts $section) }}
<div class="relative w-100 mb4">
- {{ partial "summary-with-image.html" . }}
+ {{ .Render "summary-with-image" }}
</div>
{{ end }}
</section>
diff --git a/layouts/partials/func/warn.html b/layouts/partials/func/warn.html
new file mode 100644
index 0000000..b269906
--- /dev/null
+++ b/layouts/partials/func/warn.html
@@ -0,0 +1,15 @@
+{{/*
+ warn
+ Emits a warning using the theme's Header.
+
+ @author @regisphilibert
+
+ @context String
+
+ @access private
+
+ @example - Go Template
+ {{ partial "func/warn" $message }}
+*/}}
+{{ $header := "Ananke Theme Warning" }}
+{{ warnf "\n%s:\n%s" $header . }} \ No newline at end of file
diff --git a/layouts/partials/summary-with-image.html b/layouts/partials/summary-with-image.html
index 94666db..b73f698 100644
--- a/layouts/partials/summary-with-image.html
+++ b/layouts/partials/summary-with-image.html
@@ -1,3 +1,6 @@
+{{ partial "func/warn" `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.
+More info here: https://github.com/theNewDynamic/gohugo-theme-ananke/releases/tag/v2.8.1` }}
{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
<article class="bb b--black-10">
<div class="db pv4 ph3 ph0-l no-underline dark-gray">
diff --git a/layouts/partials/summary.html b/layouts/partials/summary.html
index d9cd9c6..0c1a0d6 100644
--- a/layouts/partials/summary.html
+++ b/layouts/partials/summary.html
@@ -1,3 +1,6 @@
+{{ partial "func/warn" `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.
+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="bg-white mb3 pa4 gray overflow-hidden">
<span class="f6 db">{{ humanize .Section }}</span>
diff --git a/layouts/post/list.html b/layouts/post/list.html
index 5d05240..f6cf4bd 100644
--- a/layouts/post/list.html
+++ b/layouts/post/list.html
@@ -9,9 +9,6 @@
<aside class="flex-ns flex-wrap justify-around mt5">
{{ range .Paginator.Pages }}
<div class="relative w-100 w-30-l mb4 bg-white">
- {{/*
- Note we can use `.Render` here for items just in this section, instead of a partial to pull in items for the list page. https://gohugo.io/functions/render/
- */}}
{{ .Render "summary" }}
</div>
{{ end }}
diff --git a/layouts/post/summary-with-image.html b/layouts/post/summary-with-image.html
deleted file mode 100644
index fd02963..0000000
--- a/layouts/post/summary-with-image.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<article class="bb b--black-10">
- <a class="db pv4 ph3 ph0-l no-underline dark-gray dim" href="{{ .RelPermalink }}">
- <div class="flex flex-column flex-row-ns">
- {{ $featured_image := partial "func/GetFeaturedImage.html" . }}
- {{ if $featured_image }}
- <div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
- <img src="{{ $featured_image }}" class="db" alt="image from {{ .Title }}">
- </div>
- {{ end }}
- <div class="w-100{{ if $featured_image }} w-60-ns pl3-ns{{ end }}">
- <h1 class="f3 fw1 athelas mt0 lh-title">{{ .Title }}</h1>
- <div class="f6 f5-l lh-copy nested-copy-line-height">
- {{ .Summary }}
- </div>
- {{/* TODO: add author
- <p class="f6 lh-copy mv0">By {{ .Author }}</p> */}}
- </div>
- </div>
- </a>
-</article>