{{ define "header" }}
  {{ partial "header.html" . }}
{{ end }}

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

{{ define "styles" }}
  {{ if .Page.Scratch.Get "includes_railroad_diagram" }}
  <link rel="preload stylesheet" as="style" href="{{ `styles/railroad.css` | absURL }}">
  {{ end }}
  <link rel="preload stylesheet" as="style" href="{{ `styles/monokai.css` | absURL }}">
{{ end }}

{{ define "scripts" }}
  {{ if and .IsPage (.Page.Scratch.Get "includes_railroad_diagram") }}
  <script defer type="module" src="{{ `scripts/railroad.js` | absURL }}"></script>
  <script defer type="module" src="{{ `scripts/railroad-utils.js` | absURL }}"></script>
  {{ end }}

  {{ if .Page.Scratch.Get "includes_p5_sketch" }}
  <script defer src="{{ `scripts/p5-1.4.1.min.js` | absURL }}"></script>
  <script defer src="{{ `scripts/sketch-utils.js` | absURL }}"></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 }}

{{ define "footer" }}
  {{ partial "footer.html" . }}
{{ end }}
