Fix relative URLs when serving the specification with a custom baseURL (#1984)

This commit is contained in:
Kévin Commaille 2024-11-14 12:11:34 +01:00 committed by GitHub
parent b1f66d1b71
commit bf8dee74eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 101 additions and 92 deletions

View file

@ -2,7 +2,7 @@
<main id="main">
<div>
<h1 id="title">Not found</h1>
<p>This page doesn't exist. Try going back to the <a href="{{ "/" | relURL }}">main page for the Matrix Specification</a>.</p>
<p>This page doesn't exist. Try going back to the <a href="{{ "" | relURL }}">main page for the Matrix Specification</a>.</p>
</div>
</main>
{{ end }}

View file

@ -16,5 +16,5 @@
{{ $omit_title := .omit_title }}
<div class="alert {{ $type }} {{ if $omit_title }}omit-title{{end}}" role="alert">
{{ $content | markdownify }}
{{ $content }}
</div>

View file

@ -6,5 +6,5 @@
the place we are at in the document.
*/}}
<script defer language="javascript" type="text/javascript" src="{{ "js/toc.js" | relURL }}"></script>
{{ $toc := resources.Get "js/toc.js" -}}
<script defer language="javascript" type="text/javascript" src="{{ $toc.RelPermalink }}"></script>

View file

@ -13,5 +13,6 @@
Google Fonts manually via a script:
https://github.com/matrix-org/matrix-spec/tree/main/static/css/fonts
*/}}
<link rel="preload" href="{{ "/css/fonts/Inter.css" | relURL }}" as="style">
<link rel="stylesheet" href="{{ "/css/fonts/Inter.css" | relURL }}">
{{ $inter := resources.Get "css/fonts/Inter.css" -}}
<link rel="preload" href="{{ $inter.RelPermalink }}" as="style">
<link rel="stylesheet" href="{{ $inter.RelPermalink }}">

View file

@ -335,7 +335,7 @@ resolve-additional-types.)
{{ $stringFormat := "" }}
{{ with index site.Data "string-formats" . }}
{{ $stringFormat = printf "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
{{ $stringFormat = printf "<a href=\"%s\">%s</a>" (htmlEscape .url | relURL) (htmlEscape .title) }}
{{ end }}
{{ return $stringFormat }}