mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-02-21 21:43:43 +01:00
Move and update layouts
A big change for template paths landed in Hugo 0.146.0. In `layouts`, we: - remove `_default` and move everything in it directly under `layouts` - rename `partials` and `shortcodes` to `_partials` and `_shortcodes` - adapt to Hugo and docsy changes about the render-heading hook. We don't need a copy of the heading self-link template now that it is defined as a partial. - update `docs/baseof.html` to match a change upstream - split `docs/changelog.html` because it doesn't work for the section page anymore. We create a `changelog-index` layout for this. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
parent
e5b9214bee
commit
f7f641aae7
|
|
@ -8,7 +8,7 @@ enableRobotsTXT = true
|
||||||
# We disable RSS, because (a) it's useless, (b) Hugo seems to generate broken
|
# We disable RSS, because (a) it's useless, (b) Hugo seems to generate broken
|
||||||
# links to it when used with a --baseURL (for example, https://spec.matrix.org/v1.4/
|
# links to it when used with a --baseURL (for example, https://spec.matrix.org/v1.4/
|
||||||
# contains `<link rel="alternate" type="application/rss+xml" href="/v1.4/v1.4/index.xml">`).
|
# contains `<link rel="alternate" type="application/rss+xml" href="/v1.4/v1.4/index.xml">`).
|
||||||
disableKinds = ["taxonomy", "RSS"]
|
disableKinds = ["taxonomy", "rss"]
|
||||||
|
|
||||||
[languages]
|
[languages]
|
||||||
[languages.en]
|
[languages.en]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Changelog
|
title: Changelog
|
||||||
type: docs
|
type: docs
|
||||||
|
layout: changelog-index
|
||||||
weight: 1000
|
weight: 1000
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{{- /*
|
|
||||||
|
|
||||||
A simplified copy of the inlined "_default/_markup/_td-heading-self-link.html"
|
|
||||||
template in Docsy's "_default/_markup/td-render-heading.html" template to be
|
|
||||||
able to reuse it when the heading has custom markup.
|
|
||||||
|
|
||||||
Takes a string which is the ID of the heading.
|
|
||||||
|
|
||||||
*/ -}}
|
|
||||||
|
|
||||||
<a class="td-heading-self-link" href="#{{ . | safeURL }}" aria-label="Heading self-link"></a>
|
|
||||||
|
|
@ -8,4 +8,4 @@
|
||||||
heading.
|
heading.
|
||||||
|
|
||||||
*/ -}}
|
*/ -}}
|
||||||
{{ template "_default/_markup/td-render-heading.html" . }}
|
{{ partial "td/render-heading.html" . }}
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<h1 id="{{ $anchor }}">
|
<h1 id="{{ $anchor }}">
|
||||||
{{ with .title }}{{ . | markdownify }}{{ else }}<code>{{ $event_name }}</code>{{ end }}
|
{{ with .title }}{{ . | markdownify }}{{ else }}<code>{{ $event_name }}</code>{{ end }}
|
||||||
{{ template "_default/_markup/td-heading-self-link.html" $anchor }}
|
{{ partial "td/heading-self-link.html" (dict "Anchor" $anchor) }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
</summary>
|
</summary>
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
* If the input `schema` was itself an object that we should create a table for,
|
* If the input `schema` was itself an object that we should create a table for,
|
||||||
* this will be the same as the first entry in `objects`.
|
* this will be the same as the first entry in `objects`.
|
||||||
*/
|
*/
|
||||||
{{ define "partials/resolve-additional-types-inner" }}
|
{{ define "_partials/resolve-additional-types-inner" }}
|
||||||
{{ $this_object := .schema }}
|
{{ $this_object := .schema }}
|
||||||
{{ $anchor_base := .anchor_base }}
|
{{ $anchor_base := .anchor_base }}
|
||||||
{{ $name := .name }}
|
{{ $name := .name }}
|
||||||
|
|
@ -222,7 +222,7 @@
|
||||||
* * `objects`: The array of object schema definitions.
|
* * `objects`: The array of object schema definitions.
|
||||||
* * `schema`: An updated copy of the `schema` input (eg, an `anchor` may be added).
|
* * `schema`: An updated copy of the `schema` input (eg, an `anchor` may be added).
|
||||||
*/
|
*/
|
||||||
{{ define "partials/get-additional-objects" }}
|
{{ define "_partials/get-additional-objects" }}
|
||||||
/* .name is the name of the object for logging purposes */
|
/* .name is the name of the object for logging purposes */
|
||||||
{{ $name := .name }}
|
{{ $name := .name }}
|
||||||
|
|
||||||
|
|
@ -246,6 +246,6 @@
|
||||||
* This is needed for uniqify to work - otherwise objects that are the same
|
* This is needed for uniqify to work - otherwise objects that are the same
|
||||||
* but with (for example) different examples will be considered different.
|
* but with (for example) different examples will be considered different.
|
||||||
*/
|
*/
|
||||||
{{ define "partials/clean-object" }}
|
{{ define "_partials/clean-object" }}
|
||||||
{{ return (dict "title" .title "properties" .properties "additionalProperties" .additionalProperties "patternProperties" .patternProperties "required" .required "enum" .enum "anchor" .anchor) }}
|
{{ return (dict "title" .title "properties" .properties "additionalProperties" .additionalProperties "patternProperties" .patternProperties "required" .required "enum" .enum "anchor" .anchor) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{{ define "partials/version-string" }}
|
{{ define "_partials/version-string" }}
|
||||||
{{ $ret := "unstable version"}}
|
{{ $ret := "unstable version"}}
|
||||||
|
|
||||||
{{ $status := .Site.Params.version.status }}
|
{{ $status := .Site.Params.version.status }}
|
||||||
|
|
@ -47,8 +47,8 @@
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>{{ $property_name }}</code></td>
|
<td><code>{{ $property_name }}</code></td>
|
||||||
<td><code>{{ partial "partials/property-type" $property | safeHTML }}</code></td>
|
<td><code>{{ partial "property-type" $property | safeHTML }}</code></td>
|
||||||
<td>{{ partial "partials/property-description" (dict "property" $property "required" $required) }}</td>
|
<td>{{ partial "property-description" (dict "property" $property "required" $required) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
@ -71,8 +71,8 @@
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><Other properties></td>
|
<td><Other properties></td>
|
||||||
<td><code>{{ partial "partials/property-type" .additionalProperties | safeHTML }}</code></td>
|
<td><code>{{ partial "property-type" .additionalProperties | safeHTML }}</code></td>
|
||||||
<td>{{ partial "partials/property-description" (dict "property" .additionalProperties) }}</td>
|
<td>{{ partial "property-description" (dict "property" .additionalProperties) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -101,8 +101,8 @@ resolve-additional-types.)
|
||||||
{{ $property := . }}
|
{{ $property := . }}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>{{ partial "partials/property-type" $property | safeHTML }}</code></td>
|
<td><code>{{ partial "property-type" $property | safeHTML }}</code></td>
|
||||||
<td>{{ partial "partials/property-description" (dict "property" $property) }}</td>
|
<td>{{ partial "property-description" (dict "property" $property) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ resolve-additional-types.)
|
||||||
* `format`: optional string for the format of the type, used for strings.
|
* `format`: optional string for the format of the type, used for strings.
|
||||||
|
|
||||||
*/}}
|
*/}}
|
||||||
{{ define "partials/property-type" }}
|
{{ define "_partials/property-type" }}
|
||||||
{{ $type := "" }}
|
{{ $type := "" }}
|
||||||
|
|
||||||
{{ if eq .type "object" }}
|
{{ if eq .type "object" }}
|
||||||
|
|
@ -215,7 +215,7 @@ resolve-additional-types.)
|
||||||
|
|
||||||
* `anchor`: optional HTML element id for the target type, which will be used to link to it.
|
* `anchor`: optional HTML element id for the target type, which will be used to link to it.
|
||||||
*/}}
|
*/}}
|
||||||
{{ define "partials/object-type-or-title" }}
|
{{ define "_partials/object-type-or-title" }}
|
||||||
{{ $type := "object" }}
|
{{ $type := "object" }}
|
||||||
{{ if .properties }}
|
{{ if .properties }}
|
||||||
{{/*
|
{{/*
|
||||||
|
|
@ -306,7 +306,7 @@ resolve-additional-types.)
|
||||||
* `x-changedInMatrixVersion`: optional string indicating in which Matrix
|
* `x-changedInMatrixVersion`: optional string indicating in which Matrix
|
||||||
spec version this property was last changed.
|
spec version this property was last changed.
|
||||||
*/}}
|
*/}}
|
||||||
{{ define "partials/property-description" -}}
|
{{ define "_partials/property-description" -}}
|
||||||
{{ $description := .property.description -}}
|
{{ $description := .property.description -}}
|
||||||
{{ if .required -}}
|
{{ if .required -}}
|
||||||
{{/*
|
{{/*
|
||||||
|
|
@ -331,7 +331,7 @@ resolve-additional-types.)
|
||||||
Computes the type to display for a string format, given the identifier of
|
Computes the type to display for a string format, given the identifier of
|
||||||
the format as a string.
|
the format as a string.
|
||||||
*/}}
|
*/}}
|
||||||
{{ define "partials/string-format" }}
|
{{ define "_partials/string-format" }}
|
||||||
{{ $stringFormat := "" }}
|
{{ $stringFormat := "" }}
|
||||||
|
|
||||||
{{ with index site.Data "string-formats" . }}
|
{{ with index site.Data "string-formats" . }}
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
<h1 id="{{ $anchor }}">
|
<h1 id="{{ $anchor }}">
|
||||||
<span class="http-api-method">{{ $method }}</span>
|
<span class="http-api-method">{{ $method }}</span>
|
||||||
<span class="endpoint{{ if $operation_data.deprecated }} deprecated-inline{{ end }}">{{ $endpoint }}</span>
|
<span class="endpoint{{ if $operation_data.deprecated }} deprecated-inline{{ end }}">{{ $endpoint }}</span>
|
||||||
{{ template "_default/_markup/td-heading-self-link.html" $anchor }}
|
{{ partial "td/heading-self-link.html" (dict "Anchor" $anchor) }}
|
||||||
</h1>
|
</h1>
|
||||||
</summary>
|
</summary>
|
||||||
|
|
||||||
|
|
@ -25,7 +25,9 @@
|
||||||
</aside>
|
</aside>
|
||||||
<main class="col-12 col-md-9 col-xl-8 ps-md-5" role="main">
|
<main class="col-12 col-md-9 col-xl-8 ps-md-5" role="main">
|
||||||
{{ partial "version-banner.html" . }}
|
{{ partial "version-banner.html" . }}
|
||||||
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
|
{{ if not (.Param "ui.breadcrumb_disable") -}}
|
||||||
|
{{ partial "breadcrumb.html" . -}}
|
||||||
|
{{ end -}}
|
||||||
{{ block "main" . }}{{ end }}
|
{{ block "main" . }}{{ end }}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
13
layouts/docs/changelog-index.html
Normal file
13
layouts/docs/changelog-index.html
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{- /*
|
||||||
|
|
||||||
|
Template to the `changelog` section page.
|
||||||
|
|
||||||
|
This redirects the page to the latest version's changelog page.
|
||||||
|
|
||||||
|
*/ -}}
|
||||||
|
|
||||||
|
{{ define "main" }}
|
||||||
|
{{ with index .RegularPages.ByDate.Reverse 0 -}}
|
||||||
|
<meta http-equiv="refresh" content="0; url={{ .RelPermalink }}">
|
||||||
|
{{ end -}}
|
||||||
|
{{ end }}
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
{{- /*
|
{{- /*
|
||||||
|
|
||||||
Template to render a page with a `changelog` layout or the `changelog`
|
Template to render a page with a `changelog` layout.
|
||||||
section page. This conflation seems to be a limitation of Hugo currently, it
|
|
||||||
uses this template for both cases.
|
|
||||||
|
|
||||||
For the `changelog` section page, this redirects the page to the latest
|
This adds a table at the top of the page with information about the release:
|
||||||
version's changelog page.
|
|
||||||
|
|
||||||
For a page with a `changelog` layout, this adds a table at the top of the
|
|
||||||
page with information about the release:
|
|
||||||
|
|
||||||
* A link to the matrix-spec repository at the time of the release, with the
|
* A link to the matrix-spec repository at the time of the release, with the
|
||||||
version taken from the `linkTitle` in the frontmatter of the page, unless
|
version taken from the `linkTitle` in the frontmatter of the page, unless
|
||||||
|
|
@ -21,11 +15,6 @@
|
||||||
*/ -}}
|
*/ -}}
|
||||||
|
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{ if .IsSection -}}
|
|
||||||
{{ with index .RegularPages.ByDate.Reverse 0 -}}
|
|
||||||
<meta http-equiv="refresh" content="0; url={{ .RelPermalink }}">
|
|
||||||
{{ end -}}
|
|
||||||
{{ else -}}
|
|
||||||
{{ $version := lower .LinkTitle -}}
|
{{ $version := lower .LinkTitle -}}
|
||||||
<div class="td-content">
|
<div class="td-content">
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
|
@ -50,5 +39,4 @@
|
||||||
|
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
{{ end -}}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue