WIP: newsletter section page and archives page can work
This commit is contained in:
parent
cd0381f6d3
commit
13a2c8742c
|
@ -1,7 +1,7 @@
|
|||
{{- define "main" }}
|
||||
|
||||
<header class="page-header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<h1>{{ .Title }} !</h1>
|
||||
{{- if .Description }}
|
||||
<div class="post-description">
|
||||
{{ .Description }}
|
||||
|
@ -9,7 +9,12 @@
|
|||
{{- end }}
|
||||
</header>
|
||||
|
||||
{{- $pages := where site.AllPages "Type" "in" site.Params.mainSections }}
|
||||
{{- $sections := site.Params.mainSections }}
|
||||
{{/* with the follow condition, archives.html could be used for section archives other than the only one archives of the whole site */}}
|
||||
{{- if .Section }}
|
||||
{{- $sections = .Section}}
|
||||
{{- end }}
|
||||
{{- $pages := where site.AllPages "Type" "in" $sections }}
|
||||
|
||||
{{- range $pages.GroupByPublishDate "2006" }}
|
||||
{{- if ne .Key "0001" }}
|
||||
|
@ -22,7 +27,6 @@
|
|||
<h3 class="archive-month-header">{{- .Key }}<sup class="archive-count"> {{ len .Pages }}</sup></h3>
|
||||
<div class="archive-posts">
|
||||
{{- range .Pages }}
|
||||
{{- if eq .Kind "page" }}
|
||||
<div class="archive-entry">
|
||||
<h3 class="archive-entry-title">
|
||||
{{- .Title | markdownify }}
|
||||
|
@ -34,7 +38,6 @@
|
|||
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
{{- if eq site.Params.defaultTheme `dark` -}}
|
||||
{{- print " dark" }}
|
||||
{{- end -}}
|
||||
{{- block "bodyClass" . }}{{ end }}
|
||||
" id="top">
|
||||
{{- partialCached "header.html" . .Page -}}
|
||||
<main class="main {{- if (eq .Kind `page`) -}}{{- print " post" -}}{{- end -}}">
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
{{ .Description | markdownify }}
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- with .Param "archivesSlug" }}
|
||||
<div>
|
||||
<a href="{{ $.RelPermalink }}{{ . }}/">Archives</a>
|
||||
</div>
|
||||
{{- end }}
|
||||
</header>
|
||||
{{- end }}
|
||||
|
||||
|
|
|
@ -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"> [Draft]</span></sup>{{- end }}
|
||||
{{- if .Weight }}<sup><span class="entry-isdraft"> [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 }}
|
|
@ -47,10 +47,11 @@
|
|||
{{- /* order is important */}}
|
||||
{{- $core := (slice $theme_vars $reset $common $commonHighlight $media) | resources.Concat "assets/css/core.css" }}
|
||||
{{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" }}
|
||||
{{- $extendedScss := (resources.Match "css/extended/*.scss") | resources.Concat "assets/css/extended.scss" | resources.ToCSS }}
|
||||
|
||||
{{- /* bundle all required css */}}
|
||||
{{- /* Add extended css after theme style */ -}}
|
||||
{{- $stylesheet := (slice $core $extended) | resources.Concat "assets/css/stylesheet.css" | minify }}
|
||||
{{- $stylesheet := (slice $core $extended $extendedScss) | resources.Concat "assets/css/stylesheet.css" | minify }}
|
||||
|
||||
{{- if not site.Params.assets.disableFingerprinting }}
|
||||
{{- $stylesheet := $stylesheet | fingerprint }}
|
||||
|
|
Loading…
Reference in New Issue