From 9a7189c2a3f52792dfa5bbd96aaa7c8626ed457c Mon Sep 17 00:00:00 2001 From: Dillon Date: Mon, 16 Mar 2020 16:14:37 +0800 Subject: feat(subtitle): add subtitle for posts (#171) --- archetypes/default.md | 1 + assets/css/_page/_single.scss | 8 ++++++++ assets/css/_page/_special.scss | 3 +-- exampleSite/content/posts/basic-markdown-syntax.en.md | 1 + exampleSite/content/posts/basic-markdown-syntax.fr.md | 1 + exampleSite/content/posts/basic-markdown-syntax.zh-cn.md | 1 + exampleSite/content/posts/emoji-support.en.md | 1 + exampleSite/content/posts/emoji-support.fr.md | 1 + exampleSite/content/posts/emoji-support.zh-cn.md | 1 + exampleSite/content/posts/theme-documentation-basics.en.md | 9 +++++---- exampleSite/content/posts/theme-documentation-basics.fr.md | 9 +++++---- exampleSite/content/posts/theme-documentation-basics.zh-cn.md | 9 +++++---- exampleSite/content/posts/theme-documentation-content.en.md | 3 +++ exampleSite/content/posts/theme-documentation-content.fr.md | 8 +++----- exampleSite/content/posts/theme-documentation-content.zh-cn.md | 3 +++ exampleSite/content/posts/theme-documentation-shortcodes.en.md | 1 + exampleSite/content/posts/theme-documentation-shortcodes.fr.md | 1 + .../content/posts/theme-documentation-shortcodes.zh-cn.md | 1 + layouts/_default/single.html | 3 +++ layouts/posts/single.html | 3 +++ .../style.template.scss_b8ba9a60a151126bfcde1421dc0b972d.content | 2 +- 21 files changed, 50 insertions(+), 20 deletions(-) diff --git a/archetypes/default.md b/archetypes/default.md index b1fb410..3dfd94f 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,5 +1,6 @@ --- title: "{{ replace .TranslationBaseName "-" " " | title }}" +subtitle: "" date: {{ .Date }} lastmod: {{ .Date }} draft: true diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index 89ada33..fa588f8 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -6,6 +6,14 @@ line-height: 140%; } + .single-subtitle { + margin: .4rem 0; + font-size: 1.2rem; + font-weight: normal; + font-style: italic; + line-height: 100%; + } + .post-meta { font-size: .875rem; color: $global-font-secondary-color; diff --git a/assets/css/_page/_special.scss b/assets/css/_page/_special.scss index f61360d..436d8d9 100644 --- a/assets/css/_page/_special.scss +++ b/assets/css/_page/_special.scss @@ -1,6 +1,5 @@ .special { - .single-title { + .single-title, .single-subtitle { text-align: right; - padding-bottom: 1rem; } } diff --git a/exampleSite/content/posts/basic-markdown-syntax.en.md b/exampleSite/content/posts/basic-markdown-syntax.en.md index dfda332..df5ce48 100644 --- a/exampleSite/content/posts/basic-markdown-syntax.en.md +++ b/exampleSite/content/posts/basic-markdown-syntax.en.md @@ -1,6 +1,7 @@ --- weight: 4 title: "Basic Markdown Syntax" +subtitle: "" date: 2019-12-01T21:57:40+08:00 lastmod: 2020-01-01T16:45:40+08:00 draft: false diff --git a/exampleSite/content/posts/basic-markdown-syntax.fr.md b/exampleSite/content/posts/basic-markdown-syntax.fr.md index 11bdda6..dfc49e4 100644 --- a/exampleSite/content/posts/basic-markdown-syntax.fr.md +++ b/exampleSite/content/posts/basic-markdown-syntax.fr.md @@ -1,6 +1,7 @@ --- weight: 4 title: "Syntaxe de Markdown de Base" +subtitle: "" date: 2019-12-01T21:57:40+08:00 lastmod: 2020-01-01T16:45:40+08:00 draft: false diff --git a/exampleSite/content/posts/basic-markdown-syntax.zh-cn.md b/exampleSite/content/posts/basic-markdown-syntax.zh-cn.md index 9a05b08..4bff6d5 100644 --- a/exampleSite/content/posts/basic-markdown-syntax.zh-cn.md +++ b/exampleSite/content/posts/basic-markdown-syntax.zh-cn.md @@ -1,6 +1,7 @@ --- weight: 4 title: "Markdown 基本语法" +subtitle: "" date: 2019-12-01T21:57:40+08:00 lastmod: 2020-01-01T16:45:40+08:00 draft: false diff --git a/exampleSite/content/posts/emoji-support.en.md b/exampleSite/content/posts/emoji-support.en.md index 6ec48b9..da3cf2c 100644 --- a/exampleSite/content/posts/emoji-support.en.md +++ b/exampleSite/content/posts/emoji-support.en.md @@ -1,6 +1,7 @@ --- weight: 5 title: "Emoji Support" +subtitle: "" date: 2019-10-01T17:55:28+08:00 lastmod: 2019-10-01T17:55:28+08:00 draft: false diff --git a/exampleSite/content/posts/emoji-support.fr.md b/exampleSite/content/posts/emoji-support.fr.md index 86f6de6..94b0454 100644 --- a/exampleSite/content/posts/emoji-support.fr.md +++ b/exampleSite/content/posts/emoji-support.fr.md @@ -1,6 +1,7 @@ --- weight: 5 title: "Emoji Support" +subtitle: "" date: 2019-10-01T17:55:28+08:00 lastmod: 2019-10-01T17:55:28+08:00 draft: false diff --git a/exampleSite/content/posts/emoji-support.zh-cn.md b/exampleSite/content/posts/emoji-support.zh-cn.md index a2cc76e..e7e4c5c 100644 --- a/exampleSite/content/posts/emoji-support.zh-cn.md +++ b/exampleSite/content/posts/emoji-support.zh-cn.md @@ -1,6 +1,7 @@ --- weight: 5 title: "Emoji 支持" +subtitle: "" date: 2019-10-01T17:55:28+08:00 lastmod: 2019-10-01T17:55:28+08:00 draft: false diff --git a/exampleSite/content/posts/theme-documentation-basics.en.md b/exampleSite/content/posts/theme-documentation-basics.en.md index 0758cfc..4616aac 100644 --- a/exampleSite/content/posts/theme-documentation-basics.en.md +++ b/exampleSite/content/posts/theme-documentation-basics.en.md @@ -1,6 +1,7 @@ --- weight: 1 title: "Theme Documentation - Basics" +subtitle: "" date: 2020-03-06T21:29:01+08:00 lastmod: 2020-03-06T21:29:01+08:00 draft: false @@ -37,7 +38,7 @@ Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only depende Just install latest version of [:(far fa-file-archive): Hugo (> 0.62.0)](https://gohugo.io/getting-started/installing/) for your OS (**Windows**, **Linux**, **macOS**). {{< admonition note "Why not support earlier versions of Hugo?" >}} -Since [Markdown Render Hooks](https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks) was introduced in the [Hugo Christmas Edition](https://gohugo.io/news/0.62.0-relnotes/), this theme only supports Hugo versions above **v0.62.0**. +Since [Markdown Render Hooks](https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks) was introduced in the [Hugo Christmas Edition](https://gohugo.io/news/0.62.0-relnotes/), this theme only supports Hugo versions above **0.62.0**. {{< /admonition >}} ## 2 Installation @@ -188,7 +189,7 @@ Note that some of these parameters are explained in details in other sections of defaultTheme = "auto" # public git repo url only then enableGitInfo is true gitRepo = "" - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 # which hash function used for SRI, when empty, no SRI is used ("sha256", "sha384", "sha512", "md5") fingerprint = "" # Header info @@ -348,13 +349,13 @@ Note that some of these parameters are explained in details in other sections of enable = true # Disqus Comment Config (https://disqus.com/) [params.comment.disqus] - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 enable = false # Disqus shortname to use Disqus in posts shortname = "" # Gitalk Comment Config (https://github.com/gitalk/gitalk) [params.comment.gitalk] - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 enable = false owner = "" repo = "" diff --git a/exampleSite/content/posts/theme-documentation-basics.fr.md b/exampleSite/content/posts/theme-documentation-basics.fr.md index fbffbbf..ddbbd64 100644 --- a/exampleSite/content/posts/theme-documentation-basics.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics.fr.md @@ -1,6 +1,7 @@ --- weight: 1 title: "Thème Documentation - Concepts de Base" +subtitle: "" date: 2020-03-06T21:40:32+08:00 lastmod: 2020-03-06T21:40:32+08:00 draft: false @@ -37,7 +38,7 @@ Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only depende Just install latest version of [:(far fa-file-archive): Hugo (> 0.62.0)](https://gohugo.io/getting-started/installing/) for your OS (**Windows**, **Linux**, **macOS**). {{< admonition note "Why not support earlier versions of Hugo?" >}} -Since [Markdown Render Hooks](https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks) was introduced in the [Hugo Christmas Edition](https://gohugo.io/news/0.62.0-relnotes/), this theme only supports Hugo versions above **v0.62.0**. +Since [Markdown Render Hooks](https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks) was introduced in the [Hugo Christmas Edition](https://gohugo.io/news/0.62.0-relnotes/), this theme only supports Hugo versions above **0.62.0**. {{< /admonition >}} ## 2 Installation @@ -188,7 +189,7 @@ Note that some of these parameters are explained in details in other sections of defaultTheme = "auto" # public git repo url only then enableGitInfo is true gitRepo = "" - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 # which hash function used for SRI, when empty, no SRI is used ("sha256", "sha384", "sha512", "md5") fingerprint = "" # Header info @@ -348,13 +349,13 @@ Note that some of these parameters are explained in details in other sections of enable = true # Disqus Comment Config (https://disqus.com/) [params.comment.disqus] - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 enable = false # Disqus shortname to use Disqus in posts shortname = "" # Gitalk Comment Config (https://github.com/gitalk/gitalk) [params.comment.gitalk] - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 enable = false owner = "" repo = "" diff --git a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md index 03fa0a6..c540f02 100644 --- a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md @@ -1,6 +1,7 @@ --- weight: 1 title: "主题文档 - 基本概念" +subtitle: "" date: 2020-03-06T21:40:32+08:00 lastmod: 2020-03-06T21:40:32+08:00 draft: false @@ -37,7 +38,7 @@ comment: true 直接安装满足你操作系统 (**Windows**, **Linux**, **macOS**) 的最新版本 [:(far fa-file-archive): Hugo (> 0.62.0)](https://gohugo.io/getting-started/installing/). {{< admonition note "为什么不支持早期版本的 Hugo?" >}} -由于 [Markdown 渲染钩子函数](https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks) 在 [Hugo 圣诞节版本](https://gohugo.io/news/0.62.0-relnotes/) 中被引入, 本主题只支持高于 **v0.62.0** 的 Hugo 版本. +由于 [Markdown 渲染钩子函数](https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks) 在 [Hugo 圣诞节版本](https://gohugo.io/news/0.62.0-relnotes/) 中被引入, 本主题只支持高于 **0.62.0** 的 Hugo 版本. {{< /admonition >}} ## 2 安装 @@ -191,7 +192,7 @@ hugo defaultTheme = "auto" # 公共 git 仓库路径,仅在 enableGitInfo 设为 true 时有效 gitRepo = "" - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 # 哪种哈希函数用来 SRI, 为空时表示不使用 SRI ("sha256", "sha384", "sha512", "md5") fingerprint = "" # 页面头部导航栏信息 @@ -350,13 +351,13 @@ hugo enable = true # Disqus 评论系统设置 (https://disqus.com/) [params.comment.disqus] - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 enable = false # Disqus 的 shortname,用来在文章中启用 Disqus 评论系统 shortname = "" # Gitalk 评论系统设置 (https://github.com/gitalk/gitalk) [params.comment.gitalk] - # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.1.1 enable = false owner = "" repo = "" diff --git a/exampleSite/content/posts/theme-documentation-content.en.md b/exampleSite/content/posts/theme-documentation-content.en.md index 18a9bd5..4ba405b 100644 --- a/exampleSite/content/posts/theme-documentation-content.en.md +++ b/exampleSite/content/posts/theme-documentation-content.en.md @@ -1,6 +1,7 @@ --- weight: 2 title: "Theme Documentation - Content" +subtitle: "" date: 2020-03-05T15:58:26+08:00 lastmod: 2020-03-05T15:58:26+08:00 draft: false @@ -47,6 +48,7 @@ Here is a default front matter from the default archetype: ```yaml --- title: "My First Post" +subtitle: "" date: 2020-03-04T15:58:26+08:00 lastmod: 2020-03-04T15:58:26+08:00 draft: true @@ -74,6 +76,7 @@ comment: true ``` * **title**: the title for the content. +* **subtitle**: the subtitle for the content. **LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.2.0** * **date**: the datetime assigned to this page, which is usually fetched from the `date` field in front matter, but this behaviour is configurabl in the [site configuration](../theme-documentation-basics/#site-configuration). * **lastmod**: the datetime at which the content was last modified. * **draft**: if `true`, the content will not be rendered unless the `--buildDrafts`/`-D` flag is passed to the `hugo` command. diff --git a/exampleSite/content/posts/theme-documentation-content.fr.md b/exampleSite/content/posts/theme-documentation-content.fr.md index 64ce3a5..2724f86 100644 --- a/exampleSite/content/posts/theme-documentation-content.fr.md +++ b/exampleSite/content/posts/theme-documentation-content.fr.md @@ -1,6 +1,7 @@ --- weight: 2 title: "Thème Documentation - Contenu" +subtitle: "" date: 2020-03-05T16:30:05+08:00 lastmod: 2020-03-05T16:30:05+08:00 draft: false @@ -30,11 +31,6 @@ Découvrez comment créer et organiser votre contenu rapidement et intuitivement -{{< admonition warning >}} -Sorry, this article has not been completely translated into **French**. -Welcome to take the time to propose a translation by [making a PR](https://github.com/dillonzq/LoveIt/pulls) to the theme! -{{< /admonition >}} - ## 1 Contents Organization A few suggestions to help you get a good looking site quickly: @@ -52,6 +48,7 @@ Here is a default front matter from the default archetype: ```yaml --- title: "My First Post" +subtitle: "" date: 2020-03-04T15:58:26+08:00 lastmod: 2020-03-04T15:58:26+08:00 draft: true @@ -79,6 +76,7 @@ comment: true ``` * **title**: the title for the content. +* **subtitle**: the subtitle for the content. **LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.2.0** * **date**: the datetime assigned to this page, which is usually fetched from the `date` field in front matter, but this behaviour is configurabl in the [site configuration](../theme-documentation-basics/#site-configuration). * **lastmod**: the datetime at which the content was last modified. * **draft**: if `true`, the content will not be rendered unless the `--buildDrafts`/`-D` flag is passed to the `hugo` command. diff --git a/exampleSite/content/posts/theme-documentation-content.zh-cn.md b/exampleSite/content/posts/theme-documentation-content.zh-cn.md index a3d710c..093e707 100644 --- a/exampleSite/content/posts/theme-documentation-content.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-content.zh-cn.md @@ -1,6 +1,7 @@ --- weight: 2 title: "主题文档 - 内容" +subtitle: "" date: 2020-03-05T16:30:05+08:00 lastmod: 2020-03-05T16:30:05+08:00 draft: false @@ -47,6 +48,7 @@ comment: true ```yaml --- title: "我的第一篇文章" +subtitle: "" date: 2020-03-04T15:58:26+08:00 lastmod: 2020-03-04T15:58:26+08:00 draft: true @@ -74,6 +76,7 @@ comment: true ``` * **title**: 文章标题. +* **subtitle**: 文章副标题. **LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): 0.2.0** * **date**: 这篇文章创建的日期时间. 它通常是从文章的前置参数中的 `date` 字段获取的, 但是也可以在 [网站配置](../theme-documentation-basics/#site-configuration) 中设置. * **lastmod**: 上次修改内容的日期时间. * **draft**: 如果设为 `true`, 除非 `hugo` 命令使用了 `--buildDrafts`/`-D` 参数, 这篇文章不会被渲染. diff --git a/exampleSite/content/posts/theme-documentation-shortcodes.en.md b/exampleSite/content/posts/theme-documentation-shortcodes.en.md index 7b6cab1..52a3c69 100644 --- a/exampleSite/content/posts/theme-documentation-shortcodes.en.md +++ b/exampleSite/content/posts/theme-documentation-shortcodes.en.md @@ -1,6 +1,7 @@ --- weight: 3 title: "Theme Documentation - Shortcodes" +subtitle: "" date: 2020-03-04T16:29:41+08:00 lastmod: 2020-03-04T16:29:41+08:00 draft: false diff --git a/exampleSite/content/posts/theme-documentation-shortcodes.fr.md b/exampleSite/content/posts/theme-documentation-shortcodes.fr.md index c5ff5a4..306e1a6 100644 --- a/exampleSite/content/posts/theme-documentation-shortcodes.fr.md +++ b/exampleSite/content/posts/theme-documentation-shortcodes.fr.md @@ -1,6 +1,7 @@ --- weight: 3 title: "Thème Documentation - Shortcodes" +subtitle: "" date: 2020-03-04T16:29:59+08:00 lastmod: 2020-03-04T16:29:59+08:00 draft: false diff --git a/exampleSite/content/posts/theme-documentation-shortcodes.zh-cn.md b/exampleSite/content/posts/theme-documentation-shortcodes.zh-cn.md index 9545ed3..fab3970 100644 --- a/exampleSite/content/posts/theme-documentation-shortcodes.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-shortcodes.zh-cn.md @@ -1,6 +1,7 @@ --- weight: 3 title: "主题文档 - Shortcodes" +subtitle: "" date: 2020-03-04T16:29:59+08:00 lastmod: 2020-03-04T16:29:59+08:00 draft: false diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 5bdc32e..8687942 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -6,6 +6,9 @@

{{- .Title -}}

+ {{- with .Params.subtitle -}} +

{{ . }}

+ {{- end -}} {{- /* Content */ -}}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 1e90176..6c58599 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -5,6 +5,9 @@
{{- /* Title */ -}}

{{ .Title }}

+ {{- with .Params.subtitle -}} +

{{ . }}

+ {{- end -}} {{- /* Meta */ -}}