diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-06-05 18:10:34 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-06-05 18:10:42 +0200 |
| commit | 7d4a696a70969b82a55715221b85700a1e68d140 (patch) | |
| tree | f80a870391737b9afa1090f3f37975e95fbd1dd2 | |
| parent | 0c30ea398b6315e9b99afa4067a4897fad876d60 (diff) | |
| download | gohugo-theme-ed-7d4a696a70969b82a55715221b85700a1e68d140.tar.gz | |
Rework single post layouts
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | assets/sass/_customize.scss | 10 | ||||
| -rw-r--r-- | exampleSite/config.toml | 2 | ||||
| -rw-r--r-- | exampleSite/content/poems/dreams.md | 1 | ||||
| -rw-r--r-- | layouts/_default/single.html | 25 | ||||
| -rw-r--r-- | layouts/_default/teaser.html | 4 | ||||
| -rw-r--r-- | layouts/dramas/single.html | 15 | ||||
| -rw-r--r-- | layouts/narratives/single.html | 15 | ||||
| -rw-r--r-- | layouts/page/single.html | 11 | ||||
| -rw-r--r-- | layouts/partials/page/single.html | 13 | ||||
| -rw-r--r-- | layouts/partials/post-class.html | 8 | ||||
| -rw-r--r-- | layouts/partials/post-meta.html | 9 | ||||
| -rw-r--r-- | layouts/poems/single.html | 15 | ||||
| -rw-r--r-- | resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content | 8 |
14 files changed, 46 insertions, 91 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 81ecb76..c83447a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Rework post dates format. Now they prefixes with "Published on" and "Updated on" +- Rework single post layouts. Reduce the number of layouts for poems, dramas, narratives and posts to one ## [v0.3.0](https://github.com/sergeyklay/gohugo-theme-ed/compare/v0.2.0...v0.3.0) diff --git a/assets/sass/_customize.scss b/assets/sass/_customize.scss index 4242627..7b0c768 100644 --- a/assets/sass/_customize.scss +++ b/assets/sass/_customize.scss @@ -75,7 +75,7 @@ } .post-meta { - margin-top: 5px; + margin-bottom: 0; font-size: .85rem; color: $text-light-color; } @@ -93,12 +93,6 @@ margin-bottom: 1rem; } -.byline .author, -.post-meta .author { - padding-right: 1rem; -} - - nav.pagination { justify-content: center; } @@ -140,7 +134,7 @@ ul.pager li { display: inline-block; } -.post-tags-wrapper { +.tags-wrapper { position: relative; } diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 5ef6fe6..8899b90 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -149,8 +149,6 @@ disableKinds = ['RSS'] footer = 'Built with <a href="https://github.com/sergeyklay/gohugo-theme-ed" target="_blank" rel="noopener noreferrer">Ed</a>. Distributed under an MIT license.' # Sections to be displayed in the main page, as well as RSS/Atom feeds mainSections = ['posts', 'dramas', 'narratives', 'poems'] - # Order of post meta information. Order is important. - postMeta = ['author', 'date'] # Posts date format, for example: 2006-01-02 dateFormat = ':date_long' dateFormatToc = '2006.01.02' diff --git a/exampleSite/content/poems/dreams.md b/exampleSite/content/poems/dreams.md index 9fd62f4..b51c48c 100644 --- a/exampleSite/content/poems/dreams.md +++ b/exampleSite/content/poems/dreams.md @@ -1,6 +1,7 @@ --- title: Dreams date: 2022-02-01T14:56:58+02:00 +lastmod: 2022-05-01T14:56:58+02:00 draft: false author: Langston Hughes editor: Alex Gil diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 56557e5..6be2a68 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,21 +1,28 @@ {{ define "main" }} -<article class="post" role="document"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> +{{- $postType := .Type | lower | singularize -}} +<article class="{{ partial "post-class.html" . }}" role="document"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> <header> <h1 class="text-title"> {{ .Params.caption | default .Title }} </h1> + <p class="byline"> + {{ if in (slice "drama" "narrative" "poem") $postType }} + {{ partial "post-meta/author.html" . }} + {{ else }} + {{ partial "post-meta/date.html" . }} + {{ end }} + </p> </header> - <p class="byline"> - {{ partial "post-meta/date.html" . }} - </p> - - <div class="post-body"> + <div class="{{ $postType }}-body"> {{ .Content }} </div> - <div class="post-tags-wrapper"> - {{ partial "post-tags.html" . }} - </div> + {{/* Post tags are not allowed for drama, narratives and poems */}} + {{ if not (in (slice "drama" "narrative" "poem") $postType) }} + <div class="tags-wrapper"> + {{ partial "post-tags.html" . }} + </div> + {{ end }} </article> {{ end }} diff --git a/layouts/_default/teaser.html b/layouts/_default/teaser.html index 441d779..82ea767 100644 --- a/layouts/_default/teaser.html +++ b/layouts/_default/teaser.html @@ -4,7 +4,9 @@ <h2 class="post-title"> <a href="{{ .Permalink }}" rel="bookmark">{{ .Title }}</a> </h2> - {{- partial "post-meta.html" . -}} + <p class="post-meta"> + {{- partial "post-meta/date.html" . -}} + </p> </header> <p class="post-content"> {{ .Summary }} diff --git a/layouts/dramas/single.html b/layouts/dramas/single.html deleted file mode 100644 index e47e531..0000000 --- a/layouts/dramas/single.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ define "main" }} -<article class="drama" role="document"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> - <header> - <h1 class="text-title"> - {{ .Params.caption | default .Title }} - </h1> - </header> - - <p class="byline"> - {{ partial "post-meta/author.html" . }} - </p> - - {{ .Content }} -</article> -{{ end }} diff --git a/layouts/narratives/single.html b/layouts/narratives/single.html deleted file mode 100644 index c941bc2..0000000 --- a/layouts/narratives/single.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ define "main" }} -<article class="narrative" role="document"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> - <header> - <h1 class="text-title"> - {{ .Params.caption | default .Title }} - </h1> - </header> - - <p class="byline"> - {{ partial "post-meta/author.html" . }} - </p> - - {{ .Content }} -</article> -{{ end }} diff --git a/layouts/page/single.html b/layouts/page/single.html deleted file mode 100644 index fef0cf5..0000000 --- a/layouts/page/single.html +++ /dev/null @@ -1,11 +0,0 @@ -{{ define "main" }} -<article class="page" role="document" id="page-{{ .File.TranslationBaseName | lower }}"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> - <header> - <h1 class="page-title"> - {{ .Params.caption | default .Title }} - </h1> - </header> - - {{ .Content }} -</article> -{{ end }} diff --git a/layouts/partials/page/single.html b/layouts/partials/page/single.html new file mode 100644 index 0000000..ca1180d --- /dev/null +++ b/layouts/partials/page/single.html @@ -0,0 +1,13 @@ +{{ define "main" }} +<article class="{{ partial "post-class.html" . }}" role="document" id="page-{{ .File.TranslationBaseName | lower }}"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> + <header> + <h1 class="page-title"> + {{ .Params.caption | default .Title }} + </h1> + </header> + + <div class="page-body"> + {{ .Content }} + </div> +</article> +{{ end }} diff --git a/layouts/partials/post-class.html b/layouts/partials/post-class.html new file mode 100644 index 0000000..1d32a8a --- /dev/null +++ b/layouts/partials/post-class.html @@ -0,0 +1,8 @@ +{{- $postClass := "page" -}} +{{- if .IsPage -}} + {{- $postClass = .Type | lower | singularize -}} + {{- if eq $postClass "poem" -}} + {{- $postClass = "poem poetry" -}} + {{- end -}} +{{- end -}} +{{- $postClass -}} diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html deleted file mode 100644 index 19c3ce6..0000000 --- a/layouts/partials/post-meta.html +++ /dev/null @@ -1,9 +0,0 @@ -<div class="post-meta"> - {{- $root := . -}} - {{- with .Param "postMeta" -}} - {{- range $field := . -}} - {{- $p := printf "post-meta/%s.html" $field -}} - {{- partial $p $root -}} - {{- end -}} - {{- end -}} -</div> diff --git a/layouts/poems/single.html b/layouts/poems/single.html deleted file mode 100644 index 58038d1..0000000 --- a/layouts/poems/single.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ define "main" }} -<article class="poem poetry" role="document"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> - <header> - <h1 class="text-title"> - {{ .Params.caption | default .Title }} - </h1> - </header> - - <p class="byline"> - {{ partial "post-meta/author.html" . }} - </p> - - {{ .Content }} -</article> -{{ end }} diff --git a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content index 856b58b..6503cd3 100644 --- a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content +++ b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content @@ -919,7 +919,7 @@ form input:-moz-ui-invalid { margin-bottom: 0; } .post-meta { - margin-top: 5px; + margin-bottom: 0; font-size: .85rem; color: #676767; } @@ -934,10 +934,6 @@ form input:-moz-ui-invalid { .poetry .byline { margin-bottom: 1rem; } -.byline .author, -.post-meta .author { - padding-right: 1rem; } - nav.pagination { justify-content: center; } @@ -971,7 +967,7 @@ ul.pager li { margin-bottom: 1rem; display: inline-block; } -.post-tags-wrapper { +.tags-wrapper { position: relative; } .post-tags { |
