mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-12-03 02:48:56 -05:00
add a partial template that returns an asset's URL and hash from webpack's manifest
still a mess but slightly more modular. also added a real 404 page.
This commit is contained in:
@@ -1,25 +1,23 @@
|
||||
{{/* Pull in JS processed by Webpack */}}
|
||||
|
||||
{{- define "__head_preload" -}}
|
||||
{{ with .Site.Data.manifest }}
|
||||
{{ with index . "fonts/inter-subset.var.woff2" }}
|
||||
<link rel="preload" href="{{ .src | absURL }}" as="font" type="font/woff2" crossorigin>
|
||||
{{ end }}
|
||||
{{ with index . "fonts/roboto-mono-subset.var.woff2" }}
|
||||
<link rel="preload" href="{{ .src | absURL }}" as="font" type="font/woff2" crossorigin>
|
||||
{{ end }}
|
||||
{{ with index . "main.js" }}
|
||||
<link rel="preload" href="{{ .src | absURL }}" as="script">
|
||||
{{ end }}
|
||||
{{ with partial "functions/webpack" (dict "context" . "src" "fonts/inter-subset.var.woff2") }}
|
||||
<link rel="preload" href="{{ .src }}" as="font" type="font/woff2" crossorigin>
|
||||
{{ end }}
|
||||
|
||||
{{ with partial "functions/webpack" (dict "context" . "src" "fonts/roboto-mono-subset.var.woff2") }}
|
||||
<link rel="preload" href="{{ .src }}" as="font" type="font/woff2" crossorigin>
|
||||
{{ end }}
|
||||
|
||||
{{ with partial "functions/webpack" (dict "context" . "src" "main.js") }}
|
||||
<link rel="preload" href="{{ .src }}" as="script">
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "__body_js" -}}
|
||||
{{ with .Site.Data.manifest }}
|
||||
{{ with index . "main.js" -}}
|
||||
<script async defer src="{{ .src | absURL }}"></script>
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ with partial "functions/webpack" (dict "context" . "src" "main.js") }}
|
||||
<script async defer src="{{ .src }}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* Detect shortcodes and append external scripts as needed once per page */}}
|
||||
{{ if .HasShortcode "gh-buttons" -}}
|
||||
|
||||
Reference in New Issue
Block a user