Merge pull request #362 from dillonzq/develop
This commit is contained in:
@@ -110,6 +110,7 @@ I hope you will LoveIt ❤️!
|
||||
* **Bilibili player** shortcode
|
||||
* Kinds of **admonitions** shortcode
|
||||
* **Custom style** shortcode
|
||||
* **Custom script** shortcode
|
||||
* **Animated typing** supported by [TypeIt](https://typeitjs.com/)
|
||||
* **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
||||
* **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
* 支持 **Bilibili 视频** shortcode
|
||||
* 支持多种**注释**的 shortcode
|
||||
* 支持**自定义样式**的 shortcode
|
||||
* 支持**自定义脚本**的 shortcode
|
||||
* 支持基于 [TypeIt](https://typeitjs.com/) 的**打字动画** shortcode
|
||||
* 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll) 的**滚动动画**
|
||||
* 支持基于 [cookieconsent](https://github.com/osano/cookieconsent) 的 **Cookie 许可横幅**
|
||||
|
||||
4
assets/css/_override.scss
Normal file
4
assets/css/_override.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
// ==============================
|
||||
// Override Variables
|
||||
// 覆盖变量
|
||||
// ==============================
|
||||
@@ -2,6 +2,8 @@
|
||||
// Variables
|
||||
// ==============================
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap');
|
||||
|
||||
// ========== Global ========== //
|
||||
// Font and Line Height
|
||||
$global-font-family: system-ui, -apple-system, BlinkMacSystemFont, PingFang SC, Microsoft YaHei UI, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif !default;
|
||||
@@ -57,7 +59,7 @@ $header-background-color: #f8f8f8 !default;
|
||||
$header-background-color-dark: #252627 !default;
|
||||
|
||||
// Font style of the header title
|
||||
$header-title-font-family: $global-font-family !default;
|
||||
$header-title-font-family: Nunito, $global-font-family !default;
|
||||
$header-title-font-size: 1.5rem !default;
|
||||
|
||||
// Color of the hover header item
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
@charset "utf-8";
|
||||
|
||||
@import "_variables";
|
||||
|
||||
{{- if fileExists "config/css/_override.scss" -}}
|
||||
@import "_override";
|
||||
{{- end -}}
|
||||
@import "_override";
|
||||
|
||||
@import "_mixin/index";
|
||||
|
||||
@@ -19,6 +16,4 @@
|
||||
|
||||
@import "_core/media";
|
||||
|
||||
{{- if fileExists "config/css/_custom.scss" -}}
|
||||
@import "_custom";
|
||||
{{- end -}}
|
||||
@import "_custom";
|
||||
@@ -1,3 +1,9 @@
|
||||
theme:
|
||||
- html5shiv
|
||||
- Object.values
|
||||
- Promise
|
||||
- fetch
|
||||
- Element.prototype.after
|
||||
smooth-scroll:
|
||||
- Element.prototype.closest
|
||||
- requestAnimationFrame
|
||||
@@ -14,8 +20,3 @@ TypeIt:
|
||||
- Math.sign
|
||||
- Object.assign
|
||||
- Promise
|
||||
theme:
|
||||
- Object.values
|
||||
- Promise
|
||||
- fetch
|
||||
- Element.prototype.after
|
||||
2
assets/js/theme.min.js
vendored
2
assets/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
exampleSite/assets/css/_custom.scss
Normal file
4
exampleSite/assets/css/_custom.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
// ==============================
|
||||
// Custom style
|
||||
// 自定义样式
|
||||
// ==============================
|
||||
4
exampleSite/assets/css/_override.scss
Normal file
4
exampleSite/assets/css/_override.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
// ==============================
|
||||
// Override Variables
|
||||
// 覆盖变量
|
||||
// ==============================
|
||||
@@ -875,7 +875,7 @@ enableEmoji = true
|
||||
recordIP = true
|
||||
highlight = true
|
||||
enableQQ = false
|
||||
serverURLs = ""
|
||||
serverURLs = "https://leancloud.hugoloveit.com"
|
||||
# emoji data file name, default is "google.yml"
|
||||
# ("apple.yml", "google.yml", "facebook.yml", "twitter.yml")
|
||||
# located in "themes/LoveIt/assets/data/emoji/" directory
|
||||
@@ -1025,6 +1025,16 @@ enableEmoji = true
|
||||
# "assets/data/cdn/"
|
||||
data = "jsdelivr.yml"
|
||||
|
||||
# Compatibility config
|
||||
# 兼容性设置
|
||||
[params.compatibility]
|
||||
# whether to use Polyfill.io to be compatible with older browsers
|
||||
# 是否使用 Polyfill.io 来兼容旧式浏览器
|
||||
polyfill = false
|
||||
# whether to use object-fit-images to be compatible with older browsers
|
||||
# 是否使用 object-fit-images 来兼容旧式浏览器
|
||||
objectFit = false
|
||||
|
||||
# Markup related configuration in Hugo
|
||||
# Hugo 解析文档的配置
|
||||
[markup]
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// ==============================
|
||||
// Override Variables
|
||||
// 覆盖变量
|
||||
// ==============================
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap');
|
||||
|
||||
$header-title-font-family: Nunito, $global-font-family;
|
||||
@@ -77,6 +77,7 @@ math:
|
||||
* :(fas fa-video fa-fw): **Bilibili player** shortcode
|
||||
* :(far fa-bell fa-fw): Kinds of **admonitions** shortcode
|
||||
* :(fas fa-align-left fa-fw): **Custom style** shortcode
|
||||
* :(fab fa-js-square fa-fw): **Custom script** shortcode
|
||||
* :(fas fa-i-cursor fa-fw): **Animated typing** supported by [TypeIt](https://typeitjs.com/)
|
||||
* :(fas fa-arrow-down fa-fw): **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
||||
* :(fas fa-cookie-bite fa-fw): **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
|
||||
|
||||
@@ -82,6 +82,7 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw
|
||||
* :(fas fa-video fa-fw): **Bilibili player** shortcode
|
||||
* :(far fa-bell fa-fw): Kinds of **admonitions** shortcode
|
||||
* :(fas fa-align-left fa-fw): **Custom style** shortcode
|
||||
* :(fab fa-js-square fa-fw): **Custom script** shortcode
|
||||
* :(fas fa-i-cursor fa-fw): **Animated typing** supported by [TypeIt](https://typeitjs.com/)
|
||||
* :(fas fa-arrow-down fa-fw): **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
||||
* :(fas fa-cookie-bite fa-fw): **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
|
||||
|
||||
@@ -77,6 +77,7 @@ math:
|
||||
* :(fas fa-video fa-fw): 支持 **Bilibili 视频** shortcode
|
||||
* :(far fa-bell fa-fw): 支持多种**注释**的 shortcode
|
||||
* :(fas fa-align-left fa-fw): 支持**自定义样式**的 shortcode
|
||||
* :(fab fa-js-square fa-fw): 支持**自定义脚本**的 shortcode
|
||||
* :(fas fa-i-cursor fa-fw): 支持基于 [TypeIt](https://typeitjs.com/) 的**打字动画** shortcode
|
||||
* :(fas fa-arrow-down fa-fw): 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll) 的**滚动动画**
|
||||
* :(fas fa-cookie-bite fa-fw): 支持基于 [cookieconsent](https://github.com/osano/cookieconsent) 的 **Cookie 许可横幅**
|
||||
|
||||
@@ -116,6 +116,13 @@ theme = "LoveIt"
|
||||
url = "/categories/"
|
||||
title = ""
|
||||
weight = 3
|
||||
|
||||
# Markup related configuration in Hugo
|
||||
[markup]
|
||||
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
|
||||
[markup.highlight]
|
||||
# false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
|
||||
noClasses = false
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
@@ -634,6 +641,13 @@ Please open the code block below to view the complete sample configuration :(far
|
||||
# "assets/data/cdn/"
|
||||
data = ""
|
||||
|
||||
# {{< version 0.2.8 >}} Compatibility config
|
||||
[params.compatibility]
|
||||
# whether to use Polyfill.io to be compatible with older browsers
|
||||
polyfill = false
|
||||
# whether to use object-fit-images to be compatible with older browsers
|
||||
objectFit = false
|
||||
|
||||
# Markup related config in Hugo
|
||||
[markup]
|
||||
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
|
||||
@@ -792,15 +806,17 @@ Add a logo image (127x40) and a cover image (800x600) in the `static` directory.
|
||||
|
||||
### 3.4 Style Customization
|
||||
|
||||
{{< version 0.2.8 changed >}}
|
||||
|
||||
{{< admonition >}}
|
||||
Hugo **extended** version is necessary for the style customization.
|
||||
{{< /admonition >}}
|
||||
|
||||
**LoveIt** theme has been built to be as configurable as possible by defining custom `.scss` style files.
|
||||
|
||||
The directory including the custom `.scss` style files is `config/css` relative to **your project root directory**.
|
||||
The directory including the custom `.scss` style files is `assets/css` relative to **your project root directory**.
|
||||
|
||||
In `config/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.
|
||||
In `assets/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.
|
||||
|
||||
Here is a example:
|
||||
|
||||
@@ -809,7 +825,7 @@ Here is a example:
|
||||
$code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospace;
|
||||
```
|
||||
|
||||
In `config/css/_custom.scss`, you can add some css style code to customize the style.
|
||||
In `assets/css/_custom.scss`, you can add some css style code to customize the style.
|
||||
|
||||
## 4 Multilingual and i18n
|
||||
|
||||
|
||||
@@ -121,6 +121,13 @@ theme = "LoveIt"
|
||||
url = "/categories/"
|
||||
title = ""
|
||||
weight = 3
|
||||
|
||||
# Markup related configuration in Hugo
|
||||
[markup]
|
||||
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
|
||||
[markup.highlight]
|
||||
# false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
|
||||
noClasses = false
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
@@ -639,6 +646,13 @@ Please open the code block below to view the complete sample configuration :(far
|
||||
# "assets/data/cdn/"
|
||||
data = ""
|
||||
|
||||
# {{< version 0.2.8 >}} Compatibility config
|
||||
[params.compatibility]
|
||||
# whether to use Polyfill.io to be compatible with older browsers
|
||||
polyfill = false
|
||||
# whether to use object-fit-images to be compatible with older browsers
|
||||
objectFit = false
|
||||
|
||||
# Markup related config in Hugo
|
||||
[markup]
|
||||
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
|
||||
@@ -797,15 +811,17 @@ Add a logo image (127x40) and a cover image (800x600) in the `static` directory.
|
||||
|
||||
### 3.4 Style Customization
|
||||
|
||||
{{< version 0.2.8 changed >}}
|
||||
|
||||
{{< admonition >}}
|
||||
Hugo **extended** version is necessary for the style customization.
|
||||
{{< /admonition >}}
|
||||
|
||||
**LoveIt** theme has been built to be as configurable as possible by defining custom `.scss` style files.
|
||||
|
||||
The directory including the custom `.scss` style files is `config/css` relative to **your project root directory**.
|
||||
The directory including the custom `.scss` style files is `assets/css` relative to **your project root directory**.
|
||||
|
||||
In `config/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.
|
||||
In `assets/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.
|
||||
|
||||
Here is a example:
|
||||
|
||||
@@ -814,7 +830,7 @@ Here is a example:
|
||||
$code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospace;
|
||||
```
|
||||
|
||||
In `config/css/_custom.scss`, you can add some css style code to customize the style.
|
||||
In `assets/css/_custom.scss`, you can add some css style code to customize the style.
|
||||
|
||||
## 4 Multilingual and i18n
|
||||
|
||||
|
||||
@@ -119,6 +119,13 @@ theme = "LoveIt"
|
||||
url = "/categories/"
|
||||
title = ""
|
||||
weight = 3
|
||||
|
||||
# Hugo 解析文档的配置
|
||||
[markup]
|
||||
# 语法高亮设置 (https://gohugo.io/content-management/syntax-highlighting)
|
||||
[markup.highlight]
|
||||
# false 是必要的设置 (https://github.com/dillonzq/LoveIt/issues/158)
|
||||
noClasses = false
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
@@ -637,6 +644,13 @@ hugo
|
||||
# "assets/data/cdn/"
|
||||
data = ""
|
||||
|
||||
# {{< version 0.2.8 >}} 兼容性设置
|
||||
[params.compatibility]
|
||||
# 是否使用 Polyfill.io 来兼容旧式浏览器
|
||||
polyfill = false
|
||||
# 是否使用 object-fit-images 来兼容旧式浏览器
|
||||
objectFit = false
|
||||
|
||||
# Hugo 解析文档的配置
|
||||
[markup]
|
||||
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "语法高亮设置" >}}
|
||||
@@ -796,15 +810,17 @@ hugo
|
||||
|
||||
### 3.4 自定义样式
|
||||
|
||||
{{< version 0.2.8 changed >}}
|
||||
|
||||
{{< admonition >}}
|
||||
Hugo **extended** 版本对于自定义样式是必需的.
|
||||
{{< /admonition >}}
|
||||
|
||||
通过定义自定义 `.scss` 样式文件, **LoveIt** 主题支持可配置的样式.
|
||||
|
||||
包含自定义 `.scss` 样式文件的目录相对于 **你的项目根目录** 的路径为 `config/css`.
|
||||
包含自定义 `.scss` 样式文件的目录相对于 **你的项目根目录** 的路径为 `assets/css`.
|
||||
|
||||
在 `config/css/_override.scss` 中, 你可以覆盖 `themes/LoveIt/assets/css/_variables.scss` 中的变量以自定义样式.
|
||||
在 `assets/css/_override.scss` 中, 你可以覆盖 `themes/LoveIt/assets/css/_variables.scss` 中的变量以自定义样式.
|
||||
|
||||
这是一个例子:
|
||||
|
||||
@@ -813,7 +829,7 @@ Hugo **extended** 版本对于自定义样式是必需的.
|
||||
$code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospace;
|
||||
```
|
||||
|
||||
在 `config/css/_custom.scss` 中, 你可以添加一些 CSS 样式代码以自定义样式.
|
||||
在 `assets/css/_custom.scss` 中, 你可以添加一些 CSS 样式代码以自定义样式.
|
||||
|
||||
## 4 多语言和 i18n
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Hugo **extended** version is necessary for `style` shortcode.
|
||||
The `style` shortcode has two positional parameters.
|
||||
|
||||
The **first** one is the custom style content,
|
||||
which supports nesting syntax in [SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
|
||||
which supports nesting syntax in [:(fab fa-sass fa-fw): SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
|
||||
and `&` referring to this parent HTML element.
|
||||
|
||||
And the **second** one is the tag name of the HTML element wrapping the content you want to change style, and whose default value is `div`.
|
||||
@@ -1265,3 +1265,27 @@ The rendered output looks like this:
|
||||
{{< typeit group=paragraph >}}
|
||||
**Then** this paragraph begins
|
||||
{{< /typeit >}}
|
||||
|
||||
## 11 script
|
||||
|
||||
{{< version 0.2.8 >}}
|
||||
|
||||
`script` is a shortcode to insert custom **:(fab fa-js fa-fw): Javascript** in your post.
|
||||
|
||||
{{< admonition >}}
|
||||
The script content can be guaranteed to be executed in order after all third-party libraries are loaded. So you are free to use third-party libraries.
|
||||
{{< /admonition >}}
|
||||
|
||||
Example `script` input:
|
||||
|
||||
```markdown
|
||||
{{</* script */>}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
You can see the output in the console of the developer tool.
|
||||
|
||||
{{< script >}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{< /script >}}
|
||||
|
||||
@@ -39,7 +39,7 @@ Hugo **extended** version is necessary for `style` shortcode.
|
||||
The `style` shortcode has two positional parameters.
|
||||
|
||||
The **first** one is the custom style content,
|
||||
which supports nesting syntax in [SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
|
||||
which supports nesting syntax in [:(fab fa-sass fa-fw): SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
|
||||
and `&` referring to this parent HTML element.
|
||||
|
||||
And the **second** one is the tag name of the HTML element wrapping the content you want to change style, and whose default value is `div`.
|
||||
@@ -1270,3 +1270,27 @@ The rendered output looks like this:
|
||||
{{< typeit group=paragraph >}}
|
||||
**Then** this paragraph begins
|
||||
{{< /typeit >}}
|
||||
|
||||
## 11 script
|
||||
|
||||
{{< version 0.2.8 >}}
|
||||
|
||||
`script` is a shortcode to insert custom **:(fab fa-js fa-fw): Javascript** in your post.
|
||||
|
||||
{{< admonition >}}
|
||||
The script content can be guaranteed to be executed in order after all third-party libraries are loaded. So you are free to use third-party libraries.
|
||||
{{< /admonition >}}
|
||||
|
||||
Example `script` input:
|
||||
|
||||
```markdown
|
||||
{{</* script */>}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
You can see the output in the console of the developer tool.
|
||||
|
||||
{{< script >}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{< /script >}}
|
||||
|
||||
@@ -36,7 +36,7 @@ Hugo **extended** 版本对于 `style` shortcode 是必需的.
|
||||
|
||||
`style` shortcode 有两个位置参数.
|
||||
|
||||
第一个参数是自定义样式的内容. 它支持 [SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting) 中的嵌套语法,
|
||||
第一个参数是自定义样式的内容. 它支持 [:(fab fa-sass fa-fw): SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting) 中的嵌套语法,
|
||||
并且 `&` 指代这个父元素.
|
||||
|
||||
第二个参数是包裹你要更改样式的内容的 HTML 标签, 默认值是 `div`.
|
||||
@@ -1266,3 +1266,28 @@ public class HelloWorld {
|
||||
{{< typeit group=paragraph >}}
|
||||
**然后**, 这个段落开始
|
||||
{{< /typeit >}}
|
||||
|
||||
## 11 script
|
||||
|
||||
{{< version 0.2.8 >}}
|
||||
|
||||
`script` shortcode 用来在你的文章中插入 **:(fab fa-js fa-fw): Javascript** 脚本.
|
||||
|
||||
{{< admonition >}}
|
||||
脚本内容可以保证在所有的第三方库加载之后按顺序执行.
|
||||
所以你可以自由地使用第三方库.
|
||||
{{< /admonition >}}
|
||||
|
||||
一个 `script` 示例:
|
||||
|
||||
```markdown
|
||||
{{</* script */>}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{</* /script */>}}
|
||||
```
|
||||
|
||||
你可以在开发者工具的控制台中看到输出.
|
||||
|
||||
{{< script >}}
|
||||
console.log('Hello LoveIt!');
|
||||
{{< /script >}}
|
||||
|
||||
@@ -1,42 +1,4 @@
|
||||
{{- .Scratch.Set "version" "0.2.7" -}}
|
||||
{{- $version := "0.2.X" -}}
|
||||
|
||||
{{- /* LoveIt theme version detection */ -}}
|
||||
{{- if eq .Site .Sites.First -}}
|
||||
{{- if not .Site.Params.version -}}
|
||||
{{- errorf "Configuration Error 配置文件错误\n\nYou haven't configured the LoveIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration\n你还没有正确配置 LoveIt 的版本参数. 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration\n" -}}
|
||||
{{- else if ne .Site.Params.version $version -}}
|
||||
{{- errorf (printf "Compatibility Error 兼容性错误\n\n%s -> %s:\nYou have an incompatible update. See https://github.com/dillonzq/LoveIt/releases\n你进行了一次不兼容的更新. 参考 https://github.com/dillonzq/LoveIt/releases\n" .Site.Params.version $version) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
|
||||
{{- if eq hugo.Environment "production" -}}
|
||||
{{- $cdn := .Site.Params.cdn -}}
|
||||
{{- with $cdn.data -}}
|
||||
{{- $cdnData := printf "data/cdn/%s" . | resources.Get | transform.Unmarshal -}}
|
||||
{{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}}
|
||||
{{- $prefix := $cdnData.prefix.libFiles | default "" -}}
|
||||
{{- range $key, $value := $cdnData.libFiles -}}
|
||||
{{- $cdn = printf "%s%s" $prefix $value | dict $key | merge $cdn -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "cdn" $cdn -}}
|
||||
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Scratch.Set "comment" $params.comment -}}
|
||||
{{- if eq .Params.comment true -}}
|
||||
{{- .Scratch.Set "comment" .Site.Params.comment -}}
|
||||
{{- else if eq .Params.comment false -}}
|
||||
{{- .Scratch.Set "comment" dict -}}
|
||||
{{- end -}}
|
||||
{{- else if eq .Site .Sites.First -}}
|
||||
{{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- .Scratch.Set "params" $params -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
{{- partial "init.html" . -}}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}">
|
||||
@@ -48,7 +10,6 @@
|
||||
<title>
|
||||
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
|
||||
</title>
|
||||
<meta name="Description" content="{{ $params.description | default .Site.Params.description }}">
|
||||
|
||||
{{- partial "head/meta.html" . -}}
|
||||
{{- partial "head/link.html" . -}}
|
||||
|
||||
@@ -38,10 +38,6 @@
|
||||
{{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* object-fit-images */ -}}
|
||||
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* twemoji */ -}}
|
||||
{{- if $params.twemoji -}}
|
||||
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
|
||||
@@ -52,7 +48,7 @@
|
||||
{{- /* lightgallery.js */ -}}
|
||||
{{- if $params.lightgallery -}}
|
||||
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.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/style.html" -}}
|
||||
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/lg-thumbnail.min.js" -}}
|
||||
@@ -97,14 +93,14 @@
|
||||
{{- end -}}
|
||||
{{- if $math.enable -}}
|
||||
{{- $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/style.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" -}}
|
||||
{{- 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" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
@@ -128,7 +124,7 @@
|
||||
{{- $source := $cdn.mermaidJS | default "lib/mermaid/mermaid.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/mermaid/mermaid.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* ECharts */ -}}
|
||||
@@ -142,7 +138,7 @@
|
||||
{{- /* Mapbox GL */ -}}
|
||||
{{- if (.Scratch.Get "this").mapbox -}}
|
||||
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.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/style.html" -}}
|
||||
{{- $source := $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
@@ -153,9 +149,9 @@
|
||||
{{- if (.Scratch.Get "this").music -}}
|
||||
{{- /* APlayer */ -}}
|
||||
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.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/style.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
|
||||
@@ -167,7 +163,7 @@
|
||||
{{- /* Cookie Consent */ -}}
|
||||
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
|
||||
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.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/style.html" -}}
|
||||
{{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
|
||||
@@ -177,32 +173,32 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.css -}}
|
||||
{{- dict "source" . "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- dict "source" . "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.js -}}
|
||||
{{- dict "source" . "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with (.Scratch.Get "this").styleArr -}}
|
||||
{{- delimit . "" | dict "content" | dict "scratch" $.Scratch "data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Config script */ -}}
|
||||
{{- $config | jsonify | printf "window.config=%s;" | dict "content" | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Theme script */ -}}
|
||||
{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").stylesheet -}}
|
||||
{{- partial "plugin/stylesheet.html" . -}}
|
||||
{{- with (.Scratch.Get "this").scriptArr -}}
|
||||
{{- delimit . "\n" | dict "content" | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with (.Scratch.Get "this").styleArr -}}
|
||||
<style>{{ delimit . "" | safeCSS }}</style>
|
||||
{{- range (.Scratch.Get "this").style -}}
|
||||
{{- partial "plugin/style.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
<script type="text/javascript">
|
||||
window.config = {{ $config | jsonify | safeJS }};
|
||||
</script>
|
||||
|
||||
{{- /* Polyfill.io */ -}}
|
||||
{{- 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" . -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
{{- if $gitalk.enable -}}
|
||||
<div id="gitalk" class="comment"></div>
|
||||
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}}
|
||||
{{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
|
||||
@@ -35,7 +35,7 @@
|
||||
{{- if $valine.enable -}}
|
||||
<div id="valine" class="comment"></div>
|
||||
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
|
||||
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "scratch" .Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
{{- $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" -}}
|
||||
{{- with .content -}}
|
||||
{{- dict $id . | dict "data" | dict "config" | merge ($.scratch.Get "this") | $.scratch.Set "this" -}}
|
||||
{{- end -}}
|
||||
{{- return $id -}}
|
||||
|
||||
@@ -31,21 +31,21 @@
|
||||
|
||||
{{- /* normalize.css */ -}}
|
||||
{{- $source := $cdn.normalizeCSS | default "lib/normalize/normalize.min.css" -}}
|
||||
{{- $stylesheet := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
{{- $style := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* style.min.css */ -}}
|
||||
{{- $stylesheet := dict "source" "css/style.template.scss" "fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "targetPath" "css/style.min.css" "includePaths" (slice "config/css") "enableSourceMap" true -}}
|
||||
{{- $stylesheet = dict "template" "style.scss" "context" . "toCSS" $options | merge $stylesheet -}}
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
{{- $style := dict "source" "css/style.scss" "fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
|
||||
{{- $style = dict "context" . "toCSS" $options | merge $style -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* Font Awesome */ -}}
|
||||
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
|
||||
{{- $stylesheet := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
{{- $style := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* Animate.css */ -}}
|
||||
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
|
||||
{{- $stylesheet := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
{{- $style := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
<meta name="Description" content="{{ $params.description | default .Site.Params.description }}">
|
||||
|
||||
{{- template "_internal/opengraph.html" . -}}
|
||||
{{- template "_internal/twitter_cards.html" . -}}
|
||||
|
||||
|
||||
41
layouts/partials/init.html
Normal file
41
layouts/partials/init.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{{- .Scratch.Set "version" "0.2.8" -}}
|
||||
|
||||
{{- /* LoveIt theme version detection */ -}}
|
||||
{{- $VERSION := "0.2.X" -}}
|
||||
{{- if eq .Site .Sites.First -}}
|
||||
{{- if not .Site.Params.version -}}
|
||||
{{- errorf "Configuration Error 配置文件错误\n\nYou haven't configured the LoveIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration\n你还没有正确配置 LoveIt 的版本参数. 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration\n" -}}
|
||||
{{- else if ne .Site.Params.version $VERSION -}}
|
||||
{{- errorf (printf "Compatibility Error 兼容性错误\n\n%s -> %s:\nYou have an incompatible update. See https://github.com/dillonzq/LoveIt/releases\n你进行了一次不兼容的更新. 参考 https://github.com/dillonzq/LoveIt/releases\n" .Site.Params.version $VERSION) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
|
||||
{{- if eq hugo.Environment "production" -}}
|
||||
{{- $cdn := .Site.Params.cdn -}}
|
||||
{{- with $cdn.data -}}
|
||||
{{- $cdnData := printf "data/cdn/%s" . | resources.Get | transform.Unmarshal -}}
|
||||
{{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}}
|
||||
{{- $prefix := $cdnData.prefix.libFiles | default "" -}}
|
||||
{{- range $key, $value := $cdnData.libFiles -}}
|
||||
{{- $cdn = printf "%s%s" $prefix $value | dict $key | merge $cdn -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "cdn" $cdn -}}
|
||||
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Scratch.Set "comment" $params.comment -}}
|
||||
{{- if eq .Params.comment true -}}
|
||||
{{- .Scratch.Set "comment" .Site.Params.comment -}}
|
||||
{{- else if eq .Params.comment false -}}
|
||||
{{- .Scratch.Set "comment" dict -}}
|
||||
{{- end -}}
|
||||
{{- else if eq .Site .Sites.First -}}
|
||||
{{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- .Scratch.Set "params" $params -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "plugin/compatibility.html" . -}}
|
||||
22
layouts/partials/plugin/compatibility.html
Normal file
22
layouts/partials/plugin/compatibility.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{- $compatibility := .Site.Params.compatibility | default dict -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
|
||||
{{- /* Polyfill.io */ -}}
|
||||
{{- if $compatibility.polyfill -}}
|
||||
{{- $features := slice -}}
|
||||
{{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}}
|
||||
{{- range . -}}
|
||||
{{- $features = $features | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with $features | uniq -}}
|
||||
{{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%s" | dict "source" | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* object-fit-images */ -}}
|
||||
{{- if $compatibility.objectFit -}}
|
||||
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
@@ -1,4 +1,8 @@
|
||||
{{- if strings.HasPrefix .source "<script" -}}
|
||||
{{- if .content -}}
|
||||
<script type="text/javascript">
|
||||
{{- .content | safeJS -}}
|
||||
</script>
|
||||
{{- else if strings.HasPrefix .source "<script" -}}
|
||||
{{- safeHTML .source -}}
|
||||
{{- else -}}
|
||||
{{- $src := .source -}}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{{- if strings.HasPrefix .source "<link" -}}
|
||||
{{- if .content -}}
|
||||
<style>
|
||||
{{- .content | safeCSS -}}
|
||||
</style>
|
||||
{{- else if strings.HasPrefix .source "<link" -}}
|
||||
{{- safeHTML .source -}}
|
||||
{{- else -}}
|
||||
{{- $href := .source -}}
|
||||
4
layouts/partials/scratch/style.html
Normal file
4
layouts/partials/scratch/style.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{- $this := .scratch.Get "this" -}}
|
||||
{{- $style := $this.style | default slice -}}
|
||||
{{- $style = $style | append (slice .data) -}}
|
||||
{{- .scratch.SetInMap "this" "style" $style -}}
|
||||
@@ -1,4 +0,0 @@
|
||||
{{- $this := .scratch.Get "this" -}}
|
||||
{{- $stylesheet := $this.stylesheet | default slice -}}
|
||||
{{- $stylesheet = $stylesheet | append (slice .data) -}}
|
||||
{{- .scratch.SetInMap "this" "stylesheet" $stylesheet -}}
|
||||
2
layouts/shortcodes/script.html
Normal file
2
layouts/shortcodes/script.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{{- $scriptArr := (.Page.Scratch.Get "this").scriptArr | default slice -}}
|
||||
{{- $scriptArr | append (trim .Inner "\n") | .Page.Scratch.SetInMap "this" "scriptArr" -}}
|
||||
@@ -1,11 +1,11 @@
|
||||
{{- $content := .Inner | .Page.RenderString -}}
|
||||
{{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $id := dict "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 -}}
|
||||
{{- $path := printf "style/%s/%s" (md5 .Page.RelPermalink) $id -}}
|
||||
{{- $res := resources.FromString (printf "%s.scss" $path) $style -}}
|
||||
{{- $res = $res | toCSS (dict "targetPath" (printf "%s.css" $path)) -}}
|
||||
{{- $res = $res | toCSS (dict "targetPath" (printf "%s.css" $path) "outputStyle" "compressed") -}}
|
||||
{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}}
|
||||
{{- $styleArr | append $res.Content | .Page.Scratch.SetInMap "this" "styleArr" -}}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#id-1 img {
|
||||
height: 1.25rem; }
|
||||
@@ -0,0 +1 @@
|
||||
#id-1 img{height:1.25rem}
|
||||
@@ -0,0 +1 @@
|
||||
#id-1 img{height:1.25rem}
|
||||
@@ -1,2 +0,0 @@
|
||||
#id-1 img {
|
||||
height: 1.25rem; }
|
||||
@@ -0,0 +1 @@
|
||||
#id-1{text-align:right}
|
||||
@@ -1,2 +0,0 @@
|
||||
#id-1 {
|
||||
text-align: right; }
|
||||
@@ -1,2 +0,0 @@
|
||||
#id-1 {
|
||||
text-align: right; }
|
||||
@@ -0,0 +1 @@
|
||||
#id-1{text-align:right}
|
||||
@@ -1,4 +0,0 @@
|
||||
#id-1 {
|
||||
text-align: right; }
|
||||
#id-1 strong {
|
||||
color: #00b1ff; }
|
||||
@@ -0,0 +1 @@
|
||||
#id-1{text-align:right}#id-1 strong{color:#00b1ff}
|
||||
@@ -1,4 +0,0 @@
|
||||
#id-1 {
|
||||
text-align: right; }
|
||||
#id-1 strong {
|
||||
color: #00b1ff; }
|
||||
@@ -0,0 +1 @@
|
||||
#id-1{text-align:right}#id-1 strong{color:#00b1ff}
|
||||
@@ -0,0 +1 @@
|
||||
#id-1{text-align:right}
|
||||
@@ -1,2 +0,0 @@
|
||||
#id-1 {
|
||||
text-align: right; }
|
||||
@@ -0,0 +1 @@
|
||||
#id-1 img{height:1.25rem}
|
||||
@@ -1,2 +0,0 @@
|
||||
#id-1 img {
|
||||
height: 1.25rem; }
|
||||
@@ -1,4 +0,0 @@
|
||||
#id-1 {
|
||||
text-align: right; }
|
||||
#id-1 strong {
|
||||
color: #00b1ff; }
|
||||
@@ -0,0 +1 @@
|
||||
#id-1{text-align:right}#id-1 strong{color:#00b1ff}
|
||||
@@ -40,7 +40,7 @@ class Theme {
|
||||
this.resizeEventSet = new Set();
|
||||
this.switchThemeEventSet = new Set();
|
||||
this.clickMaskEventSet = new Set();
|
||||
if (objectFitImages) objectFitImages();
|
||||
if (window.objectFitImages) objectFitImages();
|
||||
}
|
||||
|
||||
initSVGIcon() {
|
||||
|
||||
Reference in New Issue
Block a user