From 5c46267ecfc36cf438e37c7837abed0c10cd2c3e Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 4 Sep 2024 09:00:00 +0100 Subject: [PATCH] Add notes.json feed --- app/config/sculpin_site_prod.yml | 3 ++- source/notes.json.twig | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 source/notes.json.twig diff --git a/app/config/sculpin_site_prod.yml b/app/config/sculpin_site_prod.yml index 1b449f612..0b4c3ac48 100644 --- a/app/config/sculpin_site_prod.yml +++ b/app/config/sculpin_site_prod.yml @@ -1,3 +1,4 @@ --- imports: - - sculpin_site.yml + - sculpin_site.yml +url: https://zet.oliverdavies.uk diff --git a/source/notes.json.twig b/source/notes.json.twig new file mode 100644 index 000000000..cc30f5b31 --- /dev/null +++ b/source/notes.json.twig @@ -0,0 +1,16 @@ +--- +permalink: /notes.json +use: [notes] +--- + +[ + {% for note in data.notes|sort((a,b) => b.date <=> a.date) %} + { + "id": {{ note.filename|replace({".md": ""}) }}, + "date": {{ note.date }}, + "title": "{{ note.title }}", + "url": "{{ site.url }}/{{ note.url|trim("/") }}" + } + {%~ if not loop.last %},{% endif %} + {% endfor %} +]