diff --git a/assets/data/cdn/jsdelivr.yml b/assets/data/cdn/jsdelivr.yml new file mode 100644 index 0000000..8832de4 --- /dev/null +++ b/assets/data/cdn/jsdelivr.yml @@ -0,0 +1,63 @@ +prefix: + libFiles: https://cdn.jsdelivr.net/npm/ + # simple-icons@2.9.0 https://github.com/simple-icons/simple-icons + simpleIcons: https://cdn.jsdelivr.net/npm/simple-icons@2.9.0/icons/ +libFiles: + # normalize.css@8.0.1 https://github.com/necolas/normalize.css + normalizeCSS: normalize.css@8.0.1/normalize.min.css + # fontawesome-free@5.13.0 https://fontawesome.com/ + fontawesomeFreeCSS: '@fortawesome/fontawesome-free@5.13.0/css/all.min.css' + # animate.css@3.7.2 https://github.com/daneden/animate.css + animateCSS: animate.css@3.7.2/animate.min.css + # smooth-scroll@16.1.3 https://github.com/cferdinandi/smooth-scroll + smoothScrollJS: smooth-scroll@16.1.3/dist/smooth-scroll.min.js + # autocomplete.js@0.37.1 https://github.com/algolia/autocomplete.js + autocompleteJS: autocomplete.js@0.37.1/dist/autocomplete.min.js + # lunr.js@2.3.8 https://lunrjs.com/ + lunrJS: lunr@2.3.8/lunr.min.js + # algoliasearch@4.2.0 https://github.com/algolia/algoliasearch-client-javascript + algoliasearchJS: algoliasearch@4.2.0/dist/algoliasearch-lite.umd.min.js + # lazysizes@5.2.0 https://github.com/aFarkas/lazysizes + lazysizesJS: lazysizes@5.2.0/lazysizes.min.js + # object-fit-images@3.2.4 https://github.com/fregante/object-fit-images + objectFitImagesJS: object-fit-images@3.2.4/dist/ofi.min.js + # twemoji@12.1.5 https://github.com/twitter/twemoji + twemojiJS: twemoji@12.1.5/dist/twemoji.min.js + # lightgallery.js@1.1.3 https://github.com/sachinchoolur/lightgallery.js + # 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 + lightgalleryCSS: lightgallery.js@1.1.3/dist/css/lightgallery.min.css + lightgalleryJS: lightgallery.js@1.1.3/dist/js/lightgallery.min.js + lightgalleryThumbnailJS: lg-thumbnail.js@1.1.0/dist/lg-thumbnail.min.js + lightgalleryZoomJS: lg-zoom.js@1.0.1/dist/lg-zoom.min.js + # clipboard.js@2.0.6 https://github.com/zenorocha/clipboard.js + clipboardJS: clipboard@2.0.6/dist/clipboard.min.js + # sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js + sharerJS: sharer.js@0.4.0/sharer.min.js + # typeit@7.0.4 https://github.com/alexmacarthur/typeit + typeitJS: typeit@7.0.4/dist/typeit.min.js + # katex@0.11.1 https://katex.org/ + katexCSS: katex@0.11.1/dist/katex.min.css + katexJS: katex@0.11.1/dist/katex.min.js + katexAutoRenderJS: katex@0.11.1/dist/contrib/auto-render.min.js + katexCopyTexCSS: katex@0.11.1/dist/contrib/copy-tex.min.css + katexCopyTexJS: katex@0.11.1/dist/contrib/copy-tex.min.js + katexMhchemJS: katex@0.11.1/dist/contrib/mhchem.min.js + # mermaid@8.5.0 https://github.com/knsv/mermaid + mermaidJS: mermaid@8.5.0/dist/mermaid.min.js + # echarts@4.7.0 https://echarts.apache.org/ + echartsJS: echarts@4.7.0/dist/echarts.min.js + echartsMacaronsJS: echarts@4.7.0/theme/macarons.min.js + # mapbox-gl@1.10.0 https://docs.mapbox.com/mapbox-gl-js + mapboxGLCSS: mapbox-gl@1.10.0/dist/mapbox-gl.min.css + mapboxGLJS: mapbox-gl@1.10.0/dist/mapbox-gl.min.js + # aplayer@1.10.1 https://github.com/MoePlayer/APlayer + aplayerCSS: aplayer@1.10.1/dist/APlayer.min.css + aplayerJS: aplayer@1.10.1/dist/APlayer.min.js + # meting@2.0.1 https://github.com/metowolf/MetingJS + metingJS: meting@2.0.1/dist/Meting.min.js + # gitalk@1.6.2 https://github.com/gitalk/gitalk + gitalkCSS: gitalk@1.6.2/dist/gitalk.min.css + gitalkJS: gitalk@1.6.2/dist/gitalk.min.js + # valine@1.4.14 https://valine.js.org/ + valineJS: valine@1.4.14/dist/Valine.min.js diff --git a/exampleSite/config.toml b/exampleSite/config.toml index f590e6d..2301fa7 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -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) @@ -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] - # normalize.css@8.0.1 https://github.com/necolas/normalize.css - normalizeCSS = "" - # fontawesome-free@5.13.0 https://fontawesome.com/ - fontawesomeFreeCSS = "" - # simple-icons@2.9.0 https://github.com/simple-icons/simple-icons - # ("https://cdn.jsdelivr.net/npm/simple-icons@v2/icons/") - simpleIconsPrefix = "" - # animate.css@3.7.2 https://github.com/daneden/animate.css - animateCSS = "" - # smooth-scroll@16.1.3 https://github.com/cferdinandi/smooth-scroll - smoothScrollJS = "" - # autocomplete.js@0.37.1 https://github.com/algolia/autocomplete.js - autocompleteJS = "" - # lunr.js@2.3.8 https://lunrjs.com/ - lunrJS = "" - # algoliasearch@4.2.0 https://github.com/algolia/algoliasearch-client-javascript - algoliasearchJS = "" - # lazysizes@5.2.0 https://github.com/aFarkas/lazysizes - lazysizesJS = "" - # object-fit-images@3.2.4 https://github.com/fregante/object-fit-images - objectFitImagesJS = "" - # twemoji@12.1.5 https://github.com/twitter/twemoji - twemojiJS = "" - # lightgallery.js@1.1.3 https://github.com/sachinchoolur/lightgallery.js - # 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 - lightgalleryCSS = "" - lightgalleryJS = "" - lightgalleryThumbnailJS = "" - lightgalleryZoomJS = "" - # clipboard.js@2.0.6 https://github.com/zenorocha/clipboard.js - clipboardJS = "" - # sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js - sharerJS = "" - # typeit@7.0.4 https://github.com/alexmacarthur/typeit - typeitJS = "" - # katex@0.11.1 https://katex.org/ - katexCSS = "" - katexJS = "" - katexAutoRenderJS = "" - katexCopyTexCSS = "" - katexCopyTexJS = "" - katexMhchemJS = "" - # mermaid@8.5.0 https://github.com/knsv/mermaid - mermaidJS = "" - # echarts@4.7.0 https://echarts.apache.org/ - echartsJS = "" - echartsMacaronsJS = "" - # mapbox-gl@1.10.0 https://docs.mapbox.com/mapbox-gl-js - mapboxGLCSS = "" - mapboxGLJS = "" - # aplayer@1.10.1 https://github.com/MoePlayer/APlayer - aplayerCSS = "" - aplayerJS = "" - # meting@2.0.1 https://github.com/metowolf/MetingJS - metingJS = "" - # gitalk@1.6.2 https://github.com/gitalk/gitalk - gitalkCSS = "" - gitalkJS = "" - # valine@1.4.14 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 解析文档的配置 diff --git a/exampleSite/content/posts/theme-documentation-basics/index.en.md b/exampleSite/content/posts/theme-documentation-basics/index.en.md index 04eea63..be36c32 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.en.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.en.md @@ -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] @@ -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 = "" - # animate.css@3.7.2 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] @@ -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 = '' -# 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" >}} @@ -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 >}} diff --git a/exampleSite/content/posts/theme-documentation-basics/index.fr.md b/exampleSite/content/posts/theme-documentation-basics/index.fr.md index 27b3175..7537ee5 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.fr.md @@ -521,9 +521,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] @@ -607,69 +609,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 = "" - # animate.css@3.7.2 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] @@ -762,13 +709,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 = '' -# 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" >}} @@ -798,7 +749,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 >}} @@ -864,6 +815,7 @@ In `config/css/_custom.scss`, you can add some css style code to customize the s | 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): | | German | `de` | `de` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | +| German | `de` | `de` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | Serbian | `sr` | `sr` | :(far fa-square fa-fw): | :(far fa-square fa-fw): | | Russian | `ru` | `ru` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | | Romanian | `ro` | `ro` | :(far fa-square fa-fw): | :(far fa-check-square fa-fw): | diff --git a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md index 98d7bc9..e24afc3 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md @@ -519,9 +519,11 @@ hugo highlight = true enableQQ = false serverURLs = "" - # {{< version 0.2.6 >}} emoji 配置文件名称, 默认是 "facebook.yml" + # {{< version 0.2.6 >}} emoji 数据文件名称, 默认是 "google.yml" # ("apple.yml", "google.yml", "facebook.yml", "twitter.yml") - # 位于 "assets/data/emoji/" 目录, 你可以在此存放你自己的配置文件 + # 位于 "themes/LoveIt/assets/data/emoji/" 目录 + # 可以在你的项目下相同路径存放你自己的数据文件: + # "assets/data/emoji/" emoji = "" # {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook 评论系统" >}}设置 [params.page.comment.facebook] @@ -605,69 +607,14 @@ hugo # 自行托管追踪器时的主机路径 server = "" - # CSS 和 JS 文件的 CDN 设置 + # {{< version 0.2.7 changed >}} 第三方库文件的 CDN 设置 [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 = "" - # animate.css@3.7.2 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 数据文件名称, 默认不启用 + # ("jsdelivr.yml") + # 位于 "themes/LoveIt/assets/data/cdn/" 目录 + # 可以在你的项目下相同路径存放你自己的数据文件: + # "assets/data/cdn/" + data = "" # Hugo 解析文档的配置 [markup] @@ -761,13 +708,17 @@ hugo {{< /admonition >}} {{< admonition tip "关于 CDN 配置的技巧" >}} -在 CDN 的配置中, 完整的 HTML 标签和 URL 都是支持的: +{{< version 0.2.7 changed >}} ```toml -smoothScrollJS = '' -# 或者 -smoothScrollJS = 'https://cdn.jsdelivr.net/npm/smooth-scroll@16/dist/smooth-scroll.min.js' -``` +[params.cdn] + # CDN 数据文件名称, 默认不启用 + # ("jsdelivr.yml") + data = "" +```` + +默认的 CDN 数据文件位于 `themes/LoveIt/assets/data/cdn/` 目录. +可以在你的项目下相同路径存放你自己的数据文件: `assets/data/cdn/`. {{< /admonition >}} {{< admonition tip "关于社交链接配置的技巧" >}} @@ -797,7 +748,7 @@ smoothScrollJS = 'https://cdn.jsdelivr.net/npm/smooth-scroll@16/dist/smooth-scro title = "Mastodon" ``` -所有支持的社交链接的默认配置位于 `themes/LoveIt/assets/data/social.yaml`. +所有支持的社交链接的默认数据位于 `themes/LoveIt/assets/data/social.yaml`. 你可以参考它来配置你的社交链接. {{< /admonition >}} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 9490a6e..07b6e5e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -13,7 +13,16 @@ {{- $params := .Params | merge .Site.Params.page -}} {{- if eq hugo.Environment "production" -}} - {{- .Scratch.Set "cdn" .Site.Params.cdn -}} + {{- $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 -}} diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index 1f18b30..c642365 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -51,7 +51,7 @@ {{- with $valine.serverURLs -}} {{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}} {{- end -}} - {{- $commentConfig = $valine.emoji | default "facebook.yml" | printf "data/emoji/%s" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}} + {{- $commentConfig = $valine.emoji | default "google.yml" | printf "data/emoji/%s" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}}