Render memberships as JSON

This commit is contained in:
2023-11-11 10:35:35 +00:00
parent 397b9d3ef9
commit e5fe560671
2 changed files with 10 additions and 0 deletions

View File

@@ -4,6 +4,9 @@ subtitle: Become part of our community.
hero_image: /images/hero-img.svg
layout: membership
show_cta: False
outputs:
- html
- json
---
Leigh Hackspace is a social enterprise created for the benefit of our members and the wider Leigh community. We depend on memberships and grants to operate, and in return we offer members access to the hackspace's facilities and resources.

View File

@@ -0,0 +1,7 @@
{{ $len := (len $.Site.Data.memberships.membership_levels) }}
{"memberships": [
{{- with $.Site.Data.memberships.membership_levels }}
{{- range $index, $element := . -}}
{ "name": "{{ .name }}", "price": "{{ .price }}", "period": "{{ default "monthly" .period }}", "link": "{{ .link }}"}{{ if ne (add $index 1) $len }},{{ end }}
{{- end }}
{{- end }}]}