1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-03-21 14:28:51 +01:00

Merge pull request from dillonzq/develop

This commit is contained in:
Dillon 2020-05-05 10:32:44 +08:00 committed by GitHub
commit 01bd6e8c95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 536 additions and 134 deletions

1
.gitignore vendored
View file

@ -1,7 +1,6 @@
# Hugo default output directory
public/
/exampleSite/resources/
/resources/_gen/assets/scss/temp
node_modules/
build/

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/).
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,
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/)
* **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* **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
@ -131,6 +132,7 @@ LoveIt supports the following languages:
* Polish
* Brazilian Portuguese
* Italian
* Spanish
* [Contribute with a new language](https://github.com/dillonzq/LoveIt/pulls)
[Languages Compatibility](https://hugoloveit.com/theme-documentation-basics/#language-compatibility)

View file

@ -9,7 +9,7 @@
> [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),以便你能选择最适合你的一个。
@ -85,6 +85,7 @@
* 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统
* 支持 **[Telegram comments](https://comments.app/) 评论**系统
* 支持 **[Commento](https://commento.io/)** 评论系统
* 支持 **[Utterances](https://utteranc.es/)** 评论系统
### 扩展功能
@ -126,6 +127,7 @@ LoveIt 支持下列语言:
* 波兰语
* 巴西葡萄牙语
* 意大利语
* 西班牙语
* [贡献一种新的语言](https://github.com/dillonzq/LoveIt/pulls)
[语言兼容性](https://hugoloveit.com/zh-cn/theme-documentation-basics/#language-compatibility)

View file

@ -2,15 +2,14 @@
.wrapper {
display: flex;
flex-direction: column;
min-height: 97.5vh;
min-height: 100vh;
width: 100%;
main {
flex: 1 0 auto;
.container {
padding-left: 1rem;
padding-right: 1rem;
padding: 0 1rem;
}
}
}

View file

@ -17,16 +17,21 @@
@include border-radius(100%);
@include box-shadow(0 0 0 .3618em rgba(0, 0, 0, .05));
@include transition(all 0.4s ease);
cursor: pointer;
&:hover {
position: relative;
@include transform(translateY(-.75rem));
cursor: pointer;
}
}
}
.home-title {
font-size: 1.2rem;
font-weight: bold;
margin: 0;
padding: .4rem;
}
.home-subtitle {
font-size: 1rem;
font-weight: normal;

View file

@ -2,8 +2,8 @@ footer {
height: 2rem;
width: 100%;
text-align: center;
line-height: 1.5rem;
padding-top: 2rem;
line-height: 1.25rem;
padding: 1rem 0;
.footer-container {
font-size: .875rem;

View file

@ -1,3 +1,3 @@
.comment {
#comments {
padding: 4rem 0;
}

View file

@ -371,4 +371,4 @@ $admonition-background-color-map: (
) !default;
// ========== Admonition ========== //
$MAX_LENGTH: 9999px;
$MAX_LENGTH: 12000px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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
clipboard.js@2.0.6 https://github.com/zenorocha/clipboard.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/
mermaid@8.5.0 https://github.com/knsv/mermaid
echarts@4.7.0 https://echarts.apache.org/

File diff suppressed because one or more lines are too long

View file

@ -142,6 +142,8 @@ enableEmoji = true
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# title shown in home page
title = ""
# subtitle shown in home page
subtitle = "A Clean, Elegant but Advanced Hugo Theme"
# whether to use typeit animation for subtitle
@ -340,6 +342,8 @@ enableEmoji = true
gravatarEmail = ""
# 主页显示头像的 URL
avatarURL = "/images/avatar.png"
# 主页显示的网站标题
title = ""
# 主页显示的网站副标题
subtitle = "一个简洁、优雅且高效的 Hugo 主题"
# 是否为副标题显示打字机动画
@ -534,6 +538,8 @@ enableEmoji = true
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# title shown in home page
title = ""
# subtitle shown in home page
subtitle = "Un thème Hugo simple, élégant et efficace"
# 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
# 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标
post = ""
# whether to use typeit animation for title name
# 是否为标题显示打字机动画
typeit = false
# Footer config
# 页面底部信息配置
@ -883,10 +892,20 @@ enableEmoji = true
colorful = true
dislikes = false
outlined = false
# Commento comments config (https://commento.io/)
# Commento comments 评论系统设置 (https://commento.io/)
# Commento comment config (https://commento.io/)
# Commento comment 评论系统设置 (https://commento.io/)
[params.page.comment.commento]
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 配置
[params.page.seo]
@ -911,6 +930,22 @@ enableEmoji = true
width = 800
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
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification]
@ -977,7 +1012,7 @@ enableEmoji = true
clipboardJS = ""
# sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js
sharerJS = ""
# typeit@6.5.1 https://github.com/alexmacarthur/typeit
# typeit@7.0.4 https://github.com/alexmacarthur/typeit
typeitJS = ""
# katex@0.11.1 https://katex.org/
katexCSS = ""

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).
>
> 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")
@ -56,7 +56,8 @@ math:
* :(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/)
* :(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

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).
>
> 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")
@ -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-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-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

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/) 博客主题。
>
> 它的原型基于 [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")
@ -57,6 +57,7 @@ math:
* :(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-dots fa-fw): 支持 **[Commento](https://commento.io/)** 评论系统
* :(far fa-comment-alt fa-fw): 支持 **[Utterances](https://utteranc.es/)** 评论系统
#### 扩展功能

View file

@ -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.
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?" >}}
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 note "Why need the Hugo extended version?" >}}
Since the theme processes SCSS to CSS, Hugo needs to be the **extended** version.
{{< admonition tip "Hugo extended version is recommended" >}}
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 >}}
## 2 Installation
@ -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 = ""
# {{< version 0.2.5 >}} whether to use typeit animation for title name
typeit = false
# Footer config
[params.footer]
@ -302,6 +304,8 @@ Please open the code block below to view the complete sample configuration :(far
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# {{< version 0.2.5 >}} title shown in home page
title = ""
# subtitle shown in home page
subtitle = "This is My New Hugo Site"
# 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
# special amount of posts in each home posts page
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
# 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
[params.page.comment.commento]
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
[params.page.seo]
# Publisher info
@ -548,6 +562,17 @@ Please open the code block below to view the complete sample configuration :(far
width = 800
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
[params.verification]
google = ""
@ -608,7 +633,7 @@ Please open the code block below to view the complete sample configuration :(far
clipboardJS = ""
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0
sharerJS = ""
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@7.0.4
typeitJS = ""
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
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): |
| 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): |
| Spanish | `es` | `es` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
### 4.2 Basic Configuration

View file

@ -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.
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?" >}}
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 note "Why need the Hugo extended version?" >}}
Since the theme processes SCSS to CSS, Hugo needs to be the **extended** version.
{{< admonition tip "Hugo extended version is recommended" >}}
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 >}}
## 2 Installation
@ -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 = ""
# {{< version 0.2.5 >}} whether to use typeit animation for title name
typeit = false
# Footer config
[params.footer]
@ -307,6 +309,8 @@ Please open the code block below to view the complete sample configuration :(far
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# {{< version 0.2.5 >}} title shown in home page
title = ""
# subtitle shown in home page
subtitle = "This is My New Hugo Site"
# 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
# special amount of posts in each home posts page
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
# 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
[params.page.comment.commento]
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
[params.page.seo]
# Publisher info
@ -553,6 +567,17 @@ Please open the code block below to view the complete sample configuration :(far
width = 800
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
[params.verification]
google = ""
@ -613,7 +638,7 @@ Please open the code block below to view the complete sample configuration :(far
clipboardJS = ""
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0
sharerJS = ""
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@7.0.4
typeitJS = ""
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
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): |
| 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): |
| Spanish | `es` | `es` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
### 4.2 Basic Configuration

View file

@ -26,7 +26,7 @@ toc:
由于 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?" >}}
由于 [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** 版本是必要的.
{{< /admonition >}}
{{< admonition tip "推荐使用 Hugo extended 版本" >}}
由于这个主题的一些特性需要将 :(fab fa-sass fa-fw): SCSS 转换为 :(fab fa-css3 fa-fw): CSS, 推荐使用 Hugo **extended** 版本来获得更好的使用体验.
{{< /admonition >}}
## 2 安装
以下步骤可帮助你初始化新网站. 如果你根本不了解 Hugo, 我们强烈建议你按照此 [快速入门文档](https://gohugo.io/getting-started/quick-start/) 进一步了解它.
@ -257,6 +261,8 @@ hugo
pre = ""
# 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标
post = ""
# {{< version 0.2.5 >}} 是否为标题显示打字机动画
typeit = false
# 页面底部信息配置
[params.footer]
@ -305,6 +311,8 @@ hugo
gravatarEmail = ""
# 主页显示头像的 URL
avatarURL = "/images/avatar.png"
# {{< version 0.2.5 >}} 主页显示的网站标题
title = ""
# 主页显示的网站副标题
subtitle = "这是我的全新 Hugo 网站"
# 是否为副标题显示打字机动画
@ -318,7 +326,8 @@ hugo
enable = true
# 主页每页显示文章数量
paginate = 6
# {{< version 0.2.0 deleted >}} 当你没有在文章前置参数中设置 "hiddenFromHomePage" 时的默认行为
# {{< version 0.2.0 deleted >}} 被 params.page 中的 hiddenFromHomePage 替代
# 当你没有在文章前置参数中设置 "hiddenFromHomePage" 时的默认行为
defaultHiddenFromHomePage = false
# 作者的社交信息设置
@ -531,6 +540,15 @@ hugo
# {{< version 0.2.0 >}} {{< link "https://commento.io/" "Commento" >}} 评论系统设置
[params.page.comment.commento]
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
[params.page.seo]
# 出版者信息
@ -551,6 +569,17 @@ hugo
width = 800
height = 600
# {{< version 0.2.5 >}} TypeIt 配置
[params.typeit]
# 每一步的打字速度 (单位是毫秒)
speed = 100
# 光标的闪烁速度 (单位是毫秒)
cursorSpeed = 1000
# 光标的字符 (支持 HTML 格式)
cursorChar = "|"
# 打字结束之后光标的持续时间 (单位是毫秒, "-1" 代表无限大)
duration = -1
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification]
google = ""
@ -611,7 +640,7 @@ hugo
clipboardJS = ""
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0
sharerJS = ""
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@7.0.4
typeitJS = ""
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
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): |
| 巴西葡萄牙语 | `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): |
| 西班牙语 | `es` | `es` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): |
### 4.2 基本配置
@ -1008,7 +1038,7 @@ defaultContentLanguage = "zh-cn"
* `lunr`: 简单, 无需同步 `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 标签开头的内容部分的最大长度.
{{< /admonition >}}

View file

@ -24,6 +24,10 @@ lightgallery: true
{{< 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.
The `style` shortcode has two positional parameters.

View file

@ -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 >}}
{{< admonition >}}
Hugo **extended** version is necessary for `style` shortcode.
{{< /admonition >}}
`style` is a shortcode to insert custom style in your post.
The `style` shortcode has two positional parameters.

View file

@ -27,6 +27,10 @@ mapbox:
{{< version 0.2.0 changed >}}
{{< admonition >}}
Hugo **extended** 版本对于 `style` shortcode 是必需的.
{{< /admonition >}}
`style` shortcode 用来在你的文章中插入自定义样式.
`style` shortcode 有两个位置参数.

194
i18n/es.toml Normal file
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 ===

Binary file not shown.

Before

(image error) Size: 124 KiB

After

(image error) Size: 43 KiB

View file

@ -10,7 +10,7 @@
{{- end -}}
{{- $params := .Params | merge .Site.Params.page -}}
{{- .Scratch.Set "version" "0.2.4" -}}
{{- .Scratch.Set "version" "0.2.5" -}}
{{- if eq hugo.Environment "production" -}}
{{- .Scratch.Set "cdn" .Site.Params.cdn -}}

View file

@ -8,30 +8,30 @@
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- /* 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" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $searchConfig := dict "noResultsFound" (T "noResultsFound") -}}
{{- if eq .Site.Params.search.type "lunr" -}}
{{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "noResultsFound") | dict "search" | merge $config -}}
{{- if eq $search.type "lunr" -}}
{{- 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 -}}
{{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- 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" -}}
{{- $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 -}}
{{- 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" -}}
{{- 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" -}}
{{- 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 -}}
{{- $config = dict "search" $searchConfig | merge $config -}}
{{- end -}}
{{- /* lazysizes */ -}}
@ -59,8 +59,7 @@
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}}
{{- 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 "lightGallery" $lightGalleryConfig | merge $config -}}
{{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}}
{{- $styleArr := (.Scratch.Get "this").styleArr | default slice -}}
{{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}}
{{- end -}}
@ -83,24 +82,21 @@
{{- /* TypeIt */ -}}
{{- with (.Scratch.Get "this").typeitMap -}}
{{- $typeit := $.Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $typeitConfig := slice -}}
{{- range $key, $val := . -}}
{{- $typeitConfig = $typeitConfig | append (slice $val) -}}
{{- end -}}
{{- $config = dict "typeit" $typeitConfig | merge $config -}}
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}}
{{- end -}}
{{- /* KaTeX */ -}}
{{- if $params.math.enable -}}
{{- $math := $params.math -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- $math := $params.math -}}
{{- if $math.copyTex -}}
{{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}}
{{- 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" -}}
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- $mathConfig := dict "strict" false -}}
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
{{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}}
@ -120,8 +115,7 @@
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
{{- $delimiters = $delimiters | append (dict "left" $math.inlineRightDelimiter "right" $math.inlineRightDelimiter "display" false) -}}
{{- end -}}
{{- $mathConfig = dict "delimiters" $delimiters | merge $mathConfig -}}
{{- $config = dict "math" $mathConfig | merge $config -}}
{{- $config = dict "strict" false "delimiters" $delimiters | dict "math" | merge $config -}}
{{- end -}}
{{- /* mermaid */ -}}
@ -182,7 +176,7 @@
</script>
{{- /* 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 -}}
{{- partial "plugin/script.html" . -}}

View file

@ -1,6 +1,6 @@
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $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 -}}
{{- if $comment.enable -}}
@ -107,6 +107,20 @@
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
</noscript>
{{- 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>
{{- end -}}

View file

@ -1,8 +1,6 @@
{{- /* ID */ -}}
{{- /* Content -> unique ID */ -}}
{{- /* shuffle md5 as id */ -}}
{{- $id := delimit (split (md5 now.Unix) "" | shuffle | first 6) "" | printf "id-%s" -}}
{{- with .scratch -}}
{{- dict $id $.content | dict "data" | dict "config" | merge (.Get "this") | .Set "this" -}}
{{- end -}}
{{- $count := (.scratch.Get "this").count | default 1 -}}
{{- $id := printf "id-%d" $count -}}
{{- $count | add 1 | .scratch.SetInMap "this" "count" -}}
{{- dict $id .content | dict "data" | dict "config" | merge (.scratch.Get "this") | .scratch.Set "this" -}}
{{- return $id -}}

View file

@ -10,7 +10,13 @@
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
{{- 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 -}}
<span class="header-title-post">{{ . | safeHTML }}</span>
{{- end -}}
@ -22,17 +28,17 @@
<div class="menu">
<div class="menu-inner">
{{- range .Site.Menus.main -}}
{{- $url := "" -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- else -}}
{{- $url = .URL | relLangURL -}}
{{- 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 -}}
</a>
{{- end -}}
<span class="menu-item delimiter"></span>
{{- if .Site.Menus.main -}}
<span class="menu-item delimiter"></span>
{{- end -}}
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
@ -88,7 +94,13 @@
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
{{- 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 -}}
<span class="header-title-post">{{ . | safeHTML }}</span>
{{- end -}}
@ -123,11 +135,9 @@
{{- end -}}
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
{{- $url := "" -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- else -}}
{{- $url = .URL | relLangURL -}}
{{- 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 -}}

View file

@ -1,19 +1,35 @@
{{- $profile := .Site.Params.home.profile -}}
<div class="home-profile">
{{- $avatar := .Site.Params.home.profile.avatarURL -}}
{{- with .Site.Params.home.profile.gravatarEmail -}}
{{- $avatar := $profile.avatarURL -}}
{{- with $profile.gravatarEmail -}}
{{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}}
{{- end -}}
{{- with $avatar -}}
{{- if $avatar -}}
<div class="home-avatar">
<a href="/posts" title="{{ T `home` }}">
{{- dict "src" . "alt" (T "home") | partial "plugin/image.html" -}}
</a>
{{- $menus := $.Site.Menus.main | default slice -}}
{{- with index $menus 0 -}}
{{- $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>
{{- end -}}
{{- with .Site.Params.home.profile.subtitle -}}
{{- with $profile.title -}}
<h1 class="home-title">
{{- . -}}
</h1>
{{- end -}}
{{- with $profile.subtitle -}}
<h2 class="home-subtitle">
{{- if $.Site.Params.home.profile.typeit -}}
{{- if $profile.typeit -}}
{{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}}
<div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
@ -23,7 +39,7 @@
</h2>
{{- end -}}
{{- if .Site.Params.home.profile.social -}}
{{- if $profile.social -}}
<div class="social-links">
{{- $socialMap := resources.Get "data/social.yaml" | transform.Unmarshal -}}
{{- $socialArr := slice -}}
@ -48,7 +64,7 @@
</div>
{{- end -}}
{{- with .Site.Params.home.profile.disclaimer -}}
{{- with $profile.disclaimer -}}
<h3 class="home-disclaimer">
{{- . | safeHTML -}}
</h3>

View file

@ -1,10 +1,10 @@
{{- $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" -}}
{{- printf `<%s id="%s">%s</%s>` $tag $id $content $tag | safeHTML -}}
{{- $style := .Get 0 | printf "#%s{%s}" $id -}}
{{- $res := resources.FromString (printf "temp/%s.scss" $id) $style -}}
{{- $res = $res | toCSS (dict "targetPath" (printf "temp/%s.css" $id)) -}}
{{- $res := resources.FromString (printf "stype/%s.scss" $id) $style -}}
{{- $res = $res | toCSS (dict "targetPath" (printf "stype/%s.css" $id)) -}}
{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}}
{{- $styleArr | append $res.Content | .Page.Scratch.SetInMap "this" "styleArr" -}}

View file

@ -22,6 +22,7 @@
"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",
"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",
"copy": "rm -rf resources && cp -rf exampleSite/resources resources"
},

View file

@ -0,0 +1,2 @@
#id-1 img {
height: 1.25rem; }

View file

@ -0,0 +1 @@
{"Target":"stype/id-1.css","MediaType":"text/css","Data":{}}

View file

@ -94,17 +94,19 @@ class Theme {
initSearch() {
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();
if (!searchConfig || isMobile && this._searchMobileOnce || !isMobile && this._searchDesktopOnce) return;
const classSuffix = isMobile ? 'mobile' : 'desktop';
const $header = document.getElementById(`header-${classSuffix}`);
const $searchInput = document.getElementById(`search-input-${classSuffix}`);
const $searchToggle = document.getElementById(`search-toggle-${classSuffix}`);
const $searchLoading = document.getElementById(`search-loading-${classSuffix}`);
const $searchClear = document.getElementById(`search-clear-${classSuffix}`);
const maxResultLength = searchConfig.maxResultLength ? searchConfig.maxResultLength : 10;
const snippetLength = searchConfig.snippetLength ? searchConfig.snippetLength : 50;
const highlightTag = searchConfig.highlightTag ? searchConfig.highlightTag : 'em';
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) {
this._searchMobileOnce = true;
$searchInput.addEventListener('focus', () => {
@ -156,10 +158,10 @@ class Theme {
}, false);
const initAutosearch = () => {
const autosearch = autocomplete(`#search-input-${classSuffix}`, {
const autosearch = autocomplete(`#search-input-${suffix}`, {
hint: false,
autoselect: true,
dropdownMenuContainer: `#search-dropdown-${classSuffix}`,
dropdownMenuContainer: `#search-dropdown-${suffix}`,
clearOnSelected: true,
cssClasses: { noPrefix: true },
debug: true,
@ -188,16 +190,16 @@ class Theme {
if (matchPosition < position || position === 0) position = matchPosition;
}
});
position -= searchConfig.snippetLength / 5;
position -= snippetLength / 5;
if (position > 0) {
position += context.substr(position, 20).lastIndexOf(' ') + 1;
context = '...' + context.substr(position, searchConfig.snippetLength);
context = '...' + context.substr(position, snippetLength);
} else {
context = context.substr(0, searchConfig.snippetLength);
context = context.substr(0, snippetLength);
}
Object.keys(metadata).forEach(key => {
title = title.replace(new RegExp(`(${key})`, 'gi'), `<${searchConfig.highlightTag}>$1</${searchConfig.highlightTag}>`);
context = context.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'), `<${highlightTag}>$1</${highlightTag}>`);
});
results[uri] = {
'uri': uri,
@ -206,7 +208,7 @@ class Theme {
'context' : context,
};
});
return Object.values(results).slice(0, searchConfig.maxResultLength);
return Object.values(results).slice(0, maxResultLength);
}
if (!this._index) {
fetch(searchConfig.lunrIndexURL)
@ -238,11 +240,11 @@ class Theme {
this._algoliaIndex
.search(query, {
offset: 0,
length: searchConfig.maxResultLength * 8,
length: maxResultLength * 8,
attributesToHighlight: ['title'],
attributesToSnippet: [`content:${searchConfig.snippetLength}`],
highlightPreTag: `<${searchConfig.highlightTag}>`,
highlightPostTag: `</${searchConfig.highlightTag}>`,
attributesToSnippet: [`content:${snippetLength}`],
highlightPreTag: `<${highlightTag}>`,
highlightPostTag: `</${highlightTag}>`,
})
.then(({ hits }) => {
const results = {};
@ -255,7 +257,7 @@ class Theme {
context: content.value,
};
});
finish(Object.values(results).slice(0, searchConfig.maxResultLength));
finish(Object.values(results).slice(0, maxResultLength));
})
.catch(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>`;},
},
});
autosearch.on('autocomplete:selected', (event, suggestion, dataset, context) => {
autosearch.on('autocomplete:selected', (_event, suggestion, _dataset, _context) => {
window.location.assign(suggestion.uri);
});
if (isMobile) this._searchMobile = autosearch;
@ -364,7 +366,7 @@ class Theme {
$copy.setAttribute('data-clipboard-text', code);
$copy.title = this.config.code.copyTitle;
const clipboard = new ClipboardJS($copy);
clipboard.on('success', e => {
clipboard.on('success', _e => {
this.util.animateCSS($code, 'flash');
});
$header.appendChild($copy);
@ -556,18 +558,27 @@ class Theme {
initTypeit() {
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 id = group[i];
if (i === group.length - 1) {
new TypeIt(`#${id}`, {
strings: this.data[id],
}).go();
return;
}
let instance = new TypeIt(`#${id}`, {
const instance = new TypeIt(`#${id}`, {
strings: this.data[id],
speed: speed,
lifeLike: true,
cursorSpeed: cursorSpeed,
cursorChar: cursorChar,
waitUntilVisible: true,
afterComplete: () => {
if (i === group.length - 1) {
if (typeitConfig.duration >= 0) window.setTimeout(() => {
instance.destroy();
}, typeitConfig.duration);
return;
}
instance.destroy();
typeone(i + 1);
},
@ -579,12 +590,36 @@ class Theme {
}
initComment() {
if (this.config.comment && this.config.comment.gitalk) {
this.config.comment.gitalk.body = decodeURI(window.location.href);
const gitalk = new Gitalk(this.config.comment.gitalk.body);
gitalk.render('gitalk');
if (this.config.comment) {
if (this.config.comment.gitalk) {
this.config.comment.gitalk.body = decodeURI(window.location.href);
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() {

View file

@ -5,7 +5,7 @@ name = "LoveIt"
license = "MIT"
licenselink = "https://github.com/dillonzq/LoveIt/blob/master/LICENSE"
description = "A Clean, Elegant but Advanced Hugo Theme for Hugo."
homepage = "https://hugo-loveit-en.netlify.com"
homepage = "https://hugoloveit.com"
tags = [
"blog",
"clean",