Skip to content

Commit

Permalink
Cleanup HTML and templating
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsnow committed Oct 31, 2024
1 parent ddd356c commit eb33b0d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions site/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

<head>
{{- partial "head.html" . -}}
{{- block "styles" . -}}{{- end }}
{{- block "scripts" . -}}{{- end }}
{{- block "styles" . -}}{{- end -}}
{{- block "scripts" . -}}{{- end -}}
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions site/layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "main" }}
{{- define "main" -}}
<article>
{{- partial "header-link.html" .Content -}}
</article>
{{ end }}
{{- end -}}
28 changes: 14 additions & 14 deletions site/layouts/_default/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML -}}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
{{- range .Data.Pages -}}
{{- if or (and (.Permalink) (gt (len .Content) 0)) (.Params.src) -}}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
<loc>{{- .Permalink -}}</loc>{{- if not .Lastmod.IsZero -}}
<lastmod>{{- safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) -}}</lastmod>{{- end -}}{{- with .Sitemap.ChangeFreq -}}
<changefreq>{{- . -}}</changefreq>{{- end -}}{{- if ge .Sitemap.Priority 0.0 -}}
<priority>{{- .Sitemap.Priority -}}</priority>{{- end -}}{{- if .IsTranslated -}}{{- range .Translations -}}
<xhtml:link
rel="alternate"
hreflang="{{ .Language.LanguageCode }}"
href="{{ .Permalink }}"
/>{{ end }}
hreflang="{{- .Language.LanguageCode -}}"
href="{{- .Permalink -}}"
/>{{- end -}}
<xhtml:link
rel="alternate"
hreflang="{{ .Language.LanguageCode }}"
href="{{ .Permalink }}"
/>{{ end }}
hreflang="{{- .Language.LanguageCode -}}"
href="{{- .Permalink -}}"
/>{{- end -}}
</url>
{{- end -}}
{{ end }}
</urlset>
{{- end -}}
</urlset>
28 changes: 14 additions & 14 deletions site/layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{{ define "styles" }}
{{ $maplibrecss := resources.Get "vendor/maplibre-gl-4.7.0.min.css" | fingerprint }}
<link href="{{ $maplibrecss.RelPermalink }}" rel="stylesheet"/>
{{ end }}
{{- define "styles" -}}
{{- $maplibrecss := resources.Get "vendor/maplibre-gl-4.7.0.min.css" | fingerprint -}}
<link href="{{- $maplibrecss.RelPermalink -}}" rel="stylesheet" />
{{- end -}}

{{ define "scripts" }}
{{ $maplibrejs := resources.Get "vendor/maplibre-gl-4.7.0.min.js" | fingerprint }}
{{ $pmtilesjs := resources.Get "vendor/pmtiles-3.2.0.min.js" | fingerprint }}
{{ $map := resources.Get "js/map.js" | minify | fingerprint }}
<script defer src="{{ $maplibrejs.RelPermalink }}"></script>
<script defer src="{{ $pmtilesjs.RelPermalink }}"></script>
<script type="module" src="{{ $map.RelPermalink }}"></script>
{{ end }}
{{- define "scripts" -}}
{{- $maplibrejs := resources.Get "vendor/maplibre-gl-4.7.0.min.js" | fingerprint -}}
{{- $pmtilesjs := resources.Get "vendor/pmtiles-3.2.0.min.js" | fingerprint -}}
{{- $map := resources.Get "js/map.js" | minify | fingerprint -}}
<script defer src="{{- $maplibrejs.RelPermalink -}}"></script>
<script defer src="{{- $pmtilesjs.RelPermalink -}}"></script>
<script type="module" src="{{- $map.RelPermalink -}}"></script>
{{- end -}}

{{ define "main" }}
{{- define "main" -}}
<div id="map"></div>
{{ end }}
{{- end -}}
18 changes: 9 additions & 9 deletions site/layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<meta charset="utf-8">

{{ if ne .Site.Title .Title -}}
<title>{{ .Site.Title }} | {{ .Title }}</title>
{{ else -}}
<title>{{ .Site.Title }}</title>
{{ end -}}
{{- if ne .Site.Title .Title -}}
<title>{{- .Site.Title -}} | {{- .Title -}}</title>
{{- else -}}
<title>{{- .Site.Title -}}</title>
{{- end -}}

<meta name="description" content="{{ .Site.Params.description }}">
<meta name="author" content="{{ .Site.Params.author }}">
<meta name="description" content="{{- .Site.Params.description -}}">
<meta name="author" content="{{- .Site.Params.author -}}">
<meta name="viewport" content="width=device-width,initial-scale=1.0">

<link rel="shortcut icon" href="/favicon.ico">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#000000">

{{ $main := resources.Get "css/main.scss" | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $main.RelPermalink }}" integrity="{{ $main.Data.Integrity }}">
{{- $main := resources.Get "css/main.scss" | toCSS | minify | fingerprint -}}
<link rel="stylesheet" href="{{- $main.RelPermalink -}}" integrity="{{- $main.Data.Integrity -}}">
4 changes: 2 additions & 2 deletions site/layouts/partials/header-link.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ . | replaceRE
{{- . | replaceRE
"(<h[2-9] id=\"([^\"]+)\".+)(</h[2-9]+>)"
"<a class=\"header-link hover-icon\" role=\"none\" href=\"#${2}\">${1}<svg version=\"1.2\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"Header link\" aria-hidden=\"true\" class=\"header-link-icon\" viewBox=\"0 0 32 32\" width=\"0.7em\" height=\"0.7em\" fill=\"currentcolor\"><title>Link to ${2} section</title><path d=\"M14 21h-5a4.8 4.8 90 010-10h5v-3h-5a1 1 0 000 16h5ZM18 11h5a4.8 4.8 270 010 10h-5v3h5a1 1 180 000-16h-5ZM8 14.5h16v3h-16Z\" /></svg>${3}</a>"
| safeHTML
}}
-}}
2 changes: 1 addition & 1 deletion site/layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<header class="navbar">
<nav class="navbar-content">
<h1 class="navbar-title">
<a href="/" class="link-nowrap-nodec" title="Link to home">{{ .Site.Title }}</a>
<a href="/" class="link-nowrap-nodec" title="Link to home">{{- .Site.Title -}}</a>
</h1>
<ul class="navbar-internal-links">
<li>
Expand Down

0 comments on commit eb33b0d

Please sign in to comment.