summaryrefslogtreecommitdiff
path: root/layouts/newsletter/section.html
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-09-07 02:06:21 +0800
committerReorx <novoreorx@gmail.com>2022-09-07 02:06:21 +0800
commit13a2c8742c3a34ef8d137b78e5209b3d4acb02cc (patch)
tree10887f8f458b20939fdf402a3979b73772d2ca71 /layouts/newsletter/section.html
parentcd0381f6d3b86adb02702f1848283d9f19b017b5 (diff)
WIP: newsletter section page and archives page can work
Diffstat (limited to 'layouts/newsletter/section.html')
-rw-r--r--layouts/newsletter/section.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html
new file mode 100644
index 0000000..07aab27
--- /dev/null
+++ b/layouts/newsletter/section.html
@@ -0,0 +1,67 @@
+{{/* section is AKA list */}}
+{{- define "bodyClass" }} theme-newsletter{{- end }}
+
+{{- define "main" }}
+<div class="main-logo">@</div>
+
+<header class="page-header">
+ <h1>{{ .Title }} Newsletter</h1>
+ {{- with .Param "archivesSlug" }}
+ <div>
+ <a href="{{ $.RelPermalink }}{{ . }}/">Archives</a>
+ </div>
+ {{- end }}
+</header>
+
+{{- $pages := where .Pages "Params.hidden" "!=" true }}
+
+{{/* related issue: https://github.com/gohugoio/hugo/issues/9003 */}}
+{{ $paginator := "" }}
+{{ if (.Param "paginate") }}
+ {{- $paginator = .Paginate $pages (.Param "paginate") }}
+{{ else }}
+ {{- $paginator = .Paginate $pages }}
+{{ end }}
+
+
+{{- range $index, $page := $paginator.Pages }}
+<article class="post-entry">
+ <header class="entry-header">
+ <h2>
+ {{- .Title }}
+ {{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[Draft]</span></sup>{{- end }}
+ {{- if .Weight }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[Pinned]</span></sup>{{- end }}
+ </h2>
+ </header>
+ {{- if (ne (.Param "hideSummary") true) }}
+ <section class="entry-content">
+ {{ if .Description }}
+ <p>{{ .Description | plainify | htmlUnescape }}</p>
+ {{ else }}
+ <p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p>
+ {{ end }}
+ </section>
+ {{- end }}
+ {{- if not (.Param "hideMeta") }}
+ <footer class="entry-footer">
+ {{- partial "post_meta.html" . -}}
+ </footer>
+ {{- end }}
+ <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
+</article>
+{{- end }}
+
+{{- if gt $paginator.TotalPages 1 }}
+<footer class="page-footer">
+ <nav class="pagination">
+ {{- if $paginator.HasPrev }}
+ <a class="prev" href="{{ $paginator.Prev.URL | absURL }}">« {{ i18n "prev_page" }}</a>
+ {{- end }}
+ {{- if $paginator.HasNext }}
+ <a class="next" href="{{ $paginator.Next.URL | absURL }}">{{ i18n "next_page" }} »</a>
+ {{- end }}
+ </nav>
+</footer>
+{{- end }}
+
+{{ end }}