Fix font preloads, add speculative prefetch rules

This commit is contained in:
jaseg 2025-07-26 14:24:12 +02:00
parent 9d55ae84a8
commit 338de75fb4
2 changed files with 17 additions and 2 deletions

View file

@ -9,7 +9,7 @@
{{- $stylesheet := resources.Get "css/style.css" | resources.ExecuteAsTemplate "style.css" . }}
<link rel="stylesheet" href="{{ $stylesheet.RelPermalink }}">
<link rel="preload" href="{{ (resources.Get "fonts/roboto_slab/RobotoSlab-VariableFont_wght.ttf").RelPermalink }}" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="{{ (resources.Get "fonts/roboto_slab/RobotoSlab-VariableFont_wght.ttf").RelPermalink }}" as="font" type="font/ttf" crossorigin />
<link rel="preload" href="{{ (resources.Get "fonts/nyght-serif-main/fonts/WEB/NyghtSerif-Regular.woff2").RelPermalink }}" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="{{ (resources.Get "fonts/nyght-serif-main/fonts/WEB/NyghtSerif-Bold.woff2").RelPermalink }}" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="{{ (resources.Get "fonts/nyght-serif-main/fonts/WEB/NyghtSerif-BoldItalic.woff2").RelPermalink }}" as="font" type="font/woff2" crossorigin />

View file

@ -5,11 +5,26 @@
{{- partial "header.html" . -}}
{{- block "main" . }}{{- end }}
{{- partial "footer.html" . -}}
<script src="/pagefind/pagefind-ui.js" defer></script>
<script type="text/javascript" src="/pagefind/pagefind-ui.js" defer></script>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({element: "#search", showSubResults: true});
});
</script>
<script type="speculationrules">
{
"prerender": [
{
"source": "document",
"where": {
"and": [
{"href_matches": "/*"}
]
},
"eagerness": "moderate"
}
]
}
</script>
</body>
</html>