msfjarvis.dev/layouts/_default/single.html
Justin Lebar da505aa0f5 Change how prismjs is loaded.
- Load minified code (3kB vs 30kB)
 - Add prism autoloader so that we get highlighting for languages we
   use.
 - Hardcode exact prism version.  Perhaps this is controversial, but it
   saves a redirect for each request, shaving off 30ms on a fast
   connection.
2020-06-24 10:03:08 -07:00

40 lines
1.3 KiB
HTML

{{ define "styles" }}
{{ $.Scratch.Set "style_opts" (dict "src" "scss/pages/post.scss" "dest" "css/post.css") }}
{{ end }}
{{ define "main" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}
<div class="post">
<header class="post__header">
<h1 class="post__title">{{.Title}}</h1>
<time datetime="{{ .Date }}" class="post__date"
>{{ .Date.Format $dateFormat }}</time>
</header>
<article class="post__content">
{{ partial "anchored-headings.html" .Content }}
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
</article>
{{ partial "tags.html" .}} {{ partial "post-pagination.html" .}}
</div>
{{ template "_internal/disqus.html" . }}
{{ end }}
{{ define "footer" }}
<footer>
{{ partial "social-icons.html" .}}
<p>{{ replace .Site.Copyright "{year}" now.Year }}</p>
</footer>
{{ end }}
{{ define "scripts" }}
{{/* Hardcode a specific prismjs version to avoid a redirect on every page load. */}}
<script src="https://unpkg.com/prismjs@1.20.0/components/prism-core.min.js"></script>
<script src="https://unpkg.com/prismjs@1.20.0/plugins/autoloader/prism-autoloader.min.js"
data-autoloader-path="https://unpkg.com/prismjs@1.20.0/components/"></script>
{{ end }}