{{ define "before" }}
  <div id="dungeon-background"></div>
{{ end }}

{{ define "main" }}
  {{ partial "single_main.html" . }}
{{ end }}

{{ define "styles" }}
  {{- with partial "secure_asset.html" "styles/nethack.css" -}}
    {{ with .Secure }}
      <link rel="stylesheet" href="{{ .RelPermalink }}">
    {{ else }}
      {{- errorf "Unable to find nethack.css" -}}
    {{ end }}
  {{- end -}}
  {{- range .Resources.Match "*.css" -}}
    {{- $stylesheet := . | fingerprint "md5" }}
    <link rel="stylesheet" href="{{ $stylesheet.RelPermalink }}">
  {{- end -}}
{{ end }}

{{ define "scripts" }}
  {{- with partial "secure_asset.html" "scripts/lib/p5-1.5.0.js" -}}
    <script defer src="{{ .Secure.RelPermalink }}"></script>
  {{- end -}}

  {{- with partial "secure_asset.html" "scripts/nethack/dungeon.js" -}}
    <script defer src="{{ .Secure.RelPermalink }}"></script>
  {{- end -}}

  {{- range $script := .Resources.Match "*.js" -}}
    {{- $isModule := default true $script.Params.is_module -}}
    <script defer {{ if $isModule }}type="module"{{ end }} src="{{ $script.Permalink | relURL }}"></script>
  {{- end -}}
{{ end }}
