mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
feat(page): add custom page library support (css and js) (#357)
This commit is contained in:
parent
861350be32
commit
486d859cc8
8 changed files with 93 additions and 0 deletions
|
@ -920,6 +920,19 @@ enableEmoji = true
|
|||
label = ""
|
||||
lightTheme = "github-light"
|
||||
darkTheme = "github-dark"
|
||||
# Third-party library config
|
||||
# 第三方库配置
|
||||
[params.page.library]
|
||||
[params.page.library.css]
|
||||
# someCSS = "some.css"
|
||||
# located in "assets/" 位于 "assets/"
|
||||
# Or 或者
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
[params.page.library.js]
|
||||
# someJavascript = "some.js"
|
||||
# located in "assets/" 位于 "assets/"
|
||||
# Or 或者
|
||||
# someJavascript = "https://cdn.example.com/some.js"
|
||||
# SEO config
|
||||
# SEO 配置
|
||||
[params.page.seo]
|
||||
|
|
|
@ -551,6 +551,18 @@ Please open the code block below to view the complete sample configuration :(far
|
|||
label = ""
|
||||
lightTheme = "github-light"
|
||||
darkTheme = "github-dark"
|
||||
# {{< version 0.2.7 >}} Third-party library config
|
||||
[params.page.library]
|
||||
[params.page.library.css]
|
||||
# someCSS = "some.css"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
[params.page.library.js]
|
||||
# someJavascript = "some.js"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someJavascript = "https://cdn.example.com/some.js"
|
||||
# {{< version 0.2.0 >}} SEO config
|
||||
[params.page.seo]
|
||||
# Publisher info
|
||||
|
|
|
@ -556,6 +556,18 @@ Please open the code block below to view the complete sample configuration :(far
|
|||
label = ""
|
||||
lightTheme = "github-light"
|
||||
darkTheme = "github-dark"
|
||||
# {{< version 0.2.7 >}} Third-party library config
|
||||
[params.page.library]
|
||||
[params.page.library.css]
|
||||
# someCSS = "some.css"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
[params.page.library.js]
|
||||
# someJavascript = "some.js"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someJavascript = "https://cdn.example.com/some.js"
|
||||
# {{< version 0.2.0 >}} SEO config
|
||||
[params.page.seo]
|
||||
# Publisher info
|
||||
|
|
|
@ -554,6 +554,18 @@ hugo
|
|||
label = ""
|
||||
lightTheme = "github-light"
|
||||
darkTheme = "github-dark"
|
||||
# {{< version 0.2.7 >}} 第三方库配置
|
||||
[params.page.library]
|
||||
[params.page.library.css]
|
||||
# someCSS = "some.css"
|
||||
# 位于 "assets/"
|
||||
# 或者
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
[params.page.library.js]
|
||||
# someJavascript = "some.js"
|
||||
# 位于 "assets/"
|
||||
# 或者
|
||||
# someJavascript = "https://cdn.example.com/some.js"
|
||||
# {{< version 0.2.0 >}} SEO config
|
||||
[params.page.seo]
|
||||
# 出版者信息
|
||||
|
|
|
@ -90,6 +90,17 @@ share:
|
|||
comment:
|
||||
enable: true
|
||||
# ...
|
||||
library:
|
||||
css:
|
||||
# someCSS = "some.css"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
js:
|
||||
# someJS = "some.js"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someJS = "https://cdn.example.com/some.js"
|
||||
---
|
||||
```
|
||||
|
||||
|
@ -125,6 +136,7 @@ comment:
|
|||
* **mapbox**: {{< version 0.2.0 >}} the same as the `params.page.mapbox` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **share**: the same as the `params.page.share` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **comment**: {{< version 0.2.0 changed >}} the same as the `params.page.comment` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **library**: {{< version 0.2.7 >}} the same as the `params.page.library` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
## 3 Content Summaries
|
||||
|
||||
|
|
|
@ -95,6 +95,17 @@ share:
|
|||
comment:
|
||||
enable: true
|
||||
# ...
|
||||
library:
|
||||
css:
|
||||
# someCSS = "some.css"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
js:
|
||||
# someJS = "some.js"
|
||||
# located in "assets/"
|
||||
# Or
|
||||
# someJS = "https://cdn.example.com/some.js"
|
||||
---
|
||||
```
|
||||
|
||||
|
@ -130,6 +141,7 @@ comment:
|
|||
* **mapbox**: {{< version 0.2.0 >}} the same as the `params.page.mapbox` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **share**: the same as the `params.page.share` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **comment**: {{< version 0.2.0 changed >}} the same as the `params.page.comment` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
* **library**: {{< version 0.2.7 >}} the same as the `params.page.library` part in the [site configuration](../theme-documentation-basics#site-configuration).
|
||||
|
||||
## 3 Content Summaries
|
||||
|
||||
|
|
|
@ -90,6 +90,17 @@ share:
|
|||
comment:
|
||||
enable: true
|
||||
# ...
|
||||
library:
|
||||
css:
|
||||
# someCSS = "some.css"
|
||||
# 位于 "assets/"
|
||||
# 或者
|
||||
# someCSS = "https://cdn.example.com/some.css"
|
||||
js:
|
||||
# someJS = "some.js"
|
||||
# 位于 "assets/"
|
||||
# 或者
|
||||
# someJS = "https://cdn.example.com/some.js"
|
||||
---
|
||||
```
|
||||
|
||||
|
@ -125,6 +136,7 @@ comment:
|
|||
* **mapbox**: {{< version 0.2.0 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.mapbox` 部分相同.
|
||||
* **share**: 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.share` 部分相同.
|
||||
* **comment**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.comment` 部分相同.
|
||||
* **library**: {{< version 0.2.7 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.library` 部分相同.
|
||||
|
||||
## 3 内容摘要
|
||||
|
||||
|
|
|
@ -176,6 +176,14 @@
|
|||
{{- $config = $cookieconsentConfig | dict "cookieconsent" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.css -}}
|
||||
{{- dict "source" . "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.js -}}
|
||||
{{- dict "source" . "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 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 -}}
|
||||
|
|
Loading…
Reference in a new issue