diff --git a/README.md b/README.md index 6ddba56..60404f8 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,15 @@ type: archives Host = "https://cdn.jsdelivr.net/gh/user/user.github.io" ``` +#### JS CDN + +国内建议换成:cdn.bootcdn.net + +```toml +[params] + cdnJsSite = "cdn.bootcdn.net" # 默认:cdnjs.cloudflare.com +``` + #### Disqus 该主题支持Disqus评论,如果要启用Disqus,可以在`config.toml`里添加如下配置即可. diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 098fb77..0a27042 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -2,7 +2,7 @@ baseURL = "https://www.flysnow.org" languageCode = "zh-CN" title = "飞雪无情的博客" theme = "maupassant" -googleAnalytics = "" # UA-XXXXXXXX-X +googleAnalytics = "" # UA-XXXXXXXX-X/G-XXXXXXXXXX ## 保持分类的原始名字(false会做转小写处理) preserveTaxonomyNames = true diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index cb42202..d5075d9 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -20,9 +20,10 @@ {{ if .IsPage }} + {{ $defaultCdnJsSite := "cdnjs.cloudflare.com" }} {{- if and (or .Params.graphviz.enable (and .Site.Params.graphviz.enable (ne .Params.graphviz.enable false))) (or .IsPage .IsHome) -}} - + - + + - - - + + + + - + {{- if .Site.Params.fancybox -}} - + {{- end -}} {{ end }} -{{ template "_internal/google_analytics_async.html" . }} +{{- if hasPrefix .Site.GoogleAnalytics "UA-" -}} + {{ template "_internal/google_analytics_async.html" . }} +{{- else if hasPrefix .Site.GoogleAnalytics "G-" -}} + {{ template "_internal/google_analytics.html" . }} +{{- end -}} {{ if .Site.Params.busuanzi }}