From 56b75c809e77b0c39661ecbb0bcb36e7cdb193cb Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 2 Nov 2022 21:41:44 +0000 Subject: [PATCH] Turn room version fragments and cs modules into headless resources This is actually doing two things: * creating `{fragments,modules}/index.md` turns the fragments and modules into page resources, rather than pages in their own right. We have to update the shortcodes to match. * adding `headless: true` means that we don't render the pages. The net effect is that we don't render pages like https://spec.matrix.org/v1.4/rooms/fragments/v1-auth-rules/ and https://spec.matrix.org/v1.4/client-server-api/modules/account_data/. --- .../internal/newsfragments/1317.clarification | 1 + content/client-server-api/modules/index.md | 3 +++ content/rooms/fragments/index.md | 3 +++ layouts/shortcodes/cs-module.html | 7 +++++-- layouts/shortcodes/rver-fragment.html | 15 +++++++++------ 5 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 changelogs/internal/newsfragments/1317.clarification create mode 100644 content/client-server-api/modules/index.md create mode 100644 content/rooms/fragments/index.md diff --git a/changelogs/internal/newsfragments/1317.clarification b/changelogs/internal/newsfragments/1317.clarification new file mode 100644 index 00000000..7813dc3f --- /dev/null +++ b/changelogs/internal/newsfragments/1317.clarification @@ -0,0 +1 @@ +Stop rendering the subsections of the Client-Server API and Room Versions specs as their own separate pages. diff --git a/content/client-server-api/modules/index.md b/content/client-server-api/modules/index.md new file mode 100644 index 00000000..ca03031f --- /dev/null +++ b/content/client-server-api/modules/index.md @@ -0,0 +1,3 @@ +--- +headless: true +--- diff --git a/content/rooms/fragments/index.md b/content/rooms/fragments/index.md new file mode 100644 index 00000000..ca03031f --- /dev/null +++ b/content/rooms/fragments/index.md @@ -0,0 +1,3 @@ +--- +headless: true +--- diff --git a/layouts/shortcodes/cs-module.html b/layouts/shortcodes/cs-module.html index 7bb6f581..89ea72ef 100644 --- a/layouts/shortcodes/cs-module.html +++ b/layouts/shortcodes/cs-module.html @@ -9,5 +9,8 @@ {{ $name := .Params.name }} -{{ $page := .Site.GetPage (path.Join .Page.File.Dir "modules" (printf "%s%s" $name ".md"))}} -{{ $page.Content }} +{{ with .Site.GetPage "client-server-api/modules" }} + {{ with .Resources.GetMatch (printf "%s%s" $name ".md") }} + {{ .Content }} + {{ end }} +{{ end }} diff --git a/layouts/shortcodes/rver-fragment.html b/layouts/shortcodes/rver-fragment.html index 62434586..2a69f9ea 100644 --- a/layouts/shortcodes/rver-fragment.html +++ b/layouts/shortcodes/rver-fragment.html @@ -17,10 +17,13 @@ {{ $name := .Params.name }} {{ $withVersioning := .Params.withVersioning }} -{{ $page := .Site.GetPage (path.Join .Page.File.Dir "fragments" (printf "%s%s" $name ".md"))}} -{{ $content := $page.Content }} -{{ if not $withVersioning }} - {{ $content = (replace $content "[New in this version]" "") }} - {{ $content = (replace $content "[Changed in this version]" "") }} +{{ with .Site.GetPage "rooms/fragments" }} + {{ with .Resources.GetMatch (printf "%s%s" $name ".md") }} + {{ $content := .Content }} + {{ if not $withVersioning }} + {{ $content = (replace $content "[New in this version]" "") }} + {{ $content = (replace $content "[Changed in this version]" "") }} + {{ end }} + {{ $content | safeHTML }} + {{ end }} {{ end }} -{{ $content | safeHTML }}