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 +++++++---- layouts/_default/baseof.html | 1 + layouts/_default/list.html | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'layouts/_default') 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 }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 513450b..e74c03e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -13,6 +13,7 @@ {{- if eq site.Params.defaultTheme `dark` -}} {{- print " dark" }} {{- end -}} +{{- block "bodyClass" . }}{{ end }} " id="top"> {{- partialCached "header.html" . .Page -}}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e2c248c..f92963d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -13,6 +13,11 @@ {{ .Description | markdownify }} {{- end }} + {{- with .Param "archivesSlug" }} +
+ Archives +
+ {{- end }} {{- end }} -- cgit v1.2.3 From a016d836633b6e223d1ac3ee0ddb262eca0d626d Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 13:53:15 +0800 Subject: home page filter pages use "Section in" instead of "Type in" distinguish .Section and .Type --- layouts/_default/list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'layouts/_default') diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f92963d..5797a30 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -32,7 +32,7 @@ {{- $pages := .Pages }} {{- if .IsHome }} - {{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} + {{- $pages = where site.RegularPages "Section" "in" site.Params.mainSections }} {{- end }} {{- $pages = where $pages "Params.hidden" "!=" true }} -- cgit v1.2.3 From ca373fd00303c93ed62eafa55696ab03d23667b2 Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 15:19:46 +0800 Subject: add type- and kind- classes to body, styling newsletter single and section --- assets/css/extended/newsletter.scss | 99 +++++++++++++++++++++++++++++++++++++ layouts/_default/baseof.html | 3 +- layouts/_default/single.html | 22 +++++++-- layouts/newsletter/section.html | 5 +- 4 files changed, 121 insertions(+), 8 deletions(-) create mode 100644 assets/css/extended/newsletter.scss (limited to 'layouts/_default') diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss new file mode 100644 index 0000000..0dc5235 --- /dev/null +++ b/assets/css/extended/newsletter.scss @@ -0,0 +1,99 @@ +/* +color candidates: +#CB3A56 茜色 +#F05654 銀紅 +#F20C00 石榴紅 +#FF2D51 火紅 +*/ +body.type-newsletter { + --signature: #CB3A56; + --signature-bg: rgba(203, 58, 87, 0.239); + --signature-bg-dim: rgba(203, 58, 87, 0.147); + --main-border: 5px solid var(--signature); + --link-hover-color: var(--signature); + + + /* regular page layout */ +} + +body.type-newsletter.kind-section { + /* section page layout */ + + .main { + border: var(--main-border); + background-color: var(--theme); + margin-top: var(--content-gap); + min-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--content-gap)); + max-width: calc(var(--nav-width)); + } + + .main-logo { + position: absolute; + left: 0; top: 0; + width: 50px; + height: 50px; + line-height: 45px; + border-right: var(--main-border); + border-bottom: var(--main-border); + background-color: var(--signature); + color: var(--theme); + font-size: 32px; + text-align: center; + } +} + +body.type-newsletter.kind-page { + .newsletter-brand { + display: flex; + background-color: var(--signature-bg-dim); + transition: var(--link-transition); + font-size: 32px; + margin-bottom: calc(var(--content-gap) * 2); + line-height: 50px; + + .icon, .name { + height: 50px; + } + .icon { + width: 50px; + color: var(--theme); + text-align: center; + background-color: var(--signature); + } + .name { + padding: 0 20px; + font-weight: bolder; + color: var(--signature); + } + .issueno { + color: var(--signature); + font-weight: 300; + transition: var(--link-transition); + } + .arrow { + margin-left: auto; + color: transparent; + display: flex; + align-items: center; + padding-right: 15px; + transition: var(--link-transition); + } + + &:hover, &:active { + background-color: var(--signature-bg); + .arrow { + color: var(--signature); + } + .issueno { + color: transparent; + } + } + } + + .post-title { + font-size: 36px; + } + .post-footer { + border-bottom: 0; + } +} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index e74c03e..0d78fad 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -12,8 +12,7 @@ {{- end -}} {{- if eq site.Params.defaultTheme `dark` -}} {{- print " dark" }} -{{- end -}} -{{- block "bodyClass" . }}{{ end }} +{{- end }} type-{{ .Type }} kind-{{ .Kind -}} " id="top"> {{- partialCached "header.html" . .Page -}}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c71f66d..7109cdb 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,15 +1,31 @@ {{- define "main" }} +{{- $isNewsletter := eq .Type "newsletter" }}
{{ partial "breadcrumbs.html" . }} + + {{- if $isNewsletter -}} + + {{- end -}}

- {{ .Title }} - {{- if .Draft }}  [draft]{{- end }} + {{- if $isNewsletter -}} + {{- replace .Title (.Param "titlePrefix") (.Param "titlePrefixReplace") -}} + {{- else -}} + {{- .Title -}} + {{- end -}} + {{- if .Draft -}}  [draft]{{- end -}}

{{- if .Description }}
- {{ .Description }} + {{- .Description -}}
{{- end }} {{- if not (.Param "hideMeta") }} diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index 07aab27..344810a 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -1,11 +1,10 @@ {{/* section is AKA list */}} -{{- define "bodyClass" }} theme-newsletter{{- end }} {{- 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 . ) }}
{{- end }} - {{- with .Param "archivesSlug" }} -
- Archives + - {{- end }}
{{- end }} diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index a52e40f..11d52ab 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -35,13 +35,13 @@

相关链接

-
+
-- cgit v1.2.3 From edf0ed0258cbfffe9bb4d6231601302d2357d24d Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 01:41:33 +0800 Subject: add newsletter sub box in single --- assets/css/common/post-single.css | 1 + assets/css/extended/newsletter.scss | 18 ++++++++++++++++++ layouts/_default/baseof.html | 2 +- layouts/_default/single.html | 7 ++++++- 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'layouts/_default') diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index ab0b54f..bdfa945 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -592,6 +592,7 @@ h6:hover .anchor { vertical-align: super; } +/* footnotes */ .footnotes { font-size: .8em; color: var(--primary-dim); diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss index 55cdbb6..49a7aad 100644 --- a/assets/css/extended/newsletter.scss +++ b/assets/css/extended/newsletter.scss @@ -285,4 +285,22 @@ body.type-newsletter.kind-page { .post-footer { border-bottom-color: var(--signature); } + + + .newsletter-sub { + margin-top: var(--gap); + background-color: var(--signature-bg-dim); + padding: 1em; + .notice { + font-size: .8em; + color: var(--signature); + line-height: 1.6; + } + .sub-form { + margin: 1em 0; + input { + border-color: var(--signature-bg); + } + } + } } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index bf74e92..1413f56 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -12,7 +12,7 @@ {{- end -}} {{- if eq site.Params.defaultTheme `dark` -}} {{- print " dark" }} -{{- end }} type-{{ .Type }} kind-{{ .Kind -}} +{{- end }} type-{{ .Type }} kind-{{ .Kind }} layout-{{ .Layout -}} " id="top"> {{- partialCached "header.html" . .Page -}}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6fff034..64fc164 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -54,7 +54,12 @@ {{- end }} {{- if $isNewsletter }} - {{- partial "newsletter_sub_form.html"}} + {{- end }} -- cgit v1.2.3 From e14673bee7e16f4c00a5ad50d62f1aa023ff11ac Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 21:08:03 +0800 Subject: subtle adjustments --- assets/css/common/post-single.css | 5 ++++- assets/css/extended/newsletter.scss | 6 +----- layouts/_default/single.html | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'layouts/_default') diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index bdfa945..2f6e2c1 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -1,6 +1,9 @@ .page-header, .post-header { - margin: 32px 0; + margin: calc(var(--gap) * 4/3) 0; +} +.post-header { + margin-top: calc(var(--gap) * 1/3); } .post-title { diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss index 136ba92..7ac207b 100644 --- a/assets/css/extended/newsletter.scss +++ b/assets/css/extended/newsletter.scss @@ -127,10 +127,6 @@ body.type-newsletter.layout-archives { .first-entry { margin-bottom: 0; - - @media screen and (max-width: $small) { - margin-top: calc(var(--icon-length)); - } } h1 { @@ -284,7 +280,7 @@ body.type-newsletter.kind-page { } .newsletter-sub { - margin-top: var(--gap); + margin-top: calc(var(--content-gap) * 1.5); background-color: var(--signature-bg-dim); padding: 1em; .notice { diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 64fc164..fa4c86d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -56,7 +56,7 @@ {{- if $isNewsletter }} -- cgit v1.2.3