diff options
| author | Alexander Dunkel <13646666+Sieboldianus@users.noreply.github.com> | 2019-08-18 16:27:31 +0200 |
|---|---|---|
| committer | Track3 <34504964+Track3@users.noreply.github.com> | 2019-08-18 22:27:31 +0800 |
| commit | 16c9d78ae518aebb65c3bca5871b2550bbabca16 (patch) | |
| tree | 6788f55696b07bb38ba9f3b82ebb2bfc1dfa737c /layouts/_default/baseof.html | |
| parent | a9f2ddcfa9f9c5ba93902995162c268f860c1750 (diff) | |
| download | hermit-16c9d78ae518aebb65c3bca5871b2550bbabca16.tar.gz | |
Add code copy button to all code fields in the blog (#81)
Diffstat (limited to 'layouts/_default/baseof.html')
| -rw-r--r-- | layouts/_default/baseof.html | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index cdb9a1f..6d312b6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -30,8 +30,17 @@ {{ block "header" . -}}{{ end -}} {{ block "main" . -}}{{ end -}} {{ block "footer" . -}}{{ end }} - {{ $script := resources.Get "js/main.js" | minify | fingerprint -}} - <script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script> + + {{ $main := resources.Get "js/main.js" -}} + {{ if .Site.Params.code_copy_button | default true -}} + {{ $codeCopy := resources.Get "js/code-copy.js" -}} + {{ $script := slice $main $codeCopy | resources.Concat "js/bundle.js" | minify | fingerprint -}} + <script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script> + {{ else -}} + {{ $script := $main | minify | fingerprint -}} + <script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script> + {{ end }} + {{- partial "analytics.html" . }} {{- if templates.Exists "partials/extra-foot.html" -}} {{ partial "extra-foot.html" . }} |
