move .first-entry css to main.css, styling newsletter section

This commit is contained in:
Reorx 2022-09-07 16:20:55 +08:00
parent ea271b5651
commit ceede2988a
5 changed files with 113 additions and 101 deletions

View File

@ -14,7 +14,7 @@
} }
mark { mark {
margin: 0 -0.4em; margin: 0 -0.4em;
padding: 0.1em 0.4em; padding: 0em 0.4em;
border-radius: 0.8em 0.3em; border-radius: 0.8em 0.3em;
background: transparent; background: transparent;
background-image: linear-gradient( background-image: linear-gradient(
@ -27,6 +27,51 @@ mark {
box-decoration-break: clone; 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 */ /* for post page */
.main.post { .main.post {
max-width: calc(var(--post-width) + var(--gap) * 2); max-width: calc(var(--post-width) + var(--gap) * 2);

View File

@ -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 { .home-info .entry-content {
-webkit-line-clamp: unset; -webkit-line-clamp: unset;
} }

View File

@ -42,8 +42,12 @@ body.type-newsletter.kind-section {
text-align: center; text-align: center;
} }
.page-header { .main {
h1 { .content {
max-width: calc(var(--post-width));
margin: 0 auto;
}
.entry-header h1 {
text-align: center; text-align: center;
} }
} }

View File

@ -1,7 +1,7 @@
{{- define "main" }} {{- define "main" }}
<header class="page-header"> <header class="page-header">
<h1>{{ .Title }} !</h1> <h1>{{ .Title }}</h1>
{{- if .Description }} {{- if .Description }}
<div class="post-description"> <div class="post-description">
{{ .Description }} {{ .Description }}

View File

@ -3,64 +3,70 @@
{{- define "main" }} {{- define "main" }}
<div class="main-icon"></div> <div class="main-icon"></div>
<header class="page-header"> <div class="content">
<h1>{{ .Title }}</h1> <div class="first-entry">
<header class="entry-header">
<h1>{{ .Title }}</h1>
</header>
<section class="entry-content">{{ .Description | markdownify }}</section>
</div>
{{- $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 }}
<article class="post-entry">
<header class="entry-header">
<h2>
{{- .Title }}
{{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[Draft]</span></sup>{{- end }}
{{- if .Weight }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[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 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" }} {{- with .Param "archivesSlug" }}
<div> <div>
<a href="{{ $.RelPermalink }}{{ . }}/">Archives</a> <a href="{{ $.RelPermalink }}{{ . }}/">Archives</a>
</div> </div>
{{- end }} {{- end }}
</header>
{{- $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 }}
<article class="post-entry">
<header class="entry-header">
<h2>
{{- .Title }}
{{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[Draft]</span></sup>{{- end }}
{{- if .Weight }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[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 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 }}
</div>
{{ end }} {{ end }}