Merge pull request #322 from dillonzq/develop

This commit is contained in:
Dillon
2020-05-05 10:32:44 +08:00
committed by GitHub
39 changed files with 536 additions and 134 deletions
-1
View File
@@ -1,7 +1,6 @@
# Hugo default output directory # Hugo default output directory
public/ public/
/exampleSite/resources/ /exampleSite/resources/
/resources/_gen/assets/scss/temp
node_modules/ node_modules/
build/ build/
+4 -2
View File
@@ -9,7 +9,7 @@ English README | [简体中文说明](https://github.com/dillonzq/LoveIt/blob/ma
> **LoveIt** is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/). > **LoveIt** is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/).
It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/liuzc/LeaveIt). It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt).
Since the three themes have a similar look, if you have questions about their differences, Since the three themes have a similar look, if you have questions about their differences,
read [Why choose LoveIt](#why-choose-loveit) so that you can choose the one that works best for you. read [Why choose LoveIt](#why-choose-loveit) so that you can choose the one that works best for you.
@@ -89,7 +89,8 @@ I hope you will LoveIt ❤️!
* **Valine** comment system supported by [Valine](https://valine.js.org/) * **Valine** comment system supported by [Valine](https://valine.js.org/)
* **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/) * **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* **Telegram comments** system supported by [Telegram Comments](https://comments.app/) * **Telegram comments** system supported by [Telegram Comments](https://comments.app/)
* **Commento** comments system supported by [Commento](https://commento.io/) * **Commento** comment system supported by [Commento](https://commento.io/)
* **Utterances** comment system supported by [Utterances](https://utteranc.es/)
### Extended Features ### Extended Features
@@ -131,6 +132,7 @@ LoveIt supports the following languages:
* Polish * Polish
* Brazilian Portuguese * Brazilian Portuguese
* Italian * Italian
* Spanish
* [Contribute with a new language](https://github.com/dillonzq/LoveIt/pulls) * [Contribute with a new language](https://github.com/dillonzq/LoveIt/pulls)
[Languages Compatibility](https://hugoloveit.com/theme-documentation-basics/#language-compatibility) [Languages Compatibility](https://hugoloveit.com/theme-documentation-basics/#language-compatibility)
+3 -1
View File
@@ -9,7 +9,7 @@
> [LoveIt](https://github.com/dillonzq/LoveIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。 > [LoveIt](https://github.com/dillonzq/LoveIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
它的原型基于 [LeaveIt 主题](https://github.com/liuzc/LeaveIt) 和 [KeepIt 主题](https://github.com/liuzc/LeaveIt)。 它的原型基于 [LeaveIt 主题](https://github.com/liuzc/LeaveIt) 和 [KeepIt 主题](https://github.com/Fastbyte01/KeepIt)。
由于三个主题外观的相似性,如果你对于它们的不同之处有疑问,请阅读 [为什么选择 LoveIt](#为什么选择-LoveIt),以便你能选择最适合你的一个。 由于三个主题外观的相似性,如果你对于它们的不同之处有疑问,请阅读 [为什么选择 LoveIt](#为什么选择-LoveIt),以便你能选择最适合你的一个。
@@ -85,6 +85,7 @@
* 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统 * 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统
* 支持 **[Telegram comments](https://comments.app/) 评论**系统 * 支持 **[Telegram comments](https://comments.app/) 评论**系统
* 支持 **[Commento](https://commento.io/)** 评论系统 * 支持 **[Commento](https://commento.io/)** 评论系统
* 支持 **[Utterances](https://utteranc.es/)** 评论系统
### 扩展功能 ### 扩展功能
@@ -126,6 +127,7 @@ LoveIt 支持下列语言:
* 波兰语 * 波兰语
* 巴西葡萄牙语 * 巴西葡萄牙语
* 意大利语 * 意大利语
* 西班牙语
* [贡献一种新的语言](https://github.com/dillonzq/LoveIt/pulls) * [贡献一种新的语言](https://github.com/dillonzq/LoveIt/pulls)
[语言兼容性](https://hugoloveit.com/zh-cn/theme-documentation-basics/#language-compatibility) [语言兼容性](https://hugoloveit.com/zh-cn/theme-documentation-basics/#language-compatibility)
+2 -3
View File
@@ -2,15 +2,14 @@
.wrapper { .wrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-height: 97.5vh; min-height: 100vh;
width: 100%; width: 100%;
main { main {
flex: 1 0 auto; flex: 1 0 auto;
.container { .container {
padding-left: 1rem; padding: 0 1rem;
padding-right: 1rem;
} }
} }
} }
+7 -2
View File
@@ -17,16 +17,21 @@
@include border-radius(100%); @include border-radius(100%);
@include box-shadow(0 0 0 .3618em rgba(0, 0, 0, .05)); @include box-shadow(0 0 0 .3618em rgba(0, 0, 0, .05));
@include transition(all 0.4s ease); @include transition(all 0.4s ease);
cursor: pointer;
&:hover { &:hover {
position: relative; position: relative;
@include transform(translateY(-.75rem)); @include transform(translateY(-.75rem));
cursor: pointer;
} }
} }
} }
.home-title {
font-size: 1.2rem;
font-weight: bold;
margin: 0;
padding: .4rem;
}
.home-subtitle { .home-subtitle {
font-size: 1rem; font-size: 1rem;
font-weight: normal; font-weight: normal;
+2 -2
View File
@@ -2,8 +2,8 @@ footer {
height: 2rem; height: 2rem;
width: 100%; width: 100%;
text-align: center; text-align: center;
line-height: 1.5rem; line-height: 1.25rem;
padding-top: 2rem; padding: 1rem 0;
.footer-container { .footer-container {
font-size: .875rem; font-size: .875rem;
+1 -1
View File
@@ -1,3 +1,3 @@
.comment { #comments {
padding: 4rem 0; padding: 4rem 0;
} }
+1 -1
View File
@@ -371,4 +371,4 @@ $admonition-background-color-map: (
) !default; ) !default;
// ========== Admonition ========== // // ========== Admonition ========== //
$MAX_LENGTH: 9999px; $MAX_LENGTH: 12000px;
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -14,7 +14,7 @@ lg-thumbnail.js@1.1.0 https://github.com/sachinchoolur/lg-thumbnail.js
lg-zoom.js@1.0.1 https://github.com/sachinchoolur/lg-zoom.js lg-zoom.js@1.0.1 https://github.com/sachinchoolur/lg-zoom.js
clipboard.js@2.0.6 https://github.com/zenorocha/clipboard.js clipboard.js@2.0.6 https://github.com/zenorocha/clipboard.js
sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js
typeit@6.5.1 https://github.com/alexmacarthur/typeit typeit@7.0.4 https://github.com/alexmacarthur/typeit
katex@0.11.1 https://katex.org/ katex@0.11.1 https://katex.org/
mermaid@8.5.0 https://github.com/knsv/mermaid mermaid@8.5.0 https://github.com/knsv/mermaid
echarts@4.7.0 https://echarts.apache.org/ echarts@4.7.0 https://echarts.apache.org/
+2 -4
View File
File diff suppressed because one or more lines are too long
+38 -3
View File
@@ -142,6 +142,8 @@ enableEmoji = true
gravatarEmail = "" gravatarEmail = ""
# URL of avatar shown in home page # URL of avatar shown in home page
avatarURL = "/images/avatar.png" avatarURL = "/images/avatar.png"
# title shown in home page
title = ""
# subtitle shown in home page # subtitle shown in home page
subtitle = "A Clean, Elegant but Advanced Hugo Theme" subtitle = "A Clean, Elegant but Advanced Hugo Theme"
# whether to use typeit animation for subtitle # whether to use typeit animation for subtitle
@@ -340,6 +342,8 @@ enableEmoji = true
gravatarEmail = "" gravatarEmail = ""
# 主页显示头像的 URL # 主页显示头像的 URL
avatarURL = "/images/avatar.png" avatarURL = "/images/avatar.png"
# 主页显示的网站标题
title = ""
# 主页显示的网站副标题 # 主页显示的网站副标题
subtitle = "一个简洁、优雅且高效的 Hugo 主题" subtitle = "一个简洁、优雅且高效的 Hugo 主题"
# 是否为副标题显示打字机动画 # 是否为副标题显示打字机动画
@@ -534,6 +538,8 @@ enableEmoji = true
gravatarEmail = "" gravatarEmail = ""
# URL of avatar shown in home page # URL of avatar shown in home page
avatarURL = "/images/avatar.png" avatarURL = "/images/avatar.png"
# title shown in home page
title = ""
# subtitle shown in home page # subtitle shown in home page
subtitle = "Un thème Hugo simple, élégant et efficace" subtitle = "Un thème Hugo simple, élégant et efficace"
# whether to use typeit animation for subtitle # whether to use typeit animation for subtitle
@@ -655,6 +661,9 @@ enableEmoji = true
# you can add extra information after the name (HTML format is supported), such as icons # you can add extra information after the name (HTML format is supported), such as icons
# 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标 # 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标
post = "" post = ""
# whether to use typeit animation for title name
# 是否为标题显示打字机动画
typeit = false
# Footer config # Footer config
# 页面底部信息配置 # 页面底部信息配置
@@ -883,10 +892,20 @@ enableEmoji = true
colorful = true colorful = true
dislikes = false dislikes = false
outlined = false outlined = false
# Commento comments config (https://commento.io/) # Commento comment config (https://commento.io/)
# Commento comments 评论系统设置 (https://commento.io/) # Commento comment 评论系统设置 (https://commento.io/)
[params.page.comment.commento] [params.page.comment.commento]
enable = false enable = false
# Utterances comment config (https://utteranc.es/)
# Utterances comment 评论系统设置 (https://utteranc.es/)
[params.page.comment.utterances]
enable = false
# owner/repo
repo = ""
issueTerm = "pathname"
label = ""
lightTheme = "github-light"
darkTheme = "github-dark"
# SEO config # SEO config
# SEO 配置 # SEO 配置
[params.page.seo] [params.page.seo]
@@ -911,6 +930,22 @@ enableEmoji = true
width = 800 width = 800
height = 600 height = 600
# TypeIt config
# TypeIt 配置
[params.typeit]
# typing speed between each step (measured in milliseconds)
# 每一步的打字速度 (单位是毫秒)
speed = 100
# blinking speed of the cursor (measured in milliseconds)
# 光标的闪烁速度 (单位是毫秒)
cursorSpeed = 1000
# character used for the cursor (HTML format is supported)
# 光标的字符 (支持 HTML 格式)
cursorChar = "|"
# cursor duration after typing finishing (measured in milliseconds, "-1" means unlimited)
# 打字结束之后光标的持续时间 (单位是毫秒, "-1" 代表无限大)
duration = -1
# Site verification code for Google/Bing/Yandex/Pinterest/Baidu # Site verification code for Google/Bing/Yandex/Pinterest/Baidu
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu # 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification] [params.verification]
@@ -977,7 +1012,7 @@ enableEmoji = true
clipboardJS = "" clipboardJS = ""
# sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js # sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js
sharerJS = "" sharerJS = ""
# typeit@6.5.1 https://github.com/alexmacarthur/typeit # typeit@7.0.4 https://github.com/alexmacarthur/typeit
typeitJS = "" typeitJS = ""
# katex@0.11.1 https://katex.org/ # katex@0.11.1 https://katex.org/
katexCSS = "" katexCSS = ""
+3 -2
View File
@@ -19,7 +19,7 @@ math:
> [:(far fa-kiss-wink-heart fa-fw): LoveIt](https://github.com/dillonzq/LoveIt) is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/) developed by [Dillon](https://dillonzq.com). > [:(far fa-kiss-wink-heart fa-fw): LoveIt](https://github.com/dillonzq/LoveIt) is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/) developed by [Dillon](https://dillonzq.com).
> >
> It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/liuzc/LeaveIt). > It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt).
![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt") ![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt")
@@ -56,7 +56,8 @@ math:
* :(far fa-comment-alt fa-fw): **Valine** comment system supported by [Valine](https://valine.js.org/) * :(far fa-comment-alt fa-fw): **Valine** comment system supported by [Valine](https://valine.js.org/)
* :(far fa-comments fa-fw): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/) * :(far fa-comments fa-fw): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* :(fas fa-comment fa-fw): **Telegram comments** system supported by [Comments](https://comments.app/) * :(fas fa-comment fa-fw): **Telegram comments** system supported by [Comments](https://comments.app/)
* :(fas fa-comment-dots fa-fw): **Commento** comments system supported by [Commento](https://commento.io/) * :(fas fa-comment-dots fa-fw): **Commento** comment system supported by [Commento](https://commento.io/)
* :(fas fa-comment-alt fa-fw): **Utterances** comment system supported by [Utterances](https://utteranc.es/)
#### Extended Features #### Extended Features
+3 -2
View File
@@ -24,7 +24,7 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw
> [:(far fa-kiss-wink-heart fa-fw): LoveIt](https://github.com/dillonzq/LoveIt) is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/) developed by [Dillon](https://dillonzq.com). > [:(far fa-kiss-wink-heart fa-fw): LoveIt](https://github.com/dillonzq/LoveIt) is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/) developed by [Dillon](https://dillonzq.com).
> >
> It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/liuzc/LeaveIt). > It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt).
![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt") ![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt")
@@ -61,7 +61,8 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw
* :(far fa-comment-alt fa-fw): **Valine** comment system supported by [Valine](https://valine.js.org/) * :(far fa-comment-alt fa-fw): **Valine** comment system supported by [Valine](https://valine.js.org/)
* :(far fa-comments fa-fw): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/) * :(far fa-comments fa-fw): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* :(fas fa-comment fa-fw): **Telegram comments** system supported by [Comments](https://comments.app/) * :(fas fa-comment fa-fw): **Telegram comments** system supported by [Comments](https://comments.app/)
* :(fas fa-comment-dots fa-fw): **Commento** comments system supported by [Commento](https://commento.io/) * :(fas fa-comment-dots fa-fw): **Commento** comment system supported by [Commento](https://commento.io/)
* :(fas fa-comment-alt fa-fw): **Utterances** comment system supported by [Utterances](https://utteranc.es/)
#### Extended Features #### Extended Features
+2 -1
View File
@@ -19,7 +19,7 @@ math:
> [:(far fa-kiss-wink-heart fa-fw): LoveIt](https://github.com/dillonzq/LoveIt) 是一个由 [Dillon](https://dillonzq.com) 开发的**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。 > [:(far fa-kiss-wink-heart fa-fw): LoveIt](https://github.com/dillonzq/LoveIt) 是一个由 [Dillon](https://dillonzq.com) 开发的**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
> >
> 它的原型基于 [LeaveIt 主题](https://github.com/liuzc/LeaveIt) 和 [KeepIt 主题](https://github.com/liuzc/LeaveIt)。 > 它的原型基于 [LeaveIt 主题](https://github.com/liuzc/LeaveIt) 和 [KeepIt 主题](https://github.com/Fastbyte01/KeepIt)。
![Hugo 主题 LoveIt](/images/Apple-Devices-Preview.png "Hugo 主题 LoveIt") ![Hugo 主题 LoveIt](/images/Apple-Devices-Preview.png "Hugo 主题 LoveIt")
@@ -57,6 +57,7 @@ math:
* :(far fa-comments fa-fw): 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统 * :(far fa-comments fa-fw): 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统
* :(fas fa-comment fa-fw): 支持 **[Telegram comments](https://comments.app/) 评论**系统 * :(fas fa-comment fa-fw): 支持 **[Telegram comments](https://comments.app/) 评论**系统
* :(fas fa-comment-dots fa-fw): 支持 **[Commento](https://commento.io/)** 评论系统 * :(fas fa-comment-dots fa-fw): 支持 **[Commento](https://commento.io/)** 评论系统
* :(far fa-comment-alt fa-fw): 支持 **[Utterances](https://utteranc.es/)** 评论系统
#### 扩展功能 #### 扩展功能
@@ -26,14 +26,14 @@ Discover what the Hugo - **LoveIt** theme is all about and the core-concepts beh
Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme. Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme.
Just install latest version of [:(far fa-file-archive fa-fw): Hugo extended (> 0.62.0)](https://gohugo.io/getting-started/installing/) for your OS (**Windows**, **Linux**, **macOS**). Just install latest version of [:(far fa-file-archive fa-fw): 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?" >}} {{< 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 **0.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 >}} {{< /admonition >}}
{{< admonition note "Why need the Hugo extended version?" >}} {{< admonition tip "Hugo extended version is recommended" >}}
Since the theme processes SCSS to CSS, Hugo needs to be the **extended** version. Since some features of this theme need to processes :(fab fa-sass fa-fw): SCSS to :(fab fa-css3 fa-fw): CSS, it is recommended to use Hugo **extended** version for better experience.
{{< /admonition >}} {{< /admonition >}}
## 2 Installation ## 2 Installation
@@ -254,6 +254,8 @@ Please open the code block below to view the complete sample configuration :(far
pre = "" pre = ""
# you can add extra information after the name (HTML format is supported), such as icons # you can add extra information after the name (HTML format is supported), such as icons
post = "" post = ""
# {{< version 0.2.5 >}} whether to use typeit animation for title name
typeit = false
# Footer config # Footer config
[params.footer] [params.footer]
@@ -302,6 +304,8 @@ Please open the code block below to view the complete sample configuration :(far
gravatarEmail = "" gravatarEmail = ""
# URL of avatar shown in home page # URL of avatar shown in home page
avatarURL = "/images/avatar.png" avatarURL = "/images/avatar.png"
# {{< version 0.2.5 >}} title shown in home page
title = ""
# subtitle shown in home page # subtitle shown in home page
subtitle = "This is My New Hugo Site" subtitle = "This is My New Hugo Site"
# whether to use typeit animation for subtitle # whether to use typeit animation for subtitle
@@ -315,7 +319,8 @@ Please open the code block below to view the complete sample configuration :(far
enable = true enable = true
# special amount of posts in each home posts page # special amount of posts in each home posts page
paginate = 6 paginate = 6
# {{< version 0.2.0 deleted >}} default behavior when you don't set "hiddenFromHomePage" in front matter # {{< version 0.2.0 deleted >}} replaced with hiddenFromHomePage in params.page
# default behavior when you don't set "hiddenFromHomePage" in front matter
defaultHiddenFromHomePage = false defaultHiddenFromHomePage = false
# Social config about the author # Social config about the author
@@ -528,6 +533,15 @@ Please open the code block below to view the complete sample configuration :(far
# {{< version 0.2.0 >}} {{< link "https://commento.io/" "Commento" >}} comment config # {{< version 0.2.0 >}} {{< link "https://commento.io/" "Commento" >}} comment config
[params.page.comment.commento] [params.page.comment.commento]
enable = false enable = false
# {{< version 0.2.5 >}} {{< link "https://utteranc.es/" "Utterances" >}} comment config
[params.page.comment.utterances]
enable = false
# owner/repo
repo = ""
issueTerm = "pathname"
label = ""
lightTheme = "github-light"
darkTheme = "github-dark"
# {{< version 0.2.0 >}} SEO config # {{< version 0.2.0 >}} SEO config
[params.page.seo] [params.page.seo]
# Publisher info # Publisher info
@@ -548,6 +562,17 @@ Please open the code block below to view the complete sample configuration :(far
width = 800 width = 800
height = 600 height = 600
# {{< version 0.2.5 >}} TypeIt config
[params.typeit]
# typing speed between each step (measured in milliseconds)
speed = 100
# blinking speed of the cursor (measured in milliseconds)
cursorSpeed = 1000
# character used for the cursor (HTML format is supported)
cursorChar = "|"
# cursor duration after typing finishing (measured in milliseconds, "-1" means unlimited)
duration = -1
# Site verification code config for Google/Bing/Yandex/Pinterest/Baidu # Site verification code config for Google/Bing/Yandex/Pinterest/Baidu
[params.verification] [params.verification]
google = "" google = ""
@@ -608,7 +633,7 @@ Please open the code block below to view the complete sample configuration :(far
clipboardJS = "" clipboardJS = ""
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0 # {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0
sharerJS = "" sharerJS = ""
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1 # {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@7.0.4
typeitJS = "" typeitJS = ""
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1 # {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = "" katexCSS = ""
@@ -823,6 +848,7 @@ In `config/css/_custom.scss`, you can add some css style code to customize the s
| Polish | `pl` | `pl` | :(far fa-square fa-fw): | :(far fa-square fa-fw): | | Polish | `pl` | `pl` | :(far fa-square fa-fw): | :(far fa-square fa-fw): |
| Brazilian Portuguese | `pt-br` | `pt-BR` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | Brazilian Portuguese | `pt-br` | `pt-BR` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
| Italian | `it` | `it` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | Italian | `it` | `it` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
| Spanish | `es` | `es` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
### 4.2 Basic Configuration ### 4.2 Basic Configuration
@@ -31,14 +31,14 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw
Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme. Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme.
Just install latest version of [:(far fa-file-archive fa-fw): Hugo extended (> 0.62.0)](https://gohugo.io/getting-started/installing/) for your OS (**Windows**, **Linux**, **macOS**). Just install latest version of [:(far fa-file-archive fa-fw): 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?" >}} {{< 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 **0.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 >}} {{< /admonition >}}
{{< admonition note "Why need the Hugo extended version?" >}} {{< admonition tip "Hugo extended version is recommended" >}}
Since the theme processes SCSS to CSS, Hugo needs to be the **extended** version. Since some features of this theme need to processes :(fab fa-sass fa-fw): SCSS to :(fab fa-css3 fa-fw): CSS, it is recommended to use Hugo **extended** version for better experience.
{{< /admonition >}} {{< /admonition >}}
## 2 Installation ## 2 Installation
@@ -259,6 +259,8 @@ Please open the code block below to view the complete sample configuration :(far
pre = "" pre = ""
# you can add extra information after the name (HTML format is supported), such as icons # you can add extra information after the name (HTML format is supported), such as icons
post = "" post = ""
# {{< version 0.2.5 >}} whether to use typeit animation for title name
typeit = false
# Footer config # Footer config
[params.footer] [params.footer]
@@ -307,6 +309,8 @@ Please open the code block below to view the complete sample configuration :(far
gravatarEmail = "" gravatarEmail = ""
# URL of avatar shown in home page # URL of avatar shown in home page
avatarURL = "/images/avatar.png" avatarURL = "/images/avatar.png"
# {{< version 0.2.5 >}} title shown in home page
title = ""
# subtitle shown in home page # subtitle shown in home page
subtitle = "This is My New Hugo Site" subtitle = "This is My New Hugo Site"
# whether to use typeit animation for subtitle # whether to use typeit animation for subtitle
@@ -320,7 +324,8 @@ Please open the code block below to view the complete sample configuration :(far
enable = true enable = true
# special amount of posts in each home posts page # special amount of posts in each home posts page
paginate = 6 paginate = 6
# {{< version 0.2.0 deleted >}} default behavior when you don't set "hiddenFromHomePage" in front matter # {{< version 0.2.0 deleted >}} replaced with hiddenFromHomePage in params.page
# default behavior when you don't set "hiddenFromHomePage" in front matter
defaultHiddenFromHomePage = false defaultHiddenFromHomePage = false
# Social config about the author # Social config about the author
@@ -533,6 +538,15 @@ Please open the code block below to view the complete sample configuration :(far
# {{< version 0.2.0 >}} {{< link "https://commento.io/" "Commento" >}} comment config # {{< version 0.2.0 >}} {{< link "https://commento.io/" "Commento" >}} comment config
[params.page.comment.commento] [params.page.comment.commento]
enable = false enable = false
# {{< version 0.2.5 >}} {{< link "https://utteranc.es/" "Utterances" >}} comment config
[params.page.comment.utterances]
enable = false
# owner/repo
repo = ""
issueTerm = "pathname"
label = ""
lightTheme = "github-light"
darkTheme = "github-dark"
# {{< version 0.2.0 >}} SEO config # {{< version 0.2.0 >}} SEO config
[params.page.seo] [params.page.seo]
# Publisher info # Publisher info
@@ -553,6 +567,17 @@ Please open the code block below to view the complete sample configuration :(far
width = 800 width = 800
height = 600 height = 600
# {{< version 0.2.5 >}} TypeIt config
[params.typeit]
# typing speed between each step (measured in milliseconds)
speed = 100
# blinking speed of the cursor (measured in milliseconds)
cursorSpeed = 1000
# character used for the cursor (HTML format is supported)
cursorChar = "|"
# cursor duration after typing finishing (measured in milliseconds, "-1" means unlimited)
duration = -1
# Site verification code config for Google/Bing/Yandex/Pinterest/Baidu # Site verification code config for Google/Bing/Yandex/Pinterest/Baidu
[params.verification] [params.verification]
google = "" google = ""
@@ -613,7 +638,7 @@ Please open the code block below to view the complete sample configuration :(far
clipboardJS = "" clipboardJS = ""
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0 # {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0
sharerJS = "" sharerJS = ""
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1 # {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@7.0.4
typeitJS = "" typeitJS = ""
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1 # {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = "" katexCSS = ""
@@ -828,6 +853,7 @@ In `config/css/_custom.scss`, you can add some css style code to customize the s
| Polish | `pl` | `pl` | :(far fa-square fa-fw): | :(far fa-square fa-fw): | | Polish | `pl` | `pl` | :(far fa-square fa-fw): | :(far fa-square fa-fw): |
| Brazilian Portuguese | `pt-br` | `pt-BR` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | Brazilian Portuguese | `pt-br` | `pt-BR` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
| Italian | `it` | `it` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | Italian | `it` | `it` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
| Spanish | `es` | `es` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
### 4.2 Basic Configuration ### 4.2 Basic Configuration
@@ -26,7 +26,7 @@ toc:
由于 Hugo 提供的便利性, [Hugo](https://gohugo.io/) 本身是这个主题唯一的依赖. 由于 Hugo 提供的便利性, [Hugo](https://gohugo.io/) 本身是这个主题唯一的依赖.
直接安装满足你操作系统 (**Windows**, **Linux**, **macOS**) 的最新版本 [:(far fa-file-archive fa-fw): Hugo extended (> 0.62.0)](https://gohugo.io/getting-started/installing/). 直接安装满足你操作系统 (**Windows**, **Linux**, **macOS**) 的最新版本 [:(far fa-file-archive fa-fw): Hugo (> 0.62.0)](https://gohugo.io/getting-started/installing/).
{{< admonition note "为什么不支持早期版本的 Hugo?" >}} {{< admonition note "为什么不支持早期版本的 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 版本. 由于 [Markdown 渲染钩子函数](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks) 在 [Hugo 圣诞节版本](https://gohugo.io/news/0.62.0-relnotes/) 中被引入, 本主题只支持高于 **0.62.0** 的 Hugo 版本.
@@ -36,6 +36,10 @@ toc:
由于本主题需要转换 SCSS 文件为 CSS 文件, Hugo **extended** 版本是必要的. 由于本主题需要转换 SCSS 文件为 CSS 文件, Hugo **extended** 版本是必要的.
{{< /admonition >}} {{< /admonition >}}
{{< admonition tip "推荐使用 Hugo extended 版本" >}}
由于这个主题的一些特性需要将 :(fab fa-sass fa-fw): SCSS 转换为 :(fab fa-css3 fa-fw): CSS, 推荐使用 Hugo **extended** 版本来获得更好的使用体验.
{{< /admonition >}}
## 2 安装 ## 2 安装
以下步骤可帮助你初始化新网站. 如果你根本不了解 Hugo, 我们强烈建议你按照此 [快速入门文档](https://gohugo.io/getting-started/quick-start/) 进一步了解它. 以下步骤可帮助你初始化新网站. 如果你根本不了解 Hugo, 我们强烈建议你按照此 [快速入门文档](https://gohugo.io/getting-started/quick-start/) 进一步了解它.
@@ -257,6 +261,8 @@ hugo
pre = "" pre = ""
# 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标 # 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标
post = "" post = ""
# {{< version 0.2.5 >}} 是否为标题显示打字机动画
typeit = false
# 页面底部信息配置 # 页面底部信息配置
[params.footer] [params.footer]
@@ -305,6 +311,8 @@ hugo
gravatarEmail = "" gravatarEmail = ""
# 主页显示头像的 URL # 主页显示头像的 URL
avatarURL = "/images/avatar.png" avatarURL = "/images/avatar.png"
# {{< version 0.2.5 >}} 主页显示的网站标题
title = ""
# 主页显示的网站副标题 # 主页显示的网站副标题
subtitle = "这是我的全新 Hugo 网站" subtitle = "这是我的全新 Hugo 网站"
# 是否为副标题显示打字机动画 # 是否为副标题显示打字机动画
@@ -318,7 +326,8 @@ hugo
enable = true enable = true
# 主页每页显示文章数量 # 主页每页显示文章数量
paginate = 6 paginate = 6
# {{< version 0.2.0 deleted >}} 当你没有在文章前置参数中设置 "hiddenFromHomePage" 时的默认行为 # {{< version 0.2.0 deleted >}} 被 params.page 中的 hiddenFromHomePage 替代
# 当你没有在文章前置参数中设置 "hiddenFromHomePage" 时的默认行为
defaultHiddenFromHomePage = false defaultHiddenFromHomePage = false
# 作者的社交信息设置 # 作者的社交信息设置
@@ -531,6 +540,15 @@ hugo
# {{< version 0.2.0 >}} {{< link "https://commento.io/" "Commento" >}} 评论系统设置 # {{< version 0.2.0 >}} {{< link "https://commento.io/" "Commento" >}} 评论系统设置
[params.page.comment.commento] [params.page.comment.commento]
enable = false enable = false
# {{< version 0.2.5 >}} {{< link "https://utteranc.es/" "Utterances" >}} 评论系统设置
[params.page.comment.utterances]
enable = false
# owner/repo
repo = ""
issueTerm = "pathname"
label = ""
lightTheme = "github-light"
darkTheme = "github-dark"
# {{< version 0.2.0 >}} SEO config # {{< version 0.2.0 >}} SEO config
[params.page.seo] [params.page.seo]
# 出版者信息 # 出版者信息
@@ -551,6 +569,17 @@ hugo
width = 800 width = 800
height = 600 height = 600
# {{< version 0.2.5 >}} TypeIt 配置
[params.typeit]
# 每一步的打字速度 (单位是毫秒)
speed = 100
# 光标的闪烁速度 (单位是毫秒)
cursorSpeed = 1000
# 光标的字符 (支持 HTML 格式)
cursorChar = "|"
# 打字结束之后光标的持续时间 (单位是毫秒, "-1" 代表无限大)
duration = -1
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu # 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification] [params.verification]
google = "" google = ""
@@ -611,7 +640,7 @@ hugo
clipboardJS = "" clipboardJS = ""
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0 # {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0
sharerJS = "" sharerJS = ""
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1 # {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@7.0.4
typeitJS = "" typeitJS = ""
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1 # {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = "" katexCSS = ""
@@ -827,6 +856,7 @@ $code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospac
| 波兰语 | `pl` | `pl` | :(far fa-square fa-fw): | :(far fa-square fa-fw): | | 波兰语 | `pl` | `pl` | :(far fa-square fa-fw): | :(far fa-square fa-fw): |
| 巴西葡萄牙语 | `pt-br` | `pt-BR` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | 巴西葡萄牙语 | `pt-br` | `pt-BR` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
| 意大利语 | `it` | `it` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | 意大利语 | `it` | `it` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
| 西班牙语 | `es` | `es` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
### 4.2 基本配置 ### 4.2 基本配置
@@ -1008,7 +1038,7 @@ defaultContentLanguage = "zh-cn"
* `lunr`: 简单, 无需同步 `index.json`, 没有 `contentLength` 的限制, 但占用带宽大且性能低 (特别是中文需要一个较大的分词依赖库) * `lunr`: 简单, 无需同步 `index.json`, 没有 `contentLength` 的限制, 但占用带宽大且性能低 (特别是中文需要一个较大的分词依赖库)
* `algolia`: 高性能并且占用带宽低, 但需要同步 `index.json` 且有 `contentLength` 的限制 * `algolia`: 高性能并且占用带宽低, 但需要同步 `index.json` 且有 `contentLength` 的限制
{{< version 0.2.3 >}} 文章内容被 `h2``h3` HTML 标签切分来提查询效果并且基本实现全文搜索. {{< version 0.2.3 >}} 文章内容被 `h2``h3` HTML 标签切分来提查询效果并且基本实现全文搜索.
`contentLength` 用来限制 `h2``h3` HTML 标签开头的内容部分的最大长度. `contentLength` 用来限制 `h2``h3` HTML 标签开头的内容部分的最大长度.
{{< /admonition >}} {{< /admonition >}}
@@ -24,6 +24,10 @@ lightgallery: true
{{< version 0.2.0 changed >}} {{< version 0.2.0 changed >}}
{{< admonition >}}
Hugo **extended** version is necessary for `style` shortcode.
{{< /admonition >}}
`style` is a shortcode to insert custom style in your post. `style` is a shortcode to insert custom style in your post.
The `style` shortcode has two positional parameters. The `style` shortcode has two positional parameters.
@@ -29,6 +29,10 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw
{{< version 0.2.0 changed >}} {{< version 0.2.0 changed >}}
{{< admonition >}}
Hugo **extended** version is necessary for `style` shortcode.
{{< /admonition >}}
`style` is a shortcode to insert custom style in your post. `style` is a shortcode to insert custom style in your post.
The `style` shortcode has two positional parameters. The `style` shortcode has two positional parameters.
@@ -27,6 +27,10 @@ mapbox:
{{< version 0.2.0 changed >}} {{< version 0.2.0 changed >}}
{{< admonition >}}
Hugo **extended** 版本对于 `style` shortcode 是必需的.
{{< /admonition >}}
`style` shortcode 用来在你的文章中插入自定义样式. `style` shortcode 用来在你的文章中插入自定义样式.
`style` shortcode 有两个位置参数. `style` shortcode 有两个位置参数.
+194
View File
@@ -0,0 +1,194 @@
# Translations for Spanish
# Traducciones para español
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# === baseof ==
[backToTop]
other = "Volver arriba"
[viewComments]
other = "Ver comentarios"
# === baseof ==
# === Post ===
[posts]
other = "Artículos"
# === Post ===
# === Taxonomy ===
[allSome]
other = "Todo %s"
[tag]
other = "Etiqueta"
[tags]
other = "Etiquetas"
[category]
other = "Categoría"
[categories]
other = "Categorías"
# === Taxonomy ===
# === Pagination ===
[more]
other = "Más"
# === Pagination ===
# === partials/header.html ===
[selectLanguage]
other = "Selecciona el lenguage"
[switchTheme]
other = "Cambia el tema"
# === partials/header.html ===
# === partials/footer.html ===
[poweredBySome]
other = "Provisto por %s"
[theme]
other = "Tema"
# === partials/footer.html ===
# === partials/comment.html ===
[valineLang]
other = "en"
[valinePlaceholder]
other = "Tu comentario ..."
[facebookLanguageCode]
other = "es_MX"
# === partials/comment.html ===
# === partials/assets.html ===
[search]
other = "Buscar"
[searchPlaceholder]
other = "Busca títulos o contenido..."
[clear]
other = "Limpiar"
[cancel]
other = "Cancelar"
[noResultsFound]
other = "No se encontraron resultados"
[lunrLanguageLib]
other = "lib/lunr/lunr.es.js"
[lunrLanguageCode]
other = "es"
[copyToClipboard]
other = "Copiar al portapapeles"
# === partials/assets.html ===
# === partials/plugin/share.html ===
[shareOn]
other = "Compartir en"
# === partials/plugin/share.html ===
# === posts/single.html ===
[contents]
other = "Contenido"
[publish]
other = "publicado el"
[included]
other = "incluido en"
[wordCount]
other = "unas {{ .Count }} palabras"
[readingTime]
other = "{{ .Count }} min"
[views]
other = "vistas"
[author]
other = "Autor"
[lastMod]
other = "El artículo fue actualizado el %s"
[license]
other = "Publicado bajo la licencia %s"
[seeMarkdown]
other = "Leer Markdown"
[back]
other = "Regresar"
[home]
other = "Inicio"
[readMore]
other = "Leer más"
# === posts/single.html ===
# === 404.html ===
[pageNotFound]
other = "Página no encontrada"
[pageNotFoundText]
other = "La página que estás buscando no existe. Lo siento."
# === 404.html ===
# === shortcodes/admonition.html ===
[note]
other = "Nota"
[abstract]
other = "Resumen"
[info]
other = "Información"
[tip]
other = "Consejo"
[success]
other = "Éxito"
[question]
other = "Pregunta"
[warning]
other = "Advertencia"
[failure]
other = "Fallo"
[danger]
other = "Peligro"
[bug]
other = "Error"
[example]
other = "Ejemplo"
[quote]
other = "Cita"
# === shortcodes/admonition.html ===
# === shortcodes/version.html ===
[new]
other = "NUEVO"
[changed]
other = "MODIFICADO"
[deleted]
other = "ELIMINADO"
# === shortcodes/version.html ===
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 43 KiB

+1 -1
View File
@@ -10,7 +10,7 @@
{{- end -}} {{- end -}}
{{- $params := .Params | merge .Site.Params.page -}} {{- $params := .Params | merge .Site.Params.page -}}
{{- .Scratch.Set "version" "0.2.4" -}} {{- .Scratch.Set "version" "0.2.5" -}}
{{- if eq hugo.Environment "production" -}} {{- if eq hugo.Environment "production" -}}
{{- .Scratch.Set "cdn" .Site.Params.cdn -}} {{- .Scratch.Set "cdn" .Site.Params.cdn -}}
+15 -21
View File
@@ -8,30 +8,30 @@
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- /* Search */ -}} {{- /* Search */ -}}
{{- if .Site.Params.search.enable -}} {{- if .Site.Params.search | and .Site.Params.search.enable -}}
{{- $search := .Site.Params.search -}}
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}} {{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $searchConfig := dict "noResultsFound" (T "noResultsFound") -}} {{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "noResultsFound") | dict "search" | merge $config -}}
{{- if eq .Site.Params.search.type "lunr" -}} {{- if eq $search.type "lunr" -}}
{{- with .Site.Home.OutputFormats.Get "json" -}} {{- with .Site.Home.OutputFormats.Get "json" -}}
{{- $searchConfig = dict "type" "lunr" "lunrIndexURL" .RelPermalink | merge $searchConfig -}} {{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}}
{{- end -}} {{- end -}}
{{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}} {{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- if ne .Language.Lang "en" -}} {{- if ne .Language.Lang "en" -}}
{{- $searchConfig = T "lunrLanguageCode" | dict "lunrLanguageCode" | merge $searchConfig -}} {{- $config = T "lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}}
{{- if eq .Language.Lang "zh-cn" -}} {{- if eq .Language.Lang "zh-cn" -}}
{{- $searchConfig = dict "lunrSegmentitURL" (resources.Get "lib/lunr/lunr.segmentit.js").RelPermalink | merge $searchConfig -}} {{- $config = dict "lunrSegmentitURL" (resources.Get "lib/lunr/lunr.segmentit.js").RelPermalink | dict "search" | merge $config -}}
{{- end -}} {{- end -}}
{{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}} {{- end -}}
{{- else if eq .Site.Params.search.type "algolia" -}} {{- else if eq $search.type "algolia" -}}
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}} {{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $searchConfig = dict "type" "algolia" "algoliaIndex" .Site.Params.search.algolia.index "algoliaAppID" .Site.Params.search.algolia.appID "algoliaSearchKey" .Site.Params.search.algolia.searchKey | merge $searchConfig -}} {{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
{{- end -}} {{- end -}}
{{- $config = dict "search" $searchConfig | merge $config -}}
{{- end -}} {{- end -}}
{{- /* lazysizes */ -}} {{- /* lazysizes */ -}}
@@ -59,8 +59,7 @@
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}} {{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $lightGalleryConfig := dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false -}} {{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}}
{{- $config = dict "lightGallery" $lightGalleryConfig | merge $config -}}
{{- $styleArr := (.Scratch.Get "this").styleArr | default slice -}} {{- $styleArr := (.Scratch.Get "this").styleArr | default slice -}}
{{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}} {{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}}
{{- end -}} {{- end -}}
@@ -83,24 +82,21 @@
{{- /* TypeIt */ -}} {{- /* TypeIt */ -}}
{{- with (.Scratch.Get "this").typeitMap -}} {{- with (.Scratch.Get "this").typeitMap -}}
{{- $typeit := $.Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}} {{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $typeitConfig := slice -}} {{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}}
{{- range $key, $val := . -}}
{{- $typeitConfig = $typeitConfig | append (slice $val) -}}
{{- end -}}
{{- $config = dict "typeit" $typeitConfig | merge $config -}}
{{- end -}} {{- end -}}
{{- /* KaTeX */ -}} {{- /* KaTeX */ -}}
{{- if $params.math.enable -}} {{- if $params.math.enable -}}
{{- $math := $params.math -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}} {{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}} {{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $math := $params.math -}}
{{- if $math.copyTex -}} {{- if $math.copyTex -}}
{{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}} {{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
@@ -111,7 +107,6 @@
{{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}} {{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}} {{- end -}}
{{- $mathConfig := dict "strict" false -}}
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}} {{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}} {{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
{{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}} {{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}}
@@ -120,8 +115,7 @@
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}} {{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
{{- $delimiters = $delimiters | append (dict "left" $math.inlineRightDelimiter "right" $math.inlineRightDelimiter "display" false) -}} {{- $delimiters = $delimiters | append (dict "left" $math.inlineRightDelimiter "right" $math.inlineRightDelimiter "display" false) -}}
{{- end -}} {{- end -}}
{{- $mathConfig = dict "delimiters" $delimiters | merge $mathConfig -}} {{- $config = dict "strict" false "delimiters" $delimiters | dict "math" | merge $config -}}
{{- $config = dict "math" $mathConfig | merge $config -}}
{{- end -}} {{- end -}}
{{- /* mermaid */ -}} {{- /* mermaid */ -}}
@@ -182,7 +176,7 @@
</script> </script>
{{- /* Polyfill.io */ -}} {{- /* Polyfill.io */ -}}
{{- dict "source" "https://polyfill.io/v3/polyfill.min.js?features=Element.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after%2CArray.prototype.fill%2CIntersectionObserver%2CArray.from%2CArray.prototype.find%2CMath.sign" | partial "plugin/script.html" -}} {{- dict "source" "https://polyfill.io/v3/polyfill.min.js?features=html5shiv%2CElement.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after%2CArray.prototype.fill%2CIntersectionObserver%2CArray.from%2CArray.prototype.find%2CMath.sign" | partial "plugin/script.html" -}}
{{- range (.Scratch.Get "this").script -}} {{- range (.Scratch.Get "this").script -}}
{{- partial "plugin/script.html" . -}} {{- partial "plugin/script.html" . -}}
+15 -1
View File
@@ -1,6 +1,6 @@
{{- $cdn := .Scratch.Get "cdn" | default dict -}} {{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $fingerprint := .Scratch.Get "fingerprint" -}} {{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- $comment := .Scratch.Get "comment" | default (dict "disqus" dict "gitalk" dict "valine" dict "facebook" dict "telegram" dict "commento" dict) -}} {{- $comment := .Scratch.Get "comment" | default (dict "disqus" dict "gitalk" dict "valine" dict "facebook" dict "telegram" dict "commento" dict "utterances" dict) -}}
{{- $commentConfig := dict -}} {{- $commentConfig := dict -}}
{{- if $comment.enable -}} {{- if $comment.enable -}}
@@ -107,6 +107,20 @@
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>. Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
</noscript> </noscript>
{{- end -}} {{- end -}}
{{- /* Utterances Comment System */ -}}
{{- if $comment.utterances.enable -}}
<div id="utterances"></div>
{{- $utterances := $comment.utterances -}}
{{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.lightTheme | default "github-light" | dict "lightTheme" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.darkTheme | default "github-dark" | dict "darkTheme" | dict "utterances" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">Utterances</a>.
</noscript>
{{- end -}}
</div> </div>
{{- end -}} {{- end -}}
+4 -6
View File
@@ -1,8 +1,6 @@
{{- /* ID */ -}} {{- /* ID */ -}}
{{- /* Content -> unique ID */ -}} {{- $count := (.scratch.Get "this").count | default 1 -}}
{{- /* shuffle md5 as id */ -}} {{- $id := printf "id-%d" $count -}}
{{- $id := delimit (split (md5 now.Unix) "" | shuffle | first 6) "" | printf "id-%s" -}} {{- $count | add 1 | .scratch.SetInMap "this" "count" -}}
{{- with .scratch -}} {{- dict $id .content | dict "data" | dict "config" | merge (.scratch.Get "this") | .scratch.Set "this" -}}
{{- dict $id $.content | dict "data" | dict "config" | merge (.Get "this") | .Set "this" -}}
{{- end -}}
{{- return $id -}} {{- return $id -}}
+19 -9
View File
@@ -10,7 +10,13 @@
{{- with .pre -}} {{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span> <span class="header-title-pre">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}
{{- .name -}} {{- if .typeit -}}
{{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
{{- .name -}}
{{- end -}}
{{- with .post -}} {{- with .post -}}
<span class="header-title-post">{{ . | safeHTML }}</span> <span class="header-title-post">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}
@@ -22,17 +28,17 @@
<div class="menu"> <div class="menu">
<div class="menu-inner"> <div class="menu-inner">
{{- range .Site.Menus.main -}} {{- range .Site.Menus.main -}}
{{- $url := "" -}} {{- $url := .URL | relLangURL -}}
{{- with .Page -}} {{- with .Page -}}
{{- $url = .RelPermalink -}} {{- $url = .RelPermalink -}}
{{- else -}}
{{- $url = .URL | relLangURL -}}
{{- end -}} {{- end -}}
<a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}> <a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}} {{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
</a> </a>
{{- end -}} {{- end -}}
<span class="menu-item delimiter"></span> {{- if .Site.Menus.main -}}
<span class="menu-item delimiter"></span>
{{- end -}}
{{- if .Site.IsMultiLingual -}} {{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}"> <a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}} {{- .Language.LanguageName -}}
@@ -88,7 +94,13 @@
{{- with .pre -}} {{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span> <span class="header-title-pre">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}
{{- .name -}} {{- if .typeit -}}
{{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
{{- .name -}}
{{- end -}}
{{- with .post -}} {{- with .post -}}
<span class="header-title-post">{{ . | safeHTML }}</span> <span class="header-title-post">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}
@@ -123,11 +135,9 @@
{{- end -}} {{- end -}}
{{- $currentPage := . -}} {{- $currentPage := . -}}
{{- range .Site.Menus.main -}} {{- range .Site.Menus.main -}}
{{- $url := "" -}} {{- $url := .URL | relLangURL -}}
{{- with .Page -}} {{- with .Page -}}
{{- $url = .RelPermalink -}} {{- $url = .RelPermalink -}}
{{- else -}}
{{- $url = .URL | relLangURL -}}
{{- end -}} {{- end -}}
<a class="menu-item" href="{{ $url }}" title="{{ .Title }}"{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}> <a class="menu-item" href="{{ $url }}" title="{{ .Title }}"{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
{{- .Pre | safeHTML }}{{ .Name }}{{ .Post | safeHTML -}} {{- .Pre | safeHTML }}{{ .Name }}{{ .Post | safeHTML -}}
+26 -10
View File
@@ -1,19 +1,35 @@
{{- $profile := .Site.Params.home.profile -}}
<div class="home-profile"> <div class="home-profile">
{{- $avatar := .Site.Params.home.profile.avatarURL -}} {{- $avatar := $profile.avatarURL -}}
{{- with .Site.Params.home.profile.gravatarEmail -}} {{- with $profile.gravatarEmail -}}
{{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}} {{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}}
{{- end -}} {{- end -}}
{{- with $avatar -}} {{- if $avatar -}}
<div class="home-avatar"> <div class="home-avatar">
<a href="/posts" title="{{ T `home` }}"> {{- $menus := $.Site.Menus.main | default slice -}}
{{- dict "src" . "alt" (T "home") | partial "plugin/image.html" -}} {{- with index $menus 0 -}}
</a> {{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
{{- dict "src" $avatar "alt" .Name | partial "plugin/image.html" -}}
</a>
{{- else -}}
{{- dict "src" $avatar | partial "plugin/image.html" -}}
{{- end -}}
</div> </div>
{{- end -}} {{- end -}}
{{- with .Site.Params.home.profile.subtitle -}} {{- with $profile.title -}}
<h1 class="home-title">
{{- . -}}
</h1>
{{- end -}}
{{- with $profile.subtitle -}}
<h2 class="home-subtitle"> <h2 class="home-subtitle">
{{- if $.Site.Params.home.profile.typeit -}} {{- if $profile.typeit -}}
{{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}} {{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}}
<div id="{{ $id }}" class="typeit"></div> <div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
@@ -23,7 +39,7 @@
</h2> </h2>
{{- end -}} {{- end -}}
{{- if .Site.Params.home.profile.social -}} {{- if $profile.social -}}
<div class="social-links"> <div class="social-links">
{{- $socialMap := resources.Get "data/social.yaml" | transform.Unmarshal -}} {{- $socialMap := resources.Get "data/social.yaml" | transform.Unmarshal -}}
{{- $socialArr := slice -}} {{- $socialArr := slice -}}
@@ -48,7 +64,7 @@
</div> </div>
{{- end -}} {{- end -}}
{{- with .Site.Params.home.profile.disclaimer -}} {{- with $profile.disclaimer -}}
<h3 class="home-disclaimer"> <h3 class="home-disclaimer">
{{- . | safeHTML -}} {{- . | safeHTML -}}
</h3> </h3>
+3 -3
View File
@@ -1,10 +1,10 @@
{{- $content := .Inner | .Page.RenderString -}} {{- $content := .Inner | .Page.RenderString -}}
{{- $id := dict "content" $content | partial "function/id.html" -}} {{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $tag := .Get 1 | default "div" -}} {{- $tag := .Get 1 | default "div" -}}
{{- printf `<%s id="%s">%s</%s>` $tag $id $content $tag | safeHTML -}} {{- printf `<%s id="%s">%s</%s>` $tag $id $content $tag | safeHTML -}}
{{- $style := .Get 0 | printf "#%s{%s}" $id -}} {{- $style := .Get 0 | printf "#%s{%s}" $id -}}
{{- $res := resources.FromString (printf "temp/%s.scss" $id) $style -}} {{- $res := resources.FromString (printf "stype/%s.scss" $id) $style -}}
{{- $res = $res | toCSS (dict "targetPath" (printf "temp/%s.css" $id)) -}} {{- $res = $res | toCSS (dict "targetPath" (printf "stype/%s.css" $id)) -}}
{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}} {{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}}
{{- $styleArr | append $res.Content | .Page.Scratch.SetInMap "this" "styleArr" -}} {{- $styleArr | append $res.Content | .Page.Scratch.SetInMap "this" "styleArr" -}}
+1
View File
@@ -22,6 +22,7 @@
"build": "npm run babel && hugo -v --source=exampleSite --themesDir ../.. --gc", "build": "npm run babel && hugo -v --source=exampleSite --themesDir ../.. --gc",
"build-lunr-segmentit": "browserify src/lib/lunr.segmentit.js -o assets/lib/lunr/lunr.segmentit.js -t babelify --presets @babel/preset-env --presets minify", "build-lunr-segmentit": "browserify src/lib/lunr.segmentit.js -o assets/lib/lunr/lunr.segmentit.js -t babelify --presets @babel/preset-env --presets minify",
"start": "npm run babel && hugo server --source=exampleSite --themesDir ../.. -D --disableFastRender", "start": "npm run babel && hugo server --source=exampleSite --themesDir ../.. -D --disableFastRender",
"start-production": "npm run babel && hugo server --source=exampleSite --themesDir ../.. -D --disableFastRender -e production",
"check": "htmlproofer exampleSite/public --check-html --allow-hash-href --empty-alt-ignore --disable-external", "check": "htmlproofer exampleSite/public --check-html --allow-hash-href --empty-alt-ignore --disable-external",
"copy": "rm -rf resources && cp -rf exampleSite/resources resources" "copy": "rm -rf resources && cp -rf exampleSite/resources resources"
}, },
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
#id-1 img {
height: 1.25rem; }
@@ -0,0 +1 @@
{"Target":"stype/id-1.css","MediaType":"text/css","Data":{}}
+72 -37
View File
@@ -94,17 +94,19 @@ class Theme {
initSearch() { initSearch() {
const searchConfig = this.config.search; const searchConfig = this.config.search;
if (!searchConfig.maxResultLength) searchConfig.maxResultLength = 10;
if (!searchConfig.snippetLength) searchConfig.snippetLength = 50;
if (!searchConfig.highlightTag) searchConfig.highlightTag = 'em';
const isMobile = this.util.isMobile(); const isMobile = this.util.isMobile();
if (!searchConfig || isMobile && this._searchMobileOnce || !isMobile && this._searchDesktopOnce) return; if (!searchConfig || isMobile && this._searchMobileOnce || !isMobile && this._searchDesktopOnce) return;
const classSuffix = isMobile ? 'mobile' : 'desktop';
const $header = document.getElementById(`header-${classSuffix}`); const maxResultLength = searchConfig.maxResultLength ? searchConfig.maxResultLength : 10;
const $searchInput = document.getElementById(`search-input-${classSuffix}`); const snippetLength = searchConfig.snippetLength ? searchConfig.snippetLength : 50;
const $searchToggle = document.getElementById(`search-toggle-${classSuffix}`); const highlightTag = searchConfig.highlightTag ? searchConfig.highlightTag : 'em';
const $searchLoading = document.getElementById(`search-loading-${classSuffix}`);
const $searchClear = document.getElementById(`search-clear-${classSuffix}`); const suffix = isMobile ? 'mobile' : 'desktop';
const $header = document.getElementById(`header-${suffix}`);
const $searchInput = document.getElementById(`search-input-${suffix}`);
const $searchToggle = document.getElementById(`search-toggle-${suffix}`);
const $searchLoading = document.getElementById(`search-loading-${suffix}`);
const $searchClear = document.getElementById(`search-clear-${suffix}`);
if (isMobile) { if (isMobile) {
this._searchMobileOnce = true; this._searchMobileOnce = true;
$searchInput.addEventListener('focus', () => { $searchInput.addEventListener('focus', () => {
@@ -156,10 +158,10 @@ class Theme {
}, false); }, false);
const initAutosearch = () => { const initAutosearch = () => {
const autosearch = autocomplete(`#search-input-${classSuffix}`, { const autosearch = autocomplete(`#search-input-${suffix}`, {
hint: false, hint: false,
autoselect: true, autoselect: true,
dropdownMenuContainer: `#search-dropdown-${classSuffix}`, dropdownMenuContainer: `#search-dropdown-${suffix}`,
clearOnSelected: true, clearOnSelected: true,
cssClasses: { noPrefix: true }, cssClasses: { noPrefix: true },
debug: true, debug: true,
@@ -188,16 +190,16 @@ class Theme {
if (matchPosition < position || position === 0) position = matchPosition; if (matchPosition < position || position === 0) position = matchPosition;
} }
}); });
position -= searchConfig.snippetLength / 5; position -= snippetLength / 5;
if (position > 0) { if (position > 0) {
position += context.substr(position, 20).lastIndexOf(' ') + 1; position += context.substr(position, 20).lastIndexOf(' ') + 1;
context = '...' + context.substr(position, searchConfig.snippetLength); context = '...' + context.substr(position, snippetLength);
} else { } else {
context = context.substr(0, searchConfig.snippetLength); context = context.substr(0, snippetLength);
} }
Object.keys(metadata).forEach(key => { Object.keys(metadata).forEach(key => {
title = title.replace(new RegExp(`(${key})`, 'gi'), `<${searchConfig.highlightTag}>$1</${searchConfig.highlightTag}>`); title = title.replace(new RegExp(`(${key})`, 'gi'), `<${highlightTag}>$1</${highlightTag}>`);
context = context.replace(new RegExp(`(${key})`, 'gi'), `<${searchConfig.highlightTag}>$1</${searchConfig.highlightTag}>`); context = context.replace(new RegExp(`(${key})`, 'gi'), `<${highlightTag}>$1</${highlightTag}>`);
}); });
results[uri] = { results[uri] = {
'uri': uri, 'uri': uri,
@@ -206,7 +208,7 @@ class Theme {
'context' : context, 'context' : context,
}; };
}); });
return Object.values(results).slice(0, searchConfig.maxResultLength); return Object.values(results).slice(0, maxResultLength);
} }
if (!this._index) { if (!this._index) {
fetch(searchConfig.lunrIndexURL) fetch(searchConfig.lunrIndexURL)
@@ -238,11 +240,11 @@ class Theme {
this._algoliaIndex this._algoliaIndex
.search(query, { .search(query, {
offset: 0, offset: 0,
length: searchConfig.maxResultLength * 8, length: maxResultLength * 8,
attributesToHighlight: ['title'], attributesToHighlight: ['title'],
attributesToSnippet: [`content:${searchConfig.snippetLength}`], attributesToSnippet: [`content:${snippetLength}`],
highlightPreTag: `<${searchConfig.highlightTag}>`, highlightPreTag: `<${highlightTag}>`,
highlightPostTag: `</${searchConfig.highlightTag}>`, highlightPostTag: `</${highlightTag}>`,
}) })
.then(({ hits }) => { .then(({ hits }) => {
const results = {}; const results = {};
@@ -255,7 +257,7 @@ class Theme {
context: content.value, context: content.value,
}; };
}); });
finish(Object.values(results).slice(0, searchConfig.maxResultLength)); finish(Object.values(results).slice(0, maxResultLength));
}) })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
@@ -279,7 +281,7 @@ class Theme {
return `<div class="search-footer">Search by <a href="${href}" rel="noopener noreffer" target="_blank">${icon} ${searchType}</a></div>`;}, return `<div class="search-footer">Search by <a href="${href}" rel="noopener noreffer" target="_blank">${icon} ${searchType}</a></div>`;},
}, },
}); });
autosearch.on('autocomplete:selected', (event, suggestion, dataset, context) => { autosearch.on('autocomplete:selected', (_event, suggestion, _dataset, _context) => {
window.location.assign(suggestion.uri); window.location.assign(suggestion.uri);
}); });
if (isMobile) this._searchMobile = autosearch; if (isMobile) this._searchMobile = autosearch;
@@ -364,7 +366,7 @@ class Theme {
$copy.setAttribute('data-clipboard-text', code); $copy.setAttribute('data-clipboard-text', code);
$copy.title = this.config.code.copyTitle; $copy.title = this.config.code.copyTitle;
const clipboard = new ClipboardJS($copy); const clipboard = new ClipboardJS($copy);
clipboard.on('success', e => { clipboard.on('success', _e => {
this.util.animateCSS($code, 'flash'); this.util.animateCSS($code, 'flash');
}); });
$header.appendChild($copy); $header.appendChild($copy);
@@ -556,18 +558,27 @@ class Theme {
initTypeit() { initTypeit() {
if (this.config.typeit) { if (this.config.typeit) {
this.config.typeit.forEach(group => { const typeitConfig = this.config.typeit;
const speed = typeitConfig.speed ? typeitConfig.speed : 100;
const cursorSpeed = typeitConfig.cursorSpeed ? typeitConfig.cursorSpeed : 1000;
const cursorChar = typeitConfig.cursorChar ? typeitConfig.cursorChar : '|';
Object.values(typeitConfig.data).forEach(group => {
const typeone = (i) => { const typeone = (i) => {
const id = group[i]; const id = group[i];
if (i === group.length - 1) { const instance = new TypeIt(`#${id}`, {
new TypeIt(`#${id}`, {
strings: this.data[id],
}).go();
return;
}
let instance = new TypeIt(`#${id}`, {
strings: this.data[id], strings: this.data[id],
speed: speed,
lifeLike: true,
cursorSpeed: cursorSpeed,
cursorChar: cursorChar,
waitUntilVisible: true,
afterComplete: () => { afterComplete: () => {
if (i === group.length - 1) {
if (typeitConfig.duration >= 0) window.setTimeout(() => {
instance.destroy();
}, typeitConfig.duration);
return;
}
instance.destroy(); instance.destroy();
typeone(i + 1); typeone(i + 1);
}, },
@@ -579,12 +590,36 @@ class Theme {
} }
initComment() { initComment() {
if (this.config.comment && this.config.comment.gitalk) { if (this.config.comment) {
this.config.comment.gitalk.body = decodeURI(window.location.href); if (this.config.comment.gitalk) {
const gitalk = new Gitalk(this.config.comment.gitalk.body); this.config.comment.gitalk.body = decodeURI(window.location.href);
gitalk.render('gitalk'); const gitalk = new Gitalk(this.config.comment.gitalk.body);
gitalk.render('gitalk');
}
if (this.config.comment.valine) new Valine(this.config.comment.valine);
if (this.config.comment.utterances) {
const utterancesConfig = this.config.comment.utterances;
const script = document.createElement('script');
script.src = 'https://utteranc.es/client.js';
script.type = 'text/javascript';
script.setAttribute('repo', utterancesConfig.repo);
script.setAttribute('issue-term', utterancesConfig.issueTerm);
if (utterancesConfig.label) script.setAttribute('label', utterancesConfig.label);
script.setAttribute('theme', this.isDark ? utterancesConfig.darkTheme : utterancesConfig.lightTheme);
script.crossOrigin = 'anonymous';
script.async = true;
document.getElementById('utterances').appendChild(script);
this._utterancesOnSwitchTheme = this._utterancesOnSwitchTheme || (() => {
const message = {
type: 'set-theme',
theme: this.isDark ? utterancesConfig.darkTheme : utterancesConfig.lightTheme,
};
const iframe = document.querySelector('.utterances-frame');
iframe.contentWindow.postMessage(message, 'https://utteranc.es');
});
this.switchThemeEventSet.add(this._utterancesOnSwitchTheme);
}
} }
if (this.config.comment && this.config.comment.valine) new Valine(this.config.comment.valine);
} }
initSmoothScroll() { initSmoothScroll() {
+1 -1
View File
@@ -5,7 +5,7 @@ name = "LoveIt"
license = "MIT" license = "MIT"
licenselink = "https://github.com/dillonzq/LoveIt/blob/master/LICENSE" licenselink = "https://github.com/dillonzq/LoveIt/blob/master/LICENSE"
description = "A Clean, Elegant but Advanced Hugo Theme for Hugo." description = "A Clean, Elegant but Advanced Hugo Theme for Hugo."
homepage = "https://hugo-loveit-en.netlify.com" homepage = "https://hugoloveit.com"
tags = [ tags = [
"blog", "blog",
"clean", "clean",