From 7bb41658ef63db1b308289b78d617ee596d98ef7 Mon Sep 17 00:00:00 2001 From: Chen Xianmin Date: Mon, 17 Oct 2022 06:28:20 +0800 Subject: refactor: post meta --- assets/sass/_partial/_post/_header.scss | 55 ++++++++++++++------ dev-config.toml | 7 +-- exampleSite/content/post/how-to-contribute.md | 2 +- layouts/partials/post/i18nlist.html | 14 ++--- layouts/partials/post/meta.html | 74 +++++++++++++++++++++++++++ layouts/post/single.html | 51 ++++-------------- layouts/post/summary.html | 56 +++++--------------- 7 files changed, 149 insertions(+), 110 deletions(-) create mode 100644 layouts/partials/post/meta.html diff --git a/assets/sass/_partial/_post/_header.scss b/assets/sass/_partial/_post/_header.scss index 4415519..2d3ccf3 100644 --- a/assets/sass/_partial/_post/_header.scss +++ b/assets/sass/_partial/_post/_header.scss @@ -5,9 +5,9 @@ border-bottom: 2px LightGrey solid; .post-title { - margin: 0; - font-size: $post-title-font-size; - font-weight: $post-title-font-weight; + margin: unset; + font-size: 2em; + font-weight: 700; font-family: $global-serif-font-family; .post-pinned svg { @@ -22,20 +22,50 @@ @include underline-from-center; } + .post-title-i18n { + a { + color: $theme-color; + @include underline-from-center; + } + } + .post-meta { - font-size: 14px; - color: $post-meta-font-color; + margin-top: 1em; + display: flex; + align-items: center; + + .post-meta-author { + a { + color: $theme-color; + } + } - .post-time { - font-size: 15px; + .post-meta-time { + margin-left: 1em; } - .post-category { + .post-meta-lastmod { + margin-left: 0.5em; + font-size: 0.8em; + font-style: italic; + } + + .post-meta__right { + margin-left: auto; + display: flex; + font-size: 0.8em; + flex-direction: column; + line-height: 1.318; + text-align: right; + color: $dark-gray; + } + + .post-meta-category { display: inline; a { &::before { - content: '·'; + content: "·"; } } } @@ -47,12 +77,5 @@ color: $theme-color; } } - - .more-meta { - &::before { - content: '·'; - } - } - } } diff --git a/dev-config.toml b/dev-config.toml index fc582e5..612d881 100644 --- a/dev-config.toml +++ b/dev-config.toml @@ -94,8 +94,9 @@ defaultContentLanguage = "en" # Default language to use (if you setup multiling url = "https://gohugo.io" -[author] # essential # 必需 - name = "xianmin" +[author] + name = "Jane" # essential # 必需 + url = "/about" # optional # 可选 [sitemap] # essential # 必需 changefreq = "weekly" @@ -125,7 +126,7 @@ defaultContentLanguage = "en" # Default language to use (if you setup multiling dateFormatToUse = "2006-01-02" # show word count and read time ? # 是否显示字数统计与阅读时间 - moreMeta = true + moreMeta = false # show language chooser in menu showMenuLanguageChooser = true diff --git a/exampleSite/content/post/how-to-contribute.md b/exampleSite/content/post/how-to-contribute.md index b69a2d6..822c8b8 100644 --- a/exampleSite/content/post/how-to-contribute.md +++ b/exampleSite/content/post/how-to-contribute.md @@ -7,7 +7,7 @@ tags = [ "hugo", "Contribute", ] -date = "2021-10-15" +date = "2022-10-15" categories = [ "Development", "index", diff --git a/layouts/partials/post/i18nlist.html b/layouts/partials/post/i18nlist.html index bdca1d4..239993a 100644 --- a/layouts/partials/post/i18nlist.html +++ b/layouts/partials/post/i18nlist.html @@ -1,7 +1,9 @@ {{ if .IsTranslated }} -
- {{ range .Translations }} -
{{ i18n (printf "read_%s" .Lang) }}: {{ .Title }}
- {{ end }} -
-{{ end }} \ No newline at end of file +
+ {{ range .Translations }} +
+ {{ i18n (printf "read_%s" .Lang) }}: {{ .Title }} +
+ {{ end }} +
+{{ end }} diff --git a/layouts/partials/post/meta.html b/layouts/partials/post/meta.html new file mode 100644 index 0000000..6587cbc --- /dev/null +++ b/layouts/partials/post/meta.html @@ -0,0 +1,74 @@ +
+ + + + + {{ if ne (.Lastmod.Format ("2006-01-02")) (.Date.Format ("2006-01-02")) }} + + {{ end }} + + + +
diff --git a/layouts/post/single.html b/layouts/post/single.html index 903d60d..5622fb4 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -1,49 +1,16 @@ {{ define "content" -}} -

{{ .Title }}

{{ partial "post/i18nlist.html" . }} - + {{ partial "post/meta.html" . }}
{{ partial "post/toc.html" . }} +
{{ .Content }} @@ -52,21 +19,24 @@ {{ partial "post/copyright.html" . }} + {{ partial "post/reward.html" . }} +
-- cgit v1.2.3