Adding shortcode support to add call-to-actions to pages
This commit is contained in:
parent
28b7208ba2
commit
6b87626781
2 changed files with 25 additions and 0 deletions
9
data/call_to_actions/lid-worden.yaml
Normal file
9
data/call_to_actions/lid-worden.yaml
Normal file
|
@ -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"
|
16
themes/nluug/layouts/shortcodes/insert-cta.html
Normal file
16
themes/nluug/layouts/shortcodes/insert-cta.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{{ $context := . }}
|
||||
{{ $id := .Get "id" }}
|
||||
{{ with (index $.Site.Data.call_to_actions $id) }}
|
||||
{{ $language := $.Site.Language.Lang }}
|
||||
<div>
|
||||
{{ $string := "Tekst" }}
|
||||
{{- range $key, $value := .items -}}
|
||||
{{ if eq $value.language $language }}
|
||||
{{ $string = $value.text }}
|
||||
{{ if .page }}<a class="button" href="{{ relref $context .page }}">{{ end }}
|
||||
<span>{{ $string }}</span>
|
||||
{{ if .page }}</a>{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
Loading…
Reference in a new issue