Update with custom theme files
This commit is contained in:
parent
3b303aee07
commit
0c277c2458
45 changed files with 4324 additions and 11 deletions
1
layouts/_default/_markup/render-link.html
Normal file
1
layouts/_default/_markup/render-link.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{- with 1 -}}{{- end -}}<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>{{- with 1 -}}{{- end -}}
|
|
@ -1,11 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
{{- partial "head.html" . -}}
|
||||
<body>
|
||||
{{- partial "header.html" . -}}
|
||||
<div id="content">
|
||||
{{- block "main" . }}{{- end }}
|
||||
</div>
|
||||
{{- partial "footer.html" . -}}
|
||||
</body>
|
||||
|
||||
{{ partialCached "copying.html" . }}
|
||||
|
||||
<html itemscope itemtype="https://schema.org/WebSite">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, intitial-scale=1">
|
||||
<meta name="robots" content="noindex">
|
||||
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self'">-->
|
||||
<meta name="theme-color" content="#FFFFF0">
|
||||
<meta name="description" content="{{ block "head-description" . }}{{ $.Site.Params.description | html }}{{ end }}">
|
||||
<meta name="twitter:dnt" content="on">
|
||||
|
||||
<title itemprop="name">{{- block "title" . -}}{{- .Site.Title }} | {{ .Site.Params.tagline -}}{{- end -}}</title>
|
||||
|
||||
<link rel="license" href="{{ block "head-license" . }}https://creativecommons.org/publicdomain/zero/1.0/{{ end }}">
|
||||
<link rel="me" href="mailto:me+bg@bengoldsworthy.net">
|
||||
<link rel="icon" sizes="192x192" href="/images/icon.png">
|
||||
{{ with .OutputFormats.Get "rss" }}<link rel="{{ .Rel }}" type="{{ .MediaType.Type | html }}" href="{{ .RelPermalink }}" title="{{ $.Site.Title | safeHTML }}" />{{ end }}
|
||||
|
||||
<link href="/css/sanitize.css" rel="stylesheet" />
|
||||
{{- $sass := resources.Get "css/main.scss" }}
|
||||
{{- $style := $sass | resources.ToCSS | resources.Fingerprint }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity | html }}">
|
||||
|
||||
{{- block "header-scripts" . -}}<!-- -->{{- end -}}
|
||||
</head>
|
||||
|
||||
<body class="site-container site-container{{ block "main-class" . }}{{ end }}">
|
||||
{{ block "header" . -}}
|
||||
{{- partialCached "header/site-header.html" . -}}
|
||||
{{- end }}
|
||||
|
||||
<main class="site-content site-content{{ block "main-class" . }}{{ end }}" itemscope itemtype="{{ block "main-type" . }}https://schema.org/Thing{{ end }}">
|
||||
{{ block "main-header" . }}{{ end }}
|
||||
{{ block "main-body" . }}{{ end }}
|
||||
{{ block "main-footer" . }}{{ end }}
|
||||
</main>
|
||||
|
||||
{{- block "footer" . -}}
|
||||
<footer class="site-footer">
|
||||
<p>By <a href="/">{{ $.Site.Author.name }}</a> | <a href="{{ $.Site.Params.reportIssueURL }}" target="_blank" rel="noopener noreferrer">Report an Issue</a> | <a href="/privacy-policy">Privacy Policy</a> | <a href="/{{ .Sitemap.Filename }}">Sitemap</a> | Built: {{ now.Format "2006-01-02T15:04:05" }}</p>
|
||||
{{ block "footer-scripts" . }}<!-- -->{{ end }}
|
||||
</footer>
|
||||
{{- end -}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{{ define "title" }}
|
||||
{{ .Type | singularize }}: ‘{{ .Page.Title | plainify }}’ | {{ .Site.Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-class" }}--list{{ end}}
|
||||
|
||||
{{ define "main-header" }}
|
||||
<header class="site-content__header">
|
||||
<h1 class="page-title">{{ .Type | singularize }}: <q>{{ .Title | safeHTML }}</q>
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<img class="feed-icon" src="/images/feed-icon.png">
|
||||
</a>
|
||||
{{ end }}
|
||||
</h1>
|
||||
{{ .Content }}
|
||||
|
||||
<nav class="page-header__minor-links">
|
||||
{{ partial "years-list.html" . }}
|
||||
</nav>
|
||||
</header>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-body" }}
|
||||
{{ partial "items-grid.html" . }}
|
||||
{{ end }}
|
39
layouts/_default/rss.xml
Normal file
39
layouts/_default/rss.xml
Normal file
|
@ -0,0 +1,39 @@
|
|||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- if or $.IsHome $.IsSection -}}
|
||||
{{- $pages = $pctx.RegularPages -}}
|
||||
{{- else -}}
|
||||
{{- $pages = $pctx.Pages -}}
|
||||
{{- end -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title | plainify }}{{ else }}{{ with .Title }}{{ . | plainify }} on {{ end }}{{ .Site.Title | plainify }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{end}}
|
||||
{{ with .Site.Author.email }}<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}
|
||||
{{ with .Site.Author.email }}<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}
|
||||
{{ with .Site.Copyright }}<copyright>{{.}}</copyright>{{end}}
|
||||
{{ if not .Date.IsZero }}<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{- with .OutputFormats.Get "RSS" -}}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{- end -}}
|
||||
{{ range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title | plainify }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Summary | html }}</description>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
||||
|
26
layouts/_default/section.html
Normal file
26
layouts/_default/section.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
{{ define "title" }}
|
||||
{{ .Page.Title | plainify }} | {{ .Site.Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-class" }}--section{{ end }}
|
||||
|
||||
{{ define "main-type" }}.{{ .Params.mainType }}{{ end }}
|
||||
{{ define "item-type" }}{{ .Params.itemsType }}{{ end }}
|
||||
|
||||
|
||||
{{ define "main-header" }}
|
||||
<header class="site-content__header">
|
||||
<h1 class="page-title">{{ .Title | safeHTML }}
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<img class="feed-icon" src="/images/feed-icon.png">
|
||||
</a>
|
||||
{{ end }}
|
||||
</h1>
|
||||
{{ .Content }}
|
||||
</header>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-body" }}
|
||||
{{ partial "items-grid.html" . }}
|
||||
{{ end }}
|
|
@ -0,0 +1,120 @@
|
|||
{{ define "title" }}{{ .Title | plainify }} | {{ .Site.Title }}{{ end }}
|
||||
|
||||
{{ define "head-description" }}{{ .Summary | plainify }}{{ end }}
|
||||
|
||||
{{ define "main-class" }}--single{{ end }}
|
||||
|
||||
{{ define "footer-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
<script src="https://www.openlayers.org/api/OpenLayers.js"></script>
|
||||
<script>
|
||||
map = new OpenLayers.Map("mapdiv");
|
||||
map.addLayer(new OpenLayers.Layer.OSM());
|
||||
|
||||
var lonLats = [];
|
||||
{{ range . }}
|
||||
{{ with ( index $.Site.Data.locations . ) }}
|
||||
lonLats.push(new OpenLayers.LonLat( {{ .lon }} , {{ .lat }} )
|
||||
.transform(
|
||||
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
|
||||
map.getProjectionObject() // to Spherical Mercator Projection
|
||||
));
|
||||
{{ else }}
|
||||
{{ warnf "Could not find lat-lon for %q (%q)" . $.File.Path }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
/* TODO: Smarter zoom selection */
|
||||
var zoom=5;
|
||||
|
||||
var markers = new OpenLayers.Layer.Markers( "Markers" );
|
||||
map.addLayer(markers);
|
||||
|
||||
for (var i = 0; i < lonLats.length; i++) {
|
||||
markers.addMarker(new OpenLayers.Marker(lonLats[i]));
|
||||
}
|
||||
|
||||
/* TODO: Smarter centering */
|
||||
map.setCenter(lonLats[0], zoom);
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ with .Params.scripts }}
|
||||
{{ if in . "mathjax" }}
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script src="/js/mathjax-config.js"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-header" }}
|
||||
<header class="site-content__header">
|
||||
<div class="article-header__featured-image"
|
||||
{{ if .Params.featured_image }}
|
||||
{{ if .Resources.GetMatch .Params.featured_image }}
|
||||
style="background-image: url({{ ( .Resources.GetMatch .Params.featured_image ).RelPermalink }})"
|
||||
{{ else }}
|
||||
style="background-image: url({{ .Params.featured_image }})"
|
||||
{{ end }}
|
||||
{{ end }}>
|
||||
<div class="article-header__title-wrapper">
|
||||
<h1 class="article-header__title{{ if gt ( len ( .Title | plainify ) ) 40 }} article-header__title--long{{ end }}">
|
||||
<span role="text" itemprop="name">{{ .Title | safeHTML }}</span>
|
||||
</h1>
|
||||
{{ with .Params.subtitle }}
|
||||
<p class="article-header__subtitle">{{ . | safeHTML }}</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ with .Resources.GetMatch .Params.featured_image }}
|
||||
<p class="attr">
|
||||
{{ if .Params.attrlink }}<a href="{{ .Params.attrlink }}" target="_blank" rel="noopener">{{ end }}
|
||||
{{- .Params.Attr | safeHTML -}}
|
||||
{{ if .Params.attrlink }}</a>{{ end }}
|
||||
{{ if .Params.attrlicence }} ({{ .Params.attrlicence }}){{ end }}
|
||||
<p>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<p class="article-header__word-count">~<span itemprop="wordCount">{{ .FuzzyWordCount | lang.NumFmt 0 }}</span> words</p>
|
||||
<p class="article-header__publish-date">Published: <span itemprop="datePublished" datetime="{{ .PublishDate }}">{{ .PublishDate.Format "January 2" }}<sup>{{ if in (slice 1 21 31) .PublishDate.Day}}st{{ else if in (slice 2 22) .PublishDate.Day}}nd{{ else if in (slice 3 23) .PublishDate.Day}}rd{{ else }}th{{ end }}</sup>, 1{{ .PublishDate.Format "2006" | lang.NumFmt 0 }} <abbr style="text-transform: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></span></p>
|
||||
<p class="article-header__modified-date">Last modified: <span itemprop="dateModified" datetime="{{ .Lastmod }}">{{ .Lastmod.Format "January 2" }}<sup>{{ if in (slice 1 21 31) .Lastmod.Day}}st{{ else if in (slice 2 22) .Lastmod.Day}}nd{{ else if in (slice 3 23) .Lastmod.Day}}rd{{ else }}th{{ end }}</sup>, 1{{ .Lastmod.Format "2006" | lang.NumFmt 0 }} <abbr style="text-transform: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></span></p>
|
||||
|
||||
{{ $post_age_in_years := math.Round ( div ( div ( now.Sub .PublishDate ).Hours 24 ) 365 ) }}
|
||||
{{ if ( or .Params.site .Params.controversial ( gt $post_age_in_years 2 ) ) }}
|
||||
<aside class="article-header__warnings">
|
||||
<ul>
|
||||
{{ if ( gt $post_age_in_years 2 ) }}<li>This piece was written <strong>over {{ $post_age_in_years }} years ago</strong>. It may no longer accurately reflect my views now, or may be factually outdated.</li>{{ end }}
|
||||
{{ if .Params.controversial }}<li>This piece has been marked as potentially <strong>controversial</strong>, whether due to the topic addressed, the content of the article, or both. Don't say you weren't warned.</li>{{ end }}
|
||||
{{ if .Params.site }}<li>This piece was originally written for an older version of this site. As such, it may not have transferred over properly and some images and links might be broken.</li>{{ end }}
|
||||
</ul>
|
||||
</aside>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.notes }}
|
||||
<aside class="article-header__notes">
|
||||
<ul>
|
||||
{{ range .Params.notes }}
|
||||
<li>{{ . | safeHTML }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</aside>
|
||||
{{ end }}
|
||||
|
||||
{{ if and ( .TableOfContents ) ( ne .TableOfContents "<nav id=\"TableOfContents\"></nav>" ) }}
|
||||
<nav class="article-header__table-of-contents">
|
||||
<h2 class="article-header__subtitle">Table of Contents</h2>
|
||||
{{ .TableOfContents }}
|
||||
</nav>
|
||||
{{ end }}
|
||||
</header>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-body" }}
|
||||
<article class="site-content__body">
|
||||
{{ .Content }}
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-footer" }}
|
||||
{{ partial "post-meta.html" . }}
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue