From 13a2c8742c3a34ef8d137b78e5209b3d4acb02cc Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 02:06:21 +0800 Subject: WIP: newsletter section page and archives page can work --- layouts/_default/archives.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'layouts/_default/archives.html') diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index 966da8a..c2e7aed 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -1,7 +1,7 @@ {{- define "main" }} -{{- $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 @@

{{- .Key }}  {{ len .Pages }}

{{- range .Pages }} - {{- if eq .Kind "page" }}

{{- .Title | markdownify }} @@ -34,7 +38,6 @@

{{- end }} - {{- end }}
{{- end }} -- cgit v1.2.3 From ceede2988aa86ad19a2ff84bb3eb76b91b8dd4da Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 16:20:55 +0800 Subject: move .first-entry css to main.css, styling newsletter section --- assets/css/common/main.css | 47 +++++++++++++++- assets/css/common/post-entry.css | 43 --------------- assets/css/extended/newsletter.scss | 8 ++- layouts/_default/archives.html | 2 +- layouts/newsletter/section.html | 106 +++++++++++++++++++----------------- 5 files changed, 109 insertions(+), 97 deletions(-) (limited to 'layouts/_default/archives.html') diff --git a/assets/css/common/main.css b/assets/css/common/main.css index 004de15..d1dd1c3 100644 --- a/assets/css/common/main.css +++ b/assets/css/common/main.css @@ -14,7 +14,7 @@ } mark { margin: 0 -0.4em; - padding: 0.1em 0.4em; + padding: 0em 0.4em; border-radius: 0.8em 0.3em; background: transparent; background-image: linear-gradient( @@ -27,6 +27,51 @@ mark { box-decoration-break: clone; } +/* for home and section page */ +.first-entry { + position: relative; + min-height: 320px; + margin: var(--gap) 0 calc(var(--gap) * 2) 0; +} + +.first-entry .entry-header { + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + margin: var(--gap) 0 calc(var(--gap) * 2); +} + +.first-entry .entry-header h1 { + font-size: 34px; + line-height: 1.3; +} +@media screen and (max-width: 400px) { + .first-entry .entry-header h1 { + font-size: 30px; + } +} + +.first-entry .entry-content { + margin: 14px 0; + font-size: 17px; + color: var(--primary); + line-height: 1.6em; + display: block; + overflow: initial; /* fix edge get cut */ +} + +.first-entry .entry-content p { + margin-bottom: .8em; +} +.first-entry .entry-content li p { + margin-bottom: .5em; +} + +.first-entry .entry-footer { + font-size: 14px; +} + + /* for post page */ .main.post { max-width: calc(var(--post-width) + var(--gap) * 2); diff --git a/assets/css/common/post-entry.css b/assets/css/common/post-entry.css index 81ba641..e433cc1 100644 --- a/assets/css/common/post-entry.css +++ b/assets/css/common/post-entry.css @@ -1,46 +1,3 @@ -.first-entry { - position: relative; - min-height: 320px; - margin: var(--gap) 0 calc(var(--gap) * 2) 0; -} - -.first-entry .entry-header { - overflow: hidden; - display: -webkit-box; - -webkit-box-orient: vertical; - margin: var(--gap) 0 calc(var(--gap) * 2); -} - -.first-entry .entry-header h1 { - font-size: 34px; - line-height: 1.3; -} -@media screen and (max-width: 400px) { - .first-entry .entry-header h1 { - font-size: 30px; - } -} - -.first-entry .entry-content { - margin: 14px 0; - font-size: 17px; - color: var(--primary); - line-height: 1.6em; - display: block; - overflow: initial; /* fix edge get cut */ -} - -.first-entry .entry-content p { - margin-bottom: .8em; -} -.first-entry .entry-content li p { - margin-bottom: .5em; -} - -.first-entry .entry-footer { - font-size: 14px; -} - .home-info .entry-content { -webkit-line-clamp: unset; } diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss index 9418592..899ed78 100644 --- a/assets/css/extended/newsletter.scss +++ b/assets/css/extended/newsletter.scss @@ -42,8 +42,12 @@ body.type-newsletter.kind-section { text-align: center; } - .page-header { - h1 { + .main { + .content { + max-width: calc(var(--post-width)); + margin: 0 auto; + } + .entry-header h1 { text-align: center; } } diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index c2e7aed..285b592 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -1,7 +1,7 @@ {{- define "main" }} +{{/* 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 }} -{{/* 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}} + {{- $sections = slice .Section }} {{- end }} -{{- $pages := where site.AllPages "Type" "in" $sections }} +{{- $pages := where (where site.RegularPages "Section" "in" $sections) "Params.hidden" "!=" true }} {{- range $pages.GroupByPublishDate "2006" }} {{- if ne .Key "0001" }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 5797a30..67e1897 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -32,6 +32,7 @@ {{- $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 }} diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index 95bbf7d..a52e40f 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -13,12 +13,10 @@ {{- partial "newsletter_sub_form.html"}} - {{- $pages := where .Pages "Params.hidden" "!=" true }} -

最近更新

- {{- range first 5 $pages }} + {{- range first 5 (where .Pages "Params.hidden" "!=" true) }}
{{- if not .Date.IsZero -}} diff --git a/layouts/partials/post_nav_links.html b/layouts/partials/post_nav_links.html index 2d1eaa9..c52fbfa 100644 --- a/layouts/partials/post_nav_links.html +++ b/layouts/partials/post_nav_links.html @@ -1,4 +1,11 @@ -{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} +{{/* get pages from the current page's section */}} +{{- $sections := site.Params.mainSections }} +{{- if .Section }} + {{- $sections = slice .Section }} +{{- end }} +{{ $sections }} +{{- $pages := where (where site.RegularPages "Section" "in" $sections) "Params.hidden" "!=" true }} + {{- if and (gt (len $pages) 1) (in $pages . ) }}