From 13a2c8742c3a34ef8d137b78e5209b3d4acb02cc Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 02:06:21 +0800 Subject: [PATCH 01/28] WIP: newsletter section page and archives page can work --- layouts/_default/archives.html | 11 ++++-- layouts/_default/baseof.html | 1 + layouts/_default/list.html | 5 +++ layouts/newsletter/section.html | 67 +++++++++++++++++++++++++++++++++ layouts/partials/head.html | 3 +- 5 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 layouts/newsletter/section.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 }} 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 }} 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" }} + + + + +{{- $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 }} +
+
+

+ {{- .Title }} + {{- if .Draft }}  [Draft]{{- end }} + {{- if .Weight }}  [Pinned]{{- end }} +

+
+ {{- if (ne (.Param "hideSummary") true) }} +
+ {{ if .Description }} +

{{ .Description | plainify | htmlUnescape }}

+ {{ else }} +

{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}

+ {{ end }} +
+ {{- end }} + {{- if not (.Param "hideMeta") }} +
+ {{- partial "post_meta.html" . -}} +
+ {{- end }} + +
+{{- end }} + +{{- if gt $paginator.TotalPages 1 }} + +{{- end }} + +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 1889a85..3ced6b6 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -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 }} From 44533c76bbe3dbd176b350a26f3ac748023d4c9f Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 12:22:54 +0800 Subject: [PATCH 02/28] menu link is active for being the prefix of current url --- layouts/partials/header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 1061d5b..01f2b41 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -133,7 +133,7 @@ function toggleThemeListener() { {{- .Pre }} From 62288bcb5661de24f23f2a0e26511ac0fe749467 Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 13:47:52 +0800 Subject: [PATCH 03/28] enhance post-footer spacing --- assets/css/common/post-single.css | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index 1efd99a..91d7ee8 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -401,6 +401,8 @@ h6:hover .anchor { .post-footer { margin-top: calc(var(--content-gap) * 1.5); + padding-bottom: calc(var(--content-gap) * 2); + border-bottom: 1px solid var(--tertiary); } .share-buttons { @@ -453,7 +455,7 @@ h6:hover .anchor { } .paginav { - margin: var(--content-gap) 0; + margin-top: var(--content-gap); display: flex; line-height: 30px; border-radius: var(--radius); @@ -574,10 +576,7 @@ h6:hover .anchor { } .comments { - border-top: 1px solid var(--tertiary); -} -.comments { - margin: 40px 0 20px; + margin: var(--content-gap) 0; } .comments .title { margin: 20px 0; From a016d836633b6e223d1ac3ee0ddb262eca0d626d Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 13:53:15 +0800 Subject: [PATCH 04/28] 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(-) 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 }} From ca373fd00303c93ed62eafa55696ab03d23667b2 Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 15:19:46 +0800 Subject: [PATCH 05/28] 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 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 @@

相关链接

-
+
From edf0ed0258cbfffe9bb4d6231601302d2357d24d Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 01:41:33 +0800 Subject: [PATCH 21/28] 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(-) 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 }} From 2faf1cc852b794d8d79d1bb7e3ff0e30a4ca4705 Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 02:35:11 +0800 Subject: [PATCH 22/28] finish newsletter archives --- assets/css/extended/newsletter.scss | 34 +++++++++++++---------------- layouts/newsletter/archives.html | 33 ++++++++++++++++++++++++++++ layouts/newsletter/section.html | 7 +++--- 3 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 layouts/newsletter/archives.html diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss index 49a7aad..136ba92 100644 --- a/assets/css/extended/newsletter.scss +++ b/assets/css/extended/newsletter.scss @@ -27,8 +27,9 @@ body.type-newsletter { --icon-font-size: 24px; } - /* a links in section page content and regular page post-content */ + /* a links in section/archives page content and regular page post-content */ &.kind-section .main .content a, + &.layout-archives .main .content a, &.kind-page .post-content a { font-weight: 500; color: var(--primary); @@ -86,8 +87,9 @@ body.type-newsletter { } } -body.type-newsletter.kind-section { - /* section page layout */ +body.type-newsletter.kind-section, +body.type-newsletter.layout-archives { + /* section/archives page */ .main { border: var(--main-border); @@ -129,21 +131,16 @@ body.type-newsletter.kind-section { @media screen and (max-width: $small) { margin-top: calc(var(--icon-length)); } + } - .entry-header { - text-align: center; - margin-bottom: calc(var(--content-gap) * 1.5); - h1 { - // back to default - font-size: 36px; - } - .subtitle { - color: var(--secondary); - } - } - // .entry-content { - // font-size: 16px; - // } + h1 { + text-align: center; + margin-top: var(--gap); + margin-bottom: calc(var(--content-gap) * 1); + } + .subtitle { + text-align: center; + color: var(--secondary); } h2 { @@ -214,7 +211,7 @@ body.type-newsletter.kind-section { } } -/* regular page layout */ +/* regular page */ body.type-newsletter.kind-page { .newsletter-brand { --icon-length: 50px; @@ -286,7 +283,6 @@ body.type-newsletter.kind-page { border-bottom-color: var(--signature); } - .newsletter-sub { margin-top: var(--gap); background-color: var(--signature-bg-dim); diff --git a/layouts/newsletter/archives.html b/layouts/newsletter/archives.html new file mode 100644 index 0000000..ae19b5a --- /dev/null +++ b/layouts/newsletter/archives.html @@ -0,0 +1,33 @@ +{{- define "main" }} +
+ +
+

{{ .Title }}

+ {{- partial "newsletter_sub_form.html"}} + + {{/* get pages from the current page's section */}} + {{- $sections := slice .Section }} + {{- $pages := where (where site.RegularPages "Section" "in" $sections) "Params.hidden" "!=" true }} + + {{/* TODO statistics */}} +
+ {{- range $pages }} +
+
+ {{- if not .Date.IsZero -}} + {{ .Date | time.Format (default "January 2, 2006" site.Params.DateFormat) }} + {{- end }} +
+ +
{{ with .Param "issueno" }}#{{ . }}{{ end }}
+
+ {{- end }} +
+ +
+{{ end }} diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index 11d52ab..28ac710 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -4,11 +4,10 @@
+

{{ .Title }}

+ {{ with .Param "subtitle" }}
{{ . }}
{{ end }} +
-
-

{{ .Title }}

- {{ with .Param "subtitle" }}
{{ . }}
{{ end }} -
{{ .Description | markdownify }}
{{- partial "newsletter_sub_form.html"}}
From deb675dacea8df81c0c3d027322e8d486d6b52e6 Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 02:37:44 +0800 Subject: [PATCH 23/28] clear debug code --- layouts/partials/post_nav_links.html | 1 - 1 file changed, 1 deletion(-) diff --git a/layouts/partials/post_nav_links.html b/layouts/partials/post_nav_links.html index c52fbfa..05e68a3 100644 --- a/layouts/partials/post_nav_links.html +++ b/layouts/partials/post_nav_links.html @@ -3,7 +3,6 @@ {{- 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 . ) }} From e14673bee7e16f4c00a5ad50d62f1aa023ff11ac Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 21:08:03 +0800 Subject: [PATCH 24/28] 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(-) 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 }} From ce83fcc8ed84127f21b328b759882409093dcf67 Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 21:29:29 +0800 Subject: [PATCH 25/28] consistant header gaps --- assets/css/common/main.css | 14 ++++++++++++-- assets/css/common/post-single.css | 8 ++------ assets/css/extended/newsletter.scss | 12 +++++++----- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/assets/css/common/main.css b/assets/css/common/main.css index 785546c..8d798f5 100644 --- a/assets/css/common/main.css +++ b/assets/css/common/main.css @@ -4,8 +4,18 @@ min-height: calc(100vh - var(--header-height) - var(--footer-height)); max-width: calc(var(--main-width) + var(--gap) * 2); margin: auto; - padding: var(--gap); - padding-bottom: 0; + padding: var(--content-gap) var(--gap) 0; +} + +@media screen and (max-width: 500px) { + .main { + padding-top: 0; + } +} + +/* same as .post-header */ +.page-header { + margin: var(--gap) 0 calc(var(--content-gap) * 1.5); } .mark-line { diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index 2f6e2c1..03104b6 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -1,14 +1,10 @@ -.page-header, .post-header { - margin: calc(var(--gap) * 4/3) 0; -} -.post-header { - margin-top: calc(var(--gap) * 1/3); + margin: var(--gap) 0 calc(var(--content-gap) * 1.5); } .post-title { font-size: 40px; - margin: var(--content-gap) 0; + margin-bottom: var(--content-gap); } .post-description { diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss index 7ac207b..97bfa9c 100644 --- a/assets/css/extended/newsletter.scss +++ b/assets/css/extended/newsletter.scss @@ -94,7 +94,8 @@ body.type-newsletter.layout-archives { .main { border: var(--main-border); background-color: var(--theme); - margin-top: var(--content-gap); + margin-top: var(--gap); + padding-top: 0; padding-bottom: var(--icon-length); min-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--content-gap)); max-width: var(--nav-width); @@ -122,7 +123,7 @@ body.type-newsletter.layout-archives { .main { .content { max-width: calc(var(--post-width)); - margin: 0 auto; + margin: var(--icon-length) auto 0; } .first-entry { @@ -131,12 +132,13 @@ body.type-newsletter.layout-archives { h1 { text-align: center; - margin-top: var(--gap); - margin-bottom: calc(var(--content-gap) * 1); + margin-bottom: 10px; } .subtitle { text-align: center; color: var(--secondary); + line-height: 1.2em; + margin-bottom: var(--content-gap); } h2 { @@ -216,7 +218,7 @@ body.type-newsletter.kind-page { background-color: var(--signature-bg-dim); transition: var(--link-transition); font-size: 32px; - // margin-bottom: calc(var(--content-gap) * 2); + margin-bottom: var(--content-gap); line-height: var(--icon-length); box-shadow: none; // reset From e4f4f1d6608cee4997f5ee67a486424ade29c6b6 Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 21:46:44 +0800 Subject: [PATCH 26/28] use content-gap instead of gap for header --- assets/css/common/main.css | 2 +- assets/css/common/post-single.css | 2 +- assets/css/extended/newsletter.scss | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/css/common/main.css b/assets/css/common/main.css index 8d798f5..893081f 100644 --- a/assets/css/common/main.css +++ b/assets/css/common/main.css @@ -15,7 +15,7 @@ /* same as .post-header */ .page-header { - margin: var(--gap) 0 calc(var(--content-gap) * 1.5); + margin: var(--content-gap) 0 calc(var(--content-gap) * 1.5); } .mark-line { diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index 03104b6..7095192 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -1,5 +1,5 @@ .post-header { - margin: var(--gap) 0 calc(var(--content-gap) * 1.5); + margin: var(--content-gap) 0 calc(var(--content-gap) * 1.5); } .post-title { diff --git a/assets/css/extended/newsletter.scss b/assets/css/extended/newsletter.scss index 97bfa9c..a1a8fef 100644 --- a/assets/css/extended/newsletter.scss +++ b/assets/css/extended/newsletter.scss @@ -94,7 +94,7 @@ body.type-newsletter.layout-archives { .main { border: var(--main-border); background-color: var(--theme); - margin-top: var(--gap); + margin-top: var(--content-gap); padding-top: 0; padding-bottom: var(--icon-length); min-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--content-gap)); From 3f294daccf50f2242a085fd9af97d115a9d96d32 Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 21:50:49 +0800 Subject: [PATCH 27/28] lower nav height in mobile --- assets/css/core/theme-vars.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/css/core/theme-vars.css b/assets/css/core/theme-vars.css index e3dd503..d67a361 100644 --- a/assets/css/core/theme-vars.css +++ b/assets/css/core/theme-vars.css @@ -27,6 +27,12 @@ --link-transition: all 0.3s ease; --line-yellow: url("data:image/svg+xml;charset=utf-8,%3Csvg preserveAspectRatio='none' width='120' height='6' viewBox='0 0 120 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M119 0.8C60 4 50-0.5 1 1.5' stroke='%23fc0' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); } +@media screen and (max-width: 500px) { + :root { + --header-height: 52px; + } + +} .dark { --theme: rgb(29, 30, 32); From bb02a60990dd79f9828798a044776984d51ff5da Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 21:55:35 +0800 Subject: [PATCH 28/28] newsletter section: only show list when there are pages --- layouts/newsletter/section.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index 28ac710..04c3eed 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -12,10 +12,12 @@ {{- partial "newsletter_sub_form.html"}}
-

最近更新

+ {{ $pages := where .Pages "Params.hidden" "!=" true }} + {{ if $pages }} +

最新通讯

- {{- range first 5 (where .Pages "Params.hidden" "!=" true) }} + {{- range first 5 $pages }}
{{- if not .Date.IsZero -}} @@ -32,6 +34,7 @@
{{- end }}
+ {{ end }}

相关链接