summaryrefslogtreecommitdiff
path: root/layouts/_default
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-09-08 21:56:46 +0800
committerReorx <novoreorx@gmail.com>2022-09-08 21:56:46 +0800
commitae58c91ac49e822fd2cf8c5aa1b36cea0f8470ee (patch)
tree48a9819bced94c6c29b0c171e80bc61bcd6b9ae5 /layouts/_default
parentcd0381f6d3b86adb02702f1848283d9f19b017b5 (diff)
parentbb02a60990dd79f9828798a044776984d51ff5da (diff)
Merge branch 'newsletter'
* newsletter: (28 commits) newsletter section: only show list when there are pages lower nav height in mobile use content-gap instead of gap for header consistant header gaps subtle adjustments clear debug code finish newsletter archives add newsletter sub box in single enhance inline links fix rss pages query newsletter regular page responsive enlarge post footer bottom border size from 1 to 3px fix all pages query issues in: list, archives, newsletter section, post_nav_links fixup! finish newsletter section styling newsletter section page responsive finish newsletter section styling adjust first-entry ul/ol margin styling newsletter section list rename .list to .list-page styling newsletter sub form ...
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/archives.html10
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/_default/list.html11
-rw-r--r--layouts/_default/rss.xml16
-rw-r--r--layouts/_default/single.html24
5 files changed, 48 insertions, 17 deletions
diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html
index 966da8a..dd53699 100644
--- a/layouts/_default/archives.html
+++ b/layouts/_default/archives.html
@@ -9,7 +9,13 @@
{{- end }}
</header>
-{{- $pages := where site.AllPages "Type" "in" site.Params.mainSections }}
+{{/* get pages from the current page's section */}}
+{{/* in this way, archives.html could be used for section archives other than the only one archives of the whole site */}}
+{{- $sections := site.Params.mainSections }}
+{{- if .Section }}
+ {{- $sections = slice .Section }}
+{{- end }}
+{{- $pages := where (where site.RegularPages "Section" "in" $sections) "Params.hidden" "!=" true }}
{{- range $pages.GroupByPublishDate "2006" }}
{{- if ne .Key "0001" }}
@@ -22,7 +28,6 @@
<h3 class="archive-month-header">{{- .Key }}<sup class="archive-count">&nbsp;&nbsp;{{ 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 +39,6 @@
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
</div>
{{- end }}
- {{- end }}
</div>
</div>
{{- end }}
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 513450b..1413f56 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -8,11 +8,11 @@
<body class="
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
-{{- print "list" -}}
+{{- print "list-page" -}}
{{- end -}}
{{- if eq site.Params.defaultTheme `dark` -}}
{{- print " dark" }}
-{{- end -}}
+{{- end }} type-{{ .Type }} kind-{{ .Kind }} layout-{{ .Layout -}}
" id="top">
{{- partialCached "header.html" . .Page -}}
<main class="main {{- if (eq .Kind `page`) -}}{{- print " post" -}}{{- end -}}">
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index e2c248c..654297b 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -13,6 +13,14 @@
{{ .Description | markdownify }}
</div>
{{- end }}
+ <div class="inline-links">
+ {{- with .Param "archivesSlug" }}
+ <a href="{{ $.RelPermalink }}{{ . }}/">Archives</a>
+ {{- end }}
+ {{ with .OutputFormats.Get "rss" -}}
+ • <a href="{{ .Permalink }}" target="_blank">RSS</a>
+ {{ end -}}
+ </div>
</header>
{{- end }}
@@ -27,7 +35,8 @@
{{- $pages := .Pages }}
{{- if .IsHome }}
- {{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
+ {{/* get all regular pages instead of pages in a section */}}
+ {{- $pages = where site.RegularPages "Section" "in" site.Params.mainSections }}
{{- end }}
{{- $pages = where $pages "Params.hidden" "!=" true }}
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index 5a6386f..f151df5 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -1,15 +1,15 @@
-{{- $pctx := . -}}
-{{- if .IsHome -}}{{ $pctx = site }}{{- end -}}
-{{- $pages := slice -}}
-{{- if or $.IsHome $.IsSection -}}
-{{- $pages = where $pctx.RegularPages "Type" "in" site.Params.mainSections }}
-{{- else -}}
-{{- $pages = $pctx.Pages -}}
-{{- end -}}
+{{- $pages := .Pages -}}
+{{- if $.IsHome -}}
+ {{/* get all regular pages instead of pages in a section */}}
+ {{- $pages = where site.RegularPages "Section" "in" site.Params.mainSections -}}
+{{- end }}
+{{- $pages = where $pages "Params.hidden" "!=" true -}}
+
{{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
+
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index c71f66d..fa4c86d 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,15 +1,24 @@
{{- define "main" }}
+{{- $isNewsletter := eq .Type "newsletter" }}
<article class="post-single">
<header class="post-header">
{{ partial "breadcrumbs.html" . }}
+
+ {{- if $isNewsletter -}}
+ {{- partial "newsletter_brand.html" . }}
+ {{- end -}}
<h1 class="post-title">
- {{ .Title }}
- {{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }}
+ {{- if $isNewsletter -}}
+ {{- replace .Title (.Param "titlePrefix") (.Param "titlePrefixReplace") -}}
+ {{- else -}}
+ {{- .Title -}}
+ {{- end -}}
+ {{- if .Draft -}}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end -}}
</h1>
{{- if .Description }}
<div class="post-description">
- {{ .Description }}
+ {{- .Description -}}
</div>
{{- end }}
{{- if not (.Param "hideMeta") }}
@@ -43,6 +52,15 @@
{{- if (.Param "ShowPostNavLinks") }}
{{- partial "post_nav_links.html" . }}
{{- end }}
+
+ {{- if $isNewsletter }}
+ <div class="newsletter-sub">
+ <div class="notice">
+ 感谢你能读到这里,如果觉得有趣的话,欢迎在下方输入邮箱进行订阅。
+ </div>
+ {{- partial "newsletter_sub_form.html"}}
+ </div>
+ {{- end }}
</footer>
{{- if not (.Param "noComments") }}