From 16c9d78ae518aebb65c3bca5871b2550bbabca16 Mon Sep 17 00:00:00 2001 From: Alexander Dunkel <13646666+Sieboldianus@users.noreply.github.com> Date: Sun, 18 Aug 2019 16:27:31 +0200 Subject: Add code copy button to all code fields in the blog (#81) --- layouts/_default/baseof.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'layouts/_default/baseof.html') 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 -}} - + + {{ $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 -}} + + {{ else -}} + {{ $script := $main | minify | fingerprint -}} + + {{ end }} + {{- partial "analytics.html" . }} {{- if templates.Exists "partials/extra-foot.html" -}} {{ partial "extra-foot.html" . }} -- cgit v1.2.3