feat(page): add custom page library support (css and js) (#357)
This commit is contained in:
@@ -920,6 +920,19 @@ enableEmoji = true
|
|||||||
label = ""
|
label = ""
|
||||||
lightTheme = "github-light"
|
lightTheme = "github-light"
|
||||||
darkTheme = "github-dark"
|
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 config
|
||||||
# SEO 配置
|
# SEO 配置
|
||||||
[params.page.seo]
|
[params.page.seo]
|
||||||
|
|||||||
@@ -551,6 +551,18 @@ Please open the code block below to view the complete sample configuration :(far
|
|||||||
label = ""
|
label = ""
|
||||||
lightTheme = "github-light"
|
lightTheme = "github-light"
|
||||||
darkTheme = "github-dark"
|
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
|
# {{< version 0.2.0 >}} SEO config
|
||||||
[params.page.seo]
|
[params.page.seo]
|
||||||
# Publisher info
|
# Publisher info
|
||||||
|
|||||||
@@ -556,6 +556,18 @@ Please open the code block below to view the complete sample configuration :(far
|
|||||||
label = ""
|
label = ""
|
||||||
lightTheme = "github-light"
|
lightTheme = "github-light"
|
||||||
darkTheme = "github-dark"
|
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
|
# {{< version 0.2.0 >}} SEO config
|
||||||
[params.page.seo]
|
[params.page.seo]
|
||||||
# Publisher info
|
# Publisher info
|
||||||
|
|||||||
@@ -554,6 +554,18 @@ hugo
|
|||||||
label = ""
|
label = ""
|
||||||
lightTheme = "github-light"
|
lightTheme = "github-light"
|
||||||
darkTheme = "github-dark"
|
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
|
# {{< version 0.2.0 >}} SEO config
|
||||||
[params.page.seo]
|
[params.page.seo]
|
||||||
# 出版者信息
|
# 出版者信息
|
||||||
|
|||||||
@@ -90,6 +90,17 @@ share:
|
|||||||
comment:
|
comment:
|
||||||
enable: true
|
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).
|
* **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).
|
* **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).
|
* **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
|
## 3 Content Summaries
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,17 @@ share:
|
|||||||
comment:
|
comment:
|
||||||
enable: true
|
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).
|
* **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).
|
* **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).
|
* **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
|
## 3 Content Summaries
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,17 @@ share:
|
|||||||
comment:
|
comment:
|
||||||
enable: true
|
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` 部分相同.
|
* **mapbox**: {{< version 0.2.0 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.mapbox` 部分相同.
|
||||||
* **share**: 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.share` 部分相同.
|
* **share**: 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.share` 部分相同.
|
||||||
* **comment**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.comment` 部分相同.
|
* **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 内容摘要
|
## 3 内容摘要
|
||||||
|
|
||||||
|
|||||||
@@ -176,6 +176,14 @@
|
|||||||
{{- $config = $cookieconsentConfig | dict "cookieconsent" | merge $config -}}
|
{{- $config = $cookieconsentConfig | dict "cookieconsent" | merge $config -}}
|
||||||
{{- end -}}
|
{{- 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 */ -}}
|
{{- /* Theme script */ -}}
|
||||||
{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}}
|
||||||
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user