diff options
| author | Reorx <novoreorx@gmail.com> | 2022-09-07 16:20:55 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-09-07 16:20:55 +0800 |
| commit | ceede2988aa86ad19a2ff84bb3eb76b91b8dd4da (patch) | |
| tree | be07df163b941520c64284aeefd1606c4c55532f | |
| parent | ea271b565162f9a4144b97c23dbce3135403e094 (diff) | |
move .first-entry css to main.css, styling newsletter section
| -rw-r--r-- | assets/css/common/main.css | 47 | ||||
| -rw-r--r-- | assets/css/common/post-entry.css | 43 | ||||
| -rw-r--r-- | assets/css/extended/newsletter.scss | 8 | ||||
| -rw-r--r-- | layouts/_default/archives.html | 2 | ||||
| -rw-r--r-- | layouts/newsletter/section.html | 106 |
5 files changed, 109 insertions, 97 deletions
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 <mark> 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 <mark> 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" }} <header class="page-header"> - <h1>{{ .Title }} !</h1> + <h1>{{ .Title }}</h1> {{- if .Description }} <div class="post-description"> {{ .Description }} diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index e64f285..47901f3 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -3,64 +3,70 @@ {{- define "main" }} <div class="main-icon">@</div> -<header class="page-header"> - <h1>{{ .Title }}</h1> - {{- with .Param "archivesSlug" }} - <div> - <a href="{{ $.RelPermalink }}{{ . }}/">Archives</a> +<div class="content"> + <div class="first-entry"> + <header class="entry-header"> + <h1>{{ .Title }}</h1> + </header> + <section class="entry-content">{{ .Description | markdownify }}</section> </div> - {{- end }} -</header> -{{- $pages := where .Pages "Params.hidden" "!=" true }} + {{- $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 }} + {{/* 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> + {{- 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 not (.Param "hideMeta") }} - <footer class="entry-footer"> - {{- partial "post_meta.html" . -}} + + {{- 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 }} - <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 }} + {{- with .Param "archivesSlug" }} + <div> + <a href="{{ $.RelPermalink }}{{ . }}/">Archives</a> + </div> + {{- end }} +</div> {{ end }} |
