From 033a780507575a207f4aabefce47aee951d4fce4 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 31 Oct 2022 07:49:31 -0700 Subject: [PATCH] Use .HasShortcode instead of setting the "includes_" variables in .Page.Store --- layouts/_default/single.html | 6 +++--- layouts/shortcodes/figures/p5.html | 3 +-- layouts/shortcodes/figures/railroad.html | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d3aa6a1..dfaae82 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -7,19 +7,19 @@ {{ end }} {{ define "styles" }} - {{- if .Page.Scratch.Get "includes_railroad_diagram" -}} + {{- if .HasShortcode "figures/railroad" -}} {{- end -}} {{ end }} {{ define "scripts" }} - {{- if .Page.Store.Get "includes_railroad_diagram" -}} + {{- if .HasShortcode "figures/railroad" -}} {{- end -}} - {{- if .Page.Store.Get "includes_p5_sketch" -}} + {{- if .HasShortcode "figures/p5" -}} {{- end -}} diff --git a/layouts/shortcodes/figures/p5.html b/layouts/shortcodes/figures/p5.html index 1cd1c08..bef42b9 100644 --- a/layouts/shortcodes/figures/p5.html +++ b/layouts/shortcodes/figures/p5.html @@ -1,5 +1,4 @@ -{{ $id := .Get "id" }} -{{ .Page.Store.Set "includes_p5_sketch" true }} +{{- $id := .Get "id" -}}
diff --git a/layouts/shortcodes/figures/railroad.html b/layouts/shortcodes/figures/railroad.html index a20d813..617ba83 100644 --- a/layouts/shortcodes/figures/railroad.html +++ b/layouts/shortcodes/figures/railroad.html @@ -1,4 +1,3 @@ {{- $id := .Get "id" -}} -{{- .Page.Store.Set "includes_railroad_diagram" true -}}
{{ .Inner }}