From 882af0656327476b523e0d6538b29ae9ad6eda28 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 31 May 2022 00:19:18 +0200 Subject: Mior reformatting of posts layout --- CHANGELOG.md | 6 ++++++ assets/sass/_customize.scss | 16 ++++++++++++---- exampleSite/config.toml | 10 ++++++++-- layouts/_default/single.html | 17 ++++++++++++++--- layouts/dramas/single.html | 14 +++++++++++--- layouts/narratives/single.html | 14 +++++++++++--- layouts/page/single.html | 10 +++++++--- layouts/partials/post-meta/author.html | 3 +++ layouts/partials/post-meta/date.html | 21 +++++++++++---------- layouts/poems/single.html | 14 +++++++++++--- ...le.scss_f300667da4f5b5f84e1a9e0702b2fdde.content | 12 +++++++++--- 11 files changed, 103 insertions(+), 34 deletions(-) create mode 100644 layouts/partials/post-meta/author.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eeda7d..9e491a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Provide ability to include custom scripts in the theme. +- Provide ability to specify custom language of a post. + +### Changed + +- Mior reformatting of posts layout. +- Allow to manually override lastmod date of a post. ## [v0.2.0](https://github.com/sergeyklay/gohugo-theme-ed/compare/v0.1.0...v0.2.0) diff --git a/assets/sass/_customize.scss b/assets/sass/_customize.scss index 10b7b3f..79d3aae 100644 --- a/assets/sass/_customize.scss +++ b/assets/sass/_customize.scss @@ -41,10 +41,6 @@ letter-spacing: -1px; } -.post-meta time { - padding-right: 1rem; -} - .post { margin-top: 40px; @@ -91,6 +87,18 @@ margin-top: -.5rem; } +.post .byline, +.poem .byline, +.poetry .byline { + margin-bottom: 1rem; +} + +.byline .author, +.post-meta .author { + padding-right: 1rem; +} + + nav.pagination { justify-content: center; } diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 64401db..242049d 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -149,8 +149,8 @@ disableKinds = ['RSS'] footer = 'Built with Ed. 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 - postMeta = ['date'] + # 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' @@ -251,3 +251,9 @@ disableKinds = ['RSS'] [markup.goldmark.parser.attribute] # Enable custom attribute support for blocks block = true + +# If enableGitInfo is true, it will override any lastmod dates in our +# front matter. We should at least allow ourselves to manually override +# this value in the front matter. +[frontmatter] + lastmod = ['lastmod', ':git', 'date', 'publishDate'] diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 90bb5b5..6b2c851 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,17 @@ {{ define "main" }} -
-

{{ .Params.caption | default .Title }}

- {{ .Content }} +
+
+

+ {{ .Params.caption | default .Title }} +

+
+ + + +
+ {{ .Content }} +
{{ end }} diff --git a/layouts/dramas/single.html b/layouts/dramas/single.html index 865a07b..e47e531 100644 --- a/layouts/dramas/single.html +++ b/layouts/dramas/single.html @@ -1,7 +1,15 @@ {{ define "main" }} -
-

{{ .Params.caption | default .Title }}

- {{ with .Params.author }}{{ end }} +
+
+

+ {{ .Params.caption | default .Title }} +

+
+ + + {{ .Content }}
{{ end }} diff --git a/layouts/narratives/single.html b/layouts/narratives/single.html index e3dc1b9..c941bc2 100644 --- a/layouts/narratives/single.html +++ b/layouts/narratives/single.html @@ -1,7 +1,15 @@ {{ define "main" }} -
-

{{ .Params.caption | default .Title }}

- {{ with .Params.author }}{{ end }} +
+
+

+ {{ .Params.caption | default .Title }} +

+
+ + + {{ .Content }}
{{ end }} diff --git a/layouts/page/single.html b/layouts/page/single.html index d31cbe7..fef0cf5 100644 --- a/layouts/page/single.html +++ b/layouts/page/single.html @@ -1,7 +1,11 @@ {{ define "main" }} -
-

{{ .Params.caption | default .Title }}

+
+
+

+ {{ .Params.caption | default .Title }} +

+
+ {{ .Content }}
{{ end }} - diff --git a/layouts/partials/post-meta/author.html b/layouts/partials/post-meta/author.html new file mode 100644 index 0000000..1b56004 --- /dev/null +++ b/layouts/partials/post-meta/author.html @@ -0,0 +1,3 @@ +{{ with .Params.author }} + {{ i18n "by" . }} +{{ end }} diff --git a/layouts/partials/post-meta/date.html b/layouts/partials/post-meta/date.html index 92401e7..04a814a 100644 --- a/layouts/partials/post-meta/date.html +++ b/layouts/partials/post-meta/date.html @@ -1,10 +1,11 @@ -{{- if not .Date.IsZero }} - -{{- if ne .Date .Lastmod }} - -{{- end -}} -{{- end }} +{{ if not .Date.IsZero }} + + + {{ if ne .Date .Lastmod }} + + {{ end }} +{{ end }} diff --git a/layouts/poems/single.html b/layouts/poems/single.html index d61a185..58038d1 100644 --- a/layouts/poems/single.html +++ b/layouts/poems/single.html @@ -1,7 +1,15 @@ {{ define "main" }} -
-

{{ .Params.caption | default .Title }}

- {{ with .Params.author }}{{ end }} +
+
+

+ {{ .Params.caption | default .Title }} +

+
+ + + {{ .Content }}
{{ end }} diff --git a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content index 11c11f2..30e82bc 100644 --- a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content +++ b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content @@ -893,9 +893,6 @@ form input:-moz-ui-invalid { line-height: 1; letter-spacing: -1px; } -.post-meta time { - padding-right: 1rem; } - .post { margin-top: 40px; } @media only screen and (min-width: 768px) { @@ -932,6 +929,15 @@ form input:-moz-ui-invalid { letter-spacing: 0; margin-top: -.5rem; } +.post .byline, +.poem .byline, +.poetry .byline { + margin-bottom: 1rem; } + +.byline .author, +.post-meta .author { + padding-right: 1rem; } + nav.pagination { justify-content: center; } -- cgit v1.2.3