diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 9cb66a1a2..6767b9e57 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -655,6 +655,9 @@ enableEmoji = true # you can add extra information after the name (HTML format is supported), such as icons # 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标 post = "" + # whether to use typeit animation for title name + # 是否为副标题显示打字机动画 + typeit = false # Footer config # 页面底部信息配置 diff --git a/exampleSite/content/posts/theme-documentation-basics.en.md b/exampleSite/content/posts/theme-documentation-basics.en.md index 86f7deb61..f35f8d9ae 100644 --- a/exampleSite/content/posts/theme-documentation-basics.en.md +++ b/exampleSite/content/posts/theme-documentation-basics.en.md @@ -254,6 +254,8 @@ Please open the code block below to view the complete sample configuration :(far pre = "" # you can add extra information after the name (HTML format is supported), such as icons post = "" + # whether to use typeit animation for title name + typeit = false # Footer config [params.footer] diff --git a/exampleSite/content/posts/theme-documentation-basics.fr.md b/exampleSite/content/posts/theme-documentation-basics.fr.md index 574940675..7be524591 100644 --- a/exampleSite/content/posts/theme-documentation-basics.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics.fr.md @@ -259,6 +259,8 @@ Please open the code block below to view the complete sample configuration :(far pre = "" # you can add extra information after the name (HTML format is supported), such as icons post = "" + # whether to use typeit animation for title name + typeit = false # Footer config [params.footer] diff --git a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md index a280d9df5..54ed1a420 100644 --- a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md @@ -257,6 +257,8 @@ hugo pre = "" # 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标 post = "" + # 是否为副标题显示打字机动画 + typeit = false # 页面底部信息配置 [params.footer] diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 7cd6c3e10..51a97c6cf 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -10,7 +10,13 @@ {{- with .pre -}} {{ . | safeHTML }} {{- end -}} + {{- if .typeit -}} + {{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}} + + {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} + {{- else -}} {{- .name -}} + {{- end -}} {{- with .post -}} {{ . | safeHTML }} {{- end -}} @@ -88,7 +94,13 @@ {{- with .pre -}} {{ . | safeHTML }} {{- end -}} + {{- if .typeit -}} + {{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}} + + {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} + {{- else -}} {{- .name -}} + {{- end -}} {{- with .post -}} {{ . | safeHTML }} {{- end -}}