From 794dba731ab9e973f52b8d363aa1d27a31ed41b5 Mon Sep 17 00:00:00 2001 From: Dan Macpherson Date: Thu, 22 Aug 2024 16:22:48 +1000 Subject: [PATCH] Auto-generation of JSON file for all pattern params Have enabled a JSON file for the patterns browser. This is the first step in enhancing the patterns browser page, including better filtering and sorting mechanisms. --- config.yaml | 9 +++++++++ content/patterns/_index.md | 3 +++ layouts/patterns/list.json.json | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 layouts/patterns/list.json.json diff --git a/config.yaml b/config.yaml index 2fc3792c5..be9bbcf54 100644 --- a/config.yaml +++ b/config.yaml @@ -30,3 +30,12 @@ taxonomies: rh_product: 'rh_products' other_product: 'other_products' blog_tag: 'blog_tags' + +mediaTypes: + application/json: + suffixes: + - json + +outputFormats: + patterns: + mediatype: application/json diff --git a/content/patterns/_index.md b/content/patterns/_index.md index 4ffac7585..26571f3ef 100644 --- a/content/patterns/_index.md +++ b/content/patterns/_index.md @@ -4,6 +4,9 @@ menu: main: weight: 10 name: Patterns +outputs: + - html + - json --- Browse through available patterns and their respective documentation for deployment and operation. Filter patterns by type, industry, and product. diff --git a/layouts/patterns/list.json.json b/layouts/patterns/list.json.json new file mode 100644 index 000000000..eb458b605 --- /dev/null +++ b/layouts/patterns/list.json.json @@ -0,0 +1,9 @@ +{{- if (eq .RelPermalink "/patterns/") }} + {{- $patterns := where $.Pages "Section" "patterns"}} + {{- $patterns_len := $patterns | len }} + {{- $pattern_list := slice }} + {{- range $index, $pattern := $patterns.ByTitle }} + {{- $pattern_list = $pattern_list | append (dict $pattern.Title $pattern.Params) }} + {{- end }} + {{- $pattern_list | jsonify }} +{{- end }}