Omphaloskepsis-2/layouts/blog/single.html

178 lines
4.9 KiB
HTML

{{ define "title" }}
“{{ .Title | plainify }}” |
{{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--single layouts-blog-single{{ end }}
{{ define "header-scripts" }}
{{ with .Params.locations }}
<script
id="Map-script"
src="/js/leaflet/leaflet.js"
></script>
{{ end }}
{{ end }}
{{ define "header-styles" }}
{{ with .Params.styles }}
<link
rel="stylesheet"
type="text/css"
href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}"
/>
{{ end }}
{{ with .Params.locations }}
<link
rel="stylesheet"
href="/css/leaflet/leaflet.css"
/>
{{ end }}
{{ end }}
{{ define "footer-scripts" }}
{{ with .Params.locations }}
<script>
var map = L.map('map').setView([55, -3], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var latLons = [];
{{ $locations := partialCached "util/get_location_leaf_nodes.html" $.Site.Data.locations -}}
{{- range . -}}
{{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]);
{{- else -}}
{{- erroridf "missing-lat-lon" "Could not find lat-lon for %q (%q)" . $.File.Path -}}
{{- end -}}
{{- end }}
map.fitBounds(latLons);
if (map.getZoom() < 10) map.setZoom(10);
</script>
{{ end }}
{{ if $.HasShortcode "chart" }}
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
<script
id="Charts-script"
src="/js/chart/chart.js"
></script>
<script
id="Charts-config-script"
src="{{ $chartsConfigJS.Permalink }}"
integrity="{{ $chartsConfigJS.Data.Integrity }}"
></script>
{{ end }}
{{ end }}
{{ define "main-header" }}
{{ partial "single/main-header.html" ( dict "pc" . "sc" $ ) }}
{{ end }}
{{ define "main-body" }}
<section
class="site-content__body"
itemprop="articleBody"
>
{{ with .Summary }}
<section
class="article-body__summary"
itemprop="abstract"
>
<h2>Summary</h2>
<p class="p-summary">{{ . }}</p>
</section>
{{ end }}
{{- if ( or .Params.internal_links .Params.external_links ) -}}
<section class="article__links">
{{- with .Params.internal_links -}}
<h3>Internal Links</h3>
<ul>
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
<li><a href="{{ .link }}">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a href="{{ . }}">Link</a></li>
{{ end }}
{{- end -}}
</ul>
{{- end -}}
{{- with .Params.external_links -}}
<h3>External Links</h3>
<ul>
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
<li><a href="{{ .link }}">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a href="{{ . }}">Link</a></li>
{{ end }}
{{- end -}}
</ul>
{{- end -}}
</section>
{{- end -}}
<section
class="e-content article-body__content"
itemprop="articleBody"
>
{{ .Content }}
</section>
{{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }}
<section class="article-body__appendices">
<h2
class="subheading subheading--appendices"
id="appendices"
>
Appendices
</h2>
{{ $file := path.Join $.Page.File.Dir "appendices.md" | readFile }}
{{ $file | .RenderString }}
</section>
{{ end }}
{{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
<section
class="article-body__corrigendum"
itemprop="correction"
itemscope
itemtype="https://schema.org/CorrectionComment"
>
<h2
class="subheading subheading--corrigendum"
id="corrigendum"
>
Corrigendum
</h2>
{{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }}
{{ $file | .RenderString }}
</section>
{{ end }}
</section>
{{ with .Page.Resources.Get "comments.md" }}
<section class="site-content__comments">
<h2
class="subheading subheading--comments"
id="comments"
>
Comments
</h2>
<ul class="comment__thread">
{{ .RenderShortcodes }}
</ul>
</section>
{{ end }}
{{ end }}
{{ define "main-footer" }}
{{ partial "single/post-meta.html" ( dict "pc" . "sc" $ ) }}
{{ end }}