Use relative URLs in the baseof template

This commit is contained in:
Eryn Wells 2022-10-19 07:36:18 -07:00
parent 17af243a96
commit c733b6d1aa

View file

@ -16,35 +16,37 @@
<style> <style>
@font-face { @font-face {
font-family: "Museo_Slab"; font-family: "Museo_Slab";
src: url("{{ `/fonts/Museo_Slab_500.woff2` | absURL }}") format("woff2"), src: url("{{ `/fonts/Museo_Slab_500.woff2` | relURL }}") format("woff2"),
url("{{ `/fonts/Museo_Slab_500.woff` | absURL }}") format("woff"); url("{{ `/fonts/Museo_Slab_500.woff` | relURL }}") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
</style> </style>
<link rel="stylesheet" as="style" href="{{ `/styles/root.css` | absURL }}"> <link rel="stylesheet" as="style" href="{{ `/styles/root.css` | relURL }}">
{{ if not hugo.IsProduction }} {{- if not hugo.IsProduction -}}
<link rel="stylesheet" as="style" href="/styles/development.css"> <link rel="stylesheet" as="style" href="{{ `/styles/development.css` | relURL }}">
{{ end }} {{- end -}}
{{ block "styles" . }}{{ end }}
{{- $includedCSS := slice -}} {{- $includedCSS := slice -}}
{{- if not .FirstSection.IsHome -}} {{- if not .FirstSection.IsHome -}}
{{- range .FirstSection.Resources.Match "*.css" -}} {{- range .FirstSection.Resources.Match "*.css" -}}
{{- if not (in $includedCSS .Permalink) -}} {{- if not (in $includedCSS .Permalink) -}}
{{- $includedCSS = $includedCSS | append .Permalink -}} {{- $includedCSS = $includedCSS | append .Permalink -}}
<link rel="stylesheet" as="style" href="{{ .Permalink }}"> <link rel="stylesheet" as="style" href="{{ .RelPermalink }}">
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- range .Resources.Match "*.css" -}} {{- range .Resources.Match "*.css" -}}
{{- if not (in $includedCSS .Permalink) -}} {{- if not (in $includedCSS .Permalink) -}}
{{- $includedCSS = $includedCSS | append .Permalink -}} {{- $includedCSS = $includedCSS | append .Permalink -}}
<link rel="stylesheet" as="style" href="{{ .Permalink }}"> <link rel="stylesheet" as="style" href="{{ .RelPermalink }}">
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{ block "styles" . }}{{ end }}
{{ block "scripts" . }}{{ end }} {{ block "scripts" . }}{{ end }}
<script src="{{ `scripts/site.js` | absURL }}"></script> <script src="{{ `scripts/site.js` | relURL }}"></script>
</html> </html>