diff options
| -rw-r--r-- | CHANGELOG.md | 6 | ||||
| -rw-r--r-- | assets/sass/_customize.scss | 16 | ||||
| -rw-r--r-- | exampleSite/config.toml | 10 | ||||
| -rw-r--r-- | layouts/_default/single.html | 17 | ||||
| -rw-r--r-- | layouts/dramas/single.html | 14 | ||||
| -rw-r--r-- | layouts/narratives/single.html | 14 | ||||
| -rw-r--r-- | layouts/page/single.html | 10 | ||||
| -rw-r--r-- | layouts/partials/post-meta/author.html | 3 | ||||
| -rw-r--r-- | layouts/partials/post-meta/date.html | 21 | ||||
| -rw-r--r-- | layouts/poems/single.html | 14 | ||||
| -rw-r--r-- | resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content | 12 |
11 files changed, 103 insertions, 34 deletions
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 <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 - 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" }} -<article class="post"> - <h1 class="text-title">{{ .Params.caption | default .Title }}</h1> - {{ .Content }} +<article class="post" role="document"{{ with .Params.lang}} lang="{{ . }}"{{ end }}> + <header> + <h1 class="text-title"> + {{ .Params.caption | default .Title }} + </h1> + </header> + + <p class="byline"> + {{ partial "post-meta/date.html" . }} + </p> + + <div class="post-body"> + {{ .Content }} + </div> </article> {{ 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" }} -<article class="drama"> - <h1 class="text-title">{{ .Params.caption | default .Title }}</h1> - {{ with .Params.author }}<p class="byline">{{ i18n "by" . }}</p>{{ end }} +<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 index e3dc1b9..c941bc2 100644 --- a/layouts/narratives/single.html +++ b/layouts/narratives/single.html @@ -1,7 +1,15 @@ {{ define "main" }} -<article class="narrative"> - <h1 class="text-title">{{ .Params.caption | default .Title }}</h1> - {{ with .Params.author }}<p class="byline">{{ i18n "by" . }}</p>{{ end }} +<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 index d31cbe7..fef0cf5 100644 --- a/layouts/page/single.html +++ b/layouts/page/single.html @@ -1,7 +1,11 @@ {{ define "main" }} -<article class="page" id="page-{{ .File.TranslationBaseName | lower }}"> - <h1 class="page-title">{{ .Params.caption | default .Title }}</h1> +<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/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 }} + <span class="author">{{ i18n "by" . }}</span> +{{ 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 }} -<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> - {{- .Date | time.Format (site.Params.dateformat | default "January 02, 2006") -}} -</time> -{{- if ne .Date .Lastmod }} -<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}"> - ({{ i18n "updated_at" }} {{ .Lastmod | time.Format (site.Params.dateformat | default "January 02, 2006") -}}) -</time> -{{- end -}} -{{- end }} +{{ if not .Date.IsZero }} + <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> + {{ .Date | time.Format (site.Params.dateformat | default "January 02, 2006") }} + </time> + + {{ if ne .Date .Lastmod }} + <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}"> + ({{ i18n "updated_at" }} {{ .Lastmod | time.Format (site.Params.dateformat | default "January 02, 2006") }}) + </time> + {{ 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" }} -<article class="poem poetry"> - <h1 class="text-title">{{ .Params.caption | default .Title }}</h1> - {{ with .Params.author }}<p class="byline">{{ i18n "by" . }}</p>{{ end }} +<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 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; } |
