diff options
author | shalk(xiao kun) <xshalk@163.com> | 2018-09-11 10:47:38 +0300 |
---|---|---|
committer | Chen Xianmin <xianmin12@gmail.com> | 2018-09-11 10:47:38 +0300 |
commit | 5fb2c8a6648128e985c177af9f9b1f0c5e6c262b (patch) | |
tree | 156440338172385dc952e6384c417ccc859dee88 | |
parent | 91a6156ab9c3bcf6c48892d21508d326c725c38b (diff) |
feat: add photoswip CDN (#115)
-rw-r--r-- | exampleSite/config.toml | 4 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/partials/photoswipe.html | 3 | ||||
-rw-r--r-- | layouts/partials/scripts.html | 4 |
4 files changed, 12 insertions, 1 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0ef23c0..f163822 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -114,6 +114,10 @@ defaultContentLanguage = "en" # Default language to use slideout = '<script src="https://cdn.jsdelivr.net/npm/slideout@1.0.1/dist/slideout.min.js" integrity="sha256-t+zJ/g8/KXIJMjSVQdnibt4dlaDxc9zXr/9oNPeWqdg=" crossorigin="anonymous"></script>' gitmentJS = '<script src="https://cdn.jsdelivr.net/npm/gitment@0.0.3/dist/gitment.browser.min.js" crossorigin="anonymous"></script>' gitmentCSS = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitment@0.0.3/style/default.min.css" crossorigin="anonymous">' + photoswipe = '<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/photoswipe.min.js" integrity="sha256-iG1tiE5xJSJQhKdeOW4cPiSy+RTrnRKjjjrVQ0hexug=" crossorigin="anonymous"></script>' + photoswipe-ui = '<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/photoswipe-ui-default.min.js" integrity="sha256-XvSk6Opq7XZ8oUcx213MtikXtbl5bbe4Q9tr4+NJBCg=" crossorigin="anonymous"></script>' + photoswipeCSS = '<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/photoswipe.min.css" integrity="undefined" crossorigin="anonymous"></script>' + photoswipeSKIN = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/default-skin/default-skin.css" integrity="sha256-c0uckgykQ9v5k+IqViZOZKc47Jn7KQil4/MP3ySA3F8=" crossorigin="anonymous">' [params.utteranc] # utteranc is a comment system based on GitHub issues. see https://utteranc.es enable = false diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f4b2597..50f0a9d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -14,7 +14,7 @@ {{ partial "slideout.html" . }} {{ if or .Site.Params.photoswipe .Site.Params.fancybox }} - {{ partial "photoswipe.html" }} + {{ partial "photoswipe.html" . }} {{ end }} {{ if .Site.Params.forkMeOnGithub }} diff --git a/layouts/partials/photoswipe.html b/layouts/partials/photoswipe.html index 9265bb5..c0f5af0 100644 --- a/layouts/partials/photoswipe.html +++ b/layouts/partials/photoswipe.html @@ -17,6 +17,9 @@ Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ {{ if .Site.Params.bootcdn }} <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/photoswipe.min.css" integrity="sha256-sCl5PUOGMLfFYctzDW3MtRib0ctyUvI9Qsmq2wXOeBY=" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/default-skin/default-skin.min.css" integrity="sha256-BFeI1V+Vh1Rk37wswuOYn5lsTcaU96hGaI7OUVCLjPc=" crossorigin="anonymous" /> +{{ else if .Site.Params.publicCDN.enable }} + {{ .Site.Params.publicCDN.photoswipeCSS | safeHTML }} + {{ .Site.Params.publicCDN.photoswipeSkin | safeHTML }} {{ else }} <link rel="stylesheet" href="{{ "/lib/photoswipe/photoswipe.min.css" | relURL }}" /> <link rel="stylesheet" href="{{ "/lib/photoswipe/default-skin/default-skin.min.css" | relURL }}" /> diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 5d451a5..f176053 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -74,6 +74,10 @@ crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/photoswipe-ui-default.min.js" integrity="sha256-PWHOlUzc96pMc8ThwRIXPn8yH4NOLu42RQ0b9SpnpFk=" crossorigin="anonymous"></script> + {{ else if .Site.Params.publicCDN.enable }} + <script type="text/javascript" src="{{ "/js/load-photoswipe.js" | relURL }}"></script> + {{ .Site.Params.publicCDN.photoswipe | safeHTML }} + {{ .Site.Params.publicCDN.photoswipeUI | safeHTML }} {{ else }} <script type="text/javascript" src="{{ "/js/load-photoswipe.js" | relURL }}"></script> <script type="text/javascript" src="{{ "/lib/photoswipe/photoswipe.min.js" | relURL}}"></script> |