From 6b87626781df807d045f1402ba4da01678652cce Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Thu, 7 Nov 2024 14:48:32 +0000 Subject: [PATCH] Adding shortcode support to add call-to-actions to pages --- data/call_to_actions/lid-worden.yaml | 9 +++++++++ themes/nluug/layouts/shortcodes/insert-cta.html | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 data/call_to_actions/lid-worden.yaml create mode 100644 themes/nluug/layouts/shortcodes/insert-cta.html diff --git a/data/call_to_actions/lid-worden.yaml b/data/call_to_actions/lid-worden.yaml new file mode 100644 index 0000000..ac859bf --- /dev/null +++ b/data/call_to_actions/lid-worden.yaml @@ -0,0 +1,9 @@ +id: lid-worden +items: + - item: en + language: en + text: Become a member! + - item: nl + language: nl + text: Word lid! + page: "lidmaatschap/aanmelden/index.md" diff --git a/themes/nluug/layouts/shortcodes/insert-cta.html b/themes/nluug/layouts/shortcodes/insert-cta.html new file mode 100644 index 0000000..e661b69 --- /dev/null +++ b/themes/nluug/layouts/shortcodes/insert-cta.html @@ -0,0 +1,16 @@ +{{ $context := . }} +{{ $id := .Get "id" }} +{{ with (index $.Site.Data.call_to_actions $id) }} +{{ $language := $.Site.Language.Lang }} +
+ {{ $string := "Tekst" }} + {{- range $key, $value := .items -}} + {{ if eq $value.language $language }} + {{ $string = $value.text }} + {{ if .page }}{{ end }} + {{ $string }} + {{ if .page }}{{ end }} + {{ end }} + {{ end }} +
+{{ end }}