From b495d84c6455a7af7a84a40f823f958d96061038 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 16 Aug 2022 09:15:35 -0700 Subject: [PATCH] Include p5 scripts if includes_p5_sketch is set in the page's .Scratch Update the p5_sketch shortcode to set that value in .Scratch --- layouts/partials/head.html | 5 +++++ layouts/shortcodes/p5_sketch.html | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a985838..b66055b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -50,6 +50,11 @@ {{ end }} + {{ if and .IsPage (.Page.Scratch.Get "includes_p5_sketch") }} + + + {{ end }} + {{ range $script := .Resources.Match "*.js" }} {{ end }} diff --git a/layouts/shortcodes/p5_sketch.html b/layouts/shortcodes/p5_sketch.html index c34b2df..60e27fa 100644 --- a/layouts/shortcodes/p5_sketch.html +++ b/layouts/shortcodes/p5_sketch.html @@ -1,2 +1,3 @@ {{ $id := .Get "id" }} -
\ No newline at end of file +{{ .Page.Scratch.Set "includes_p5_sketch" true }} +