Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat(CDN): replace CDN config with CDN data file (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq authored May 13, 2020
1 parent 762a7e5 commit 39159a9
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 279 deletions.
63 changes: 63 additions & 0 deletions assets/data/cdn/jsdelivr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
prefix:
libFiles: https://cdn.jsdelivr.net/npm/
# [email protected] https://github.com/simple-icons/simple-icons
simpleIcons: https://cdn.jsdelivr.net/npm/[email protected]/icons/
libFiles:
# [email protected] https://github.com/necolas/normalize.css
normalizeCSS: [email protected]/normalize.min.css
# [email protected] https://fontawesome.com/
fontawesomeFreeCSS: '@fortawesome/[email protected]/css/all.min.css'
# [email protected] https://github.com/daneden/animate.css
animateCSS: [email protected]/animate.min.css
# [email protected] https://github.com/cferdinandi/smooth-scroll
smoothScrollJS: [email protected]/dist/smooth-scroll.min.js
# [email protected] https://github.com/algolia/autocomplete.js
autocompleteJS: [email protected]/dist/autocomplete.min.js
# [email protected] https://lunrjs.com/
lunrJS: [email protected]/lunr.min.js
# [email protected] https://github.com/algolia/algoliasearch-client-javascript
algoliasearchJS: [email protected]/dist/algoliasearch-lite.umd.min.js
# [email protected] https://github.com/aFarkas/lazysizes
lazysizesJS: [email protected]/lazysizes.min.js
# [email protected] https://github.com/fregante/object-fit-images
objectFitImagesJS: [email protected]/dist/ofi.min.js
# [email protected] https://github.com/twitter/twemoji
twemojiJS: [email protected]/dist/twemoji.min.js
# [email protected] https://github.com/sachinchoolur/lightgallery.js
# [email protected] https://github.com/sachinchoolur/lg-thumbnail.js
# [email protected] https://github.com/sachinchoolur/lg-zoom.js
lightgalleryCSS: [email protected]/dist/css/lightgallery.min.css
lightgalleryJS: [email protected]/dist/js/lightgallery.min.js
lightgalleryThumbnailJS: [email protected]/dist/lg-thumbnail.min.js
lightgalleryZoomJS: [email protected]/dist/lg-zoom.min.js
# [email protected] https://github.com/zenorocha/clipboard.js
clipboardJS: [email protected]/dist/clipboard.min.js
# [email protected] https://github.com/ellisonleao/sharer.js
sharerJS: [email protected]/sharer.min.js
# [email protected] https://github.com/alexmacarthur/typeit
typeitJS: [email protected]/dist/typeit.min.js
# [email protected] https://katex.org/
katexCSS: [email protected]/dist/katex.min.css
katexJS: [email protected]/dist/katex.min.js
katexAutoRenderJS: [email protected]/dist/contrib/auto-render.min.js
katexCopyTexCSS: [email protected]/dist/contrib/copy-tex.min.css
katexCopyTexJS: [email protected]/dist/contrib/copy-tex.min.js
katexMhchemJS: [email protected]/dist/contrib/mhchem.min.js
# [email protected] https://github.com/knsv/mermaid
mermaidJS: [email protected]/dist/mermaid.min.js
# [email protected] https://echarts.apache.org/
echartsJS: [email protected]/dist/echarts.min.js
echartsMacaronsJS: [email protected]/theme/macarons.min.js
# [email protected] https://docs.mapbox.com/mapbox-gl-js
mapboxGLCSS: [email protected]/dist/mapbox-gl.min.css
mapboxGLJS: [email protected]/dist/mapbox-gl.min.js
# [email protected] https://github.com/MoePlayer/APlayer
aplayerCSS: [email protected]/dist/APlayer.min.css
aplayerJS: [email protected]/dist/APlayer.min.js
# [email protected] https://github.com/metowolf/MetingJS
metingJS: [email protected]/dist/Meting.min.js
# [email protected] https://github.com/gitalk/gitalk
gitalkCSS: [email protected]/dist/gitalk.min.css
gitalkJS: [email protected]/dist/gitalk.min.js
# [email protected] https://valine.js.org/
valineJS: [email protected]/dist/Valine.min.js
88 changes: 21 additions & 67 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -876,12 +876,16 @@ enableEmoji = true
highlight = true
enableQQ = false
serverURLs = ""
# emoji config file name, default is "google.yml"
# emoji data file name, default is "google.yml"
# ("apple.yml", "google.yml", "facebook.yml", "twitter.yml")
# located in "assets/data/emoji/" directory, where you can put your config file
# emoji 配置文件名称, 默认是 "facebook.yml"
# located in "themes/LoveIt/assets/data/emoji/" directory
# you can store your own data files in the same path under your project:
# "assets/data/emoji/"
# emoji 数据文件名称, 默认是 "google.yml"
# ("apple.yml", "google.yml", "facebook.yml", "twitter.yml")
# 位于 "assets/data/emoji/" 目录, 你可以在此存放你自己的配置文件
# 位于 "themes/LoveIt/assets/data/emoji/" 目录
# 可以在你的项目下相同路径存放你自己的数据文件:
# "assets/data/emoji/"
emoji = ""
# Facebook comment config (https://developers.facebook.com/docs/plugins/comments)
# Facebook 评论系统设置 (https://developers.facebook.com/docs/plugins/comments)
Expand Down Expand Up @@ -982,70 +986,20 @@ enableEmoji = true
# 自行托管追踪器时的主机路径
server = ""

# CSS and JS Files CDN
# CSS 和 JS 文件的 CDN 设置
# CDN config for third-party library files
# 第三方库文件的 CDN 设置
[params.cdn]
# [email protected] https://github.com/necolas/normalize.css
normalizeCSS = ""
# [email protected] https://fontawesome.com/
fontawesomeFreeCSS = ""
# [email protected] https://github.com/simple-icons/simple-icons
# ("https://cdn.jsdelivr.net/npm/simple-icons@v2/icons/")
simpleIconsPrefix = ""
# [email protected] https://github.com/daneden/animate.css
animateCSS = ""
# [email protected] https://github.com/cferdinandi/smooth-scroll
smoothScrollJS = ""
# [email protected] https://github.com/algolia/autocomplete.js
autocompleteJS = ""
# [email protected] https://lunrjs.com/
lunrJS = ""
# [email protected] https://github.com/algolia/algoliasearch-client-javascript
algoliasearchJS = ""
# [email protected] https://github.com/aFarkas/lazysizes
lazysizesJS = ""
# [email protected] https://github.com/fregante/object-fit-images
objectFitImagesJS = ""
# [email protected] https://github.com/twitter/twemoji
twemojiJS = ""
# [email protected] https://github.com/sachinchoolur/lightgallery.js
# [email protected] https://github.com/sachinchoolur/lg-thumbnail.js
# [email protected] https://github.com/sachinchoolur/lg-zoom.js
lightgalleryCSS = ""
lightgalleryJS = ""
lightgalleryThumbnailJS = ""
lightgalleryZoomJS = ""
# [email protected] https://github.com/zenorocha/clipboard.js
clipboardJS = ""
# [email protected] https://github.com/ellisonleao/sharer.js
sharerJS = ""
# [email protected] https://github.com/alexmacarthur/typeit
typeitJS = ""
# [email protected] https://katex.org/
katexCSS = ""
katexJS = ""
katexAutoRenderJS = ""
katexCopyTexCSS = ""
katexCopyTexJS = ""
katexMhchemJS = ""
# [email protected] https://github.com/knsv/mermaid
mermaidJS = ""
# [email protected] https://echarts.apache.org/
echartsJS = ""
echartsMacaronsJS = ""
# [email protected] https://docs.mapbox.com/mapbox-gl-js
mapboxGLCSS = ""
mapboxGLJS = ""
# [email protected] https://github.com/MoePlayer/APlayer
aplayerCSS = ""
aplayerJS = ""
# [email protected] https://github.com/metowolf/MetingJS
metingJS = ""
# [email protected] https://github.com/gitalk/gitalk
gitalkCSS = ""
gitalkJS = ""
# [email protected] https://valine.js.org/
valineJS = ""
# CDN data file name, disabled by default
# ("jsdelivr.yml")
# located in "themes/LoveIt/assets/data/cdn/" directory
# you can store your own data files in the same path under your project:
# "assets/data/cdn/"
# CDN 数据文件名称, 默认不启用
# ("jsdelivr.yml")
# 位于 "themes/LoveIt/assets/data/cdn/" 目录
# 可以在你的项目下相同路径存放你自己的数据文件:
# "assets/data/cdn/"
data = "jsdelivr.yml"

# Markup related configuration in Hugo
# Hugo 解析文档的配置
Expand Down
91 changes: 21 additions & 70 deletions exampleSite/content/posts/theme-documentation-basics/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,11 @@ Please open the code block below to view the complete sample configuration :(far
highlight = true
enableQQ = false
serverURLs = ""
# {{< version 0.2.6 >}} emoji config file name, default is "facebook.yml"
# {{< version 0.2.6 >}} emoji data file name, default is "google.yml"
# ("apple.yml", "google.yml", "facebook.yml", "twitter.yml")
# located in "assets/data/emoji/" directory, where you can put your config file
# located in "themes/LoveIt/assets/data/emoji/" directory
# you can store your own data files in the same path under your project:
# "assets/data/emoji/"
emoji = ""
# {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook comment" >}} config
[params.page.comment.facebook]
Expand Down Expand Up @@ -602,69 +604,14 @@ Please open the code block below to view the complete sample configuration :(far
# server url for your tracker if you're self hosting
server = ""

# CSS and JS Files CDN config
# {{< version 0.2.7 changed >}} CDN config for third-party library files
[params.cdn]
# {{< version 0.2.0 >}} {{< link "https://github.com/necolas/normalize.css" "normalize.css" >}}@8.0.1
normalizeCSS = ""
# {{< link "https://fontawesome.com/" "fontawesome-free" >}}@5.13.0
fontawesomeFreeCSS = ""
# {{< version 0.2.0 >}} {{< link "https://github.com/simple-icons/simple-icons" "simple-icons" >}}@2.9.0
# ("https://cdn.jsdelivr.net/npm/simple-icons@v2/icons/")
simpleIconsPrefix = ""
# [email protected] https://github.com/daneden/animate.css
animateCSS = ""
# {{< link "https://github.com/cferdinandi/smooth-scroll" "smooth-scroll" >}}@16.1.3
smoothScrollJS = ""
# {{< version 0.2.0 >}} {{< link "https://github.com/algolia/autocomplete.js" "autocomplete.js" >}}@0.37.1
autocompleteJS = ""
# {{< version 0.2.0 >}} {{< link "https://lunrjs.com/" "lunr.js" >}}@2.3.8
lunrJS = ""
# {{< version 0.2.0 >}} {{< link "https://github.com/algolia/algoliasearch-client-javascript" "algoliasearch" >}}@4.2.0
algoliasearchJS = ""
# {{< link "https://github.com/aFarkas/lazysizes" "lazysizes" >}}@5.2.0
lazysizesJS = ""
# {{< version 0.2.3 >}} {{< link "https://github.com/fregante/object-fit-images" "object-fit-images" >}}@3.2.4
objectFitImagesJS = ""
# {{< version 0.2.0 >}} {{< link "https://github.com/twitter/twemoji" "twemoji" >}}@12.1.5
twemojiJS = ""
# {{< link "https://github.com/sachinchoolur/lightgallery.js" "lightgallery.js" >}}@1.1.3
# {{< link "https://github.com/sachinchoolur/lg-thumbnail.js" "lg-thumbnail.js" >}}@1.1.0
# {{< link "https://github.com/sachinchoolur/lg-zoom.js" "lg-zoom.js" >}}@1.0.1
lightgalleryCSS = ""
lightgalleryJS = ""
lightgalleryThumbnailJS = ""
lightgalleryZoomJS = ""
# {{< version 0.2.0 >}} {{< link "https://github.com/zenorocha/clipboard.js" "clipboard.js" >}}@2.0.6
clipboardJS = ""
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer.js" >}}@0.4.0
sharerJS = ""
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@7.0.4
typeitJS = ""
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = ""
katexJS = ""
katexAutoRenderJS = ""
katexCopyTexCSS = ""
katexCopyTexJS = ""
katexMhchemJS = ""
# {{< link "https://github.com/knsv/mermaid" "mermaid" >}}@8.5.0
mermaidJS = ""
# {{< link "https://echarts.apache.org/" "echarts" >}}@4.7.0
echartsJS = ""
echartsMacaronsJS = ""
# {{< version 0.2.0 >}} {{< link "https://docs.mapbox.com/mapbox-gl-js" mapbox-gl >}}@1.10.0
mapboxGLCSS = ""
mapboxGLJS = ""
# {{< link "https://github.com/MoePlayer/APlayer" "aplayer" >}}@1.10.1
aplayerCSS = ""
aplayerJS = ""
# {{< link "https://github.com/metowolf/MetingJS" "meting" >}}@2.0.1
metingJS = ""
# {{< link "https://github.com/gitalk/gitalk" "gitalk" >}}@1.6.2
gitalkCSS = ""
gitalkJS = ""
# {{< link "https://valine.js.org/" "valine" >}}@1.4.14
valineJS = ""
# CDN data file name, disabled by default
# ("jsdelivr.yml")
# located in "themes/LoveIt/assets/data/cdn/" directory
# you can store your own data files in the same path under your project:
# "assets/data/cdn/"
data = ""

# Markup related config in Hugo
[markup]
Expand Down Expand Up @@ -757,13 +704,17 @@ You could enable these features with `hugo serve -e production`.
{{< /admonition >}}

{{< admonition tip "Tips about CDN Configuration" >}}
Full HTML tags or URLs are supported for CDN configuration:
{{< version 0.2.7 changed >}}

```toml
smoothScrollJS = '<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/smooth-scroll.min.js" integrity="sha256-vP+F+14A1ogChQs5Osd5LJl/ci9TbzjiZjjEbcqOXrY=" crossorigin="anonymous"></script>'
# Or
smoothScrollJS = 'https://cdn.jsdelivr.net/npm/smooth-scroll@16/dist/smooth-scroll.min.js'
```
[params.cdn]
# CDN data file name, disabled by default
# ("jsdelivr.yml")
data = ""
````

The default CDN data file is located in `themes/LoveIt/assets/data/cdn/` directory.
You can store your own data file in the same path under your project: `assets/data/cdn/`.
{{< /admonition >}}

{{< admonition tip "Tips about social Configuration" >}}
Expand Down Expand Up @@ -793,7 +744,7 @@ Or You can set more options through a dict:
title = "Mastodon"
```

The default configuration of all supported social links is located in `themes/LoveIt/assets/data/social.yaml`,
The default data of all supported social links is located in `themes/LoveIt/assets/data/social.yaml`,
which is you can refer to.
{{< /admonition >}}

Expand Down
Loading

0 comments on commit 39159a9

Please sign in to comment.