diff options
Diffstat (limited to 'layouts/_default')
-rw-r--r-- | layouts/_default/_markup/render-heading.html | 7 | ||||
-rw-r--r-- | layouts/_default/_markup/render-link.html | 11 | ||||
-rw-r--r-- | layouts/_default/archive.terms.html | 21 | ||||
-rw-r--r-- | layouts/_default/author.html | 27 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 22 | ||||
-rw-r--r-- | layouts/_default/list.html | 12 | ||||
-rw-r--r-- | layouts/_default/search.html | 78 | ||||
-rw-r--r-- | layouts/_default/search.json | 13 | ||||
-rw-r--r-- | layouts/_default/single.html | 105 | ||||
-rw-r--r-- | layouts/_default/summary.html | 25 | ||||
-rw-r--r-- | layouts/_default/terms.html | 19 |
11 files changed, 167 insertions, 173 deletions
diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..7d1e0ac --- /dev/null +++ b/layouts/_default/_markup/render-heading.html @@ -0,0 +1,7 @@ +<!-- https://discourse.gohugo.io/t/adding-anchor-next-to-headers/1726/24 --> +<h{{ .Level }} id="{{ .Anchor | safeURL }}"{{ with .Attributes.class }} class="{{ . }}"{{ end }}> + {{ .Text | safeHTML }} + <a class="" href="#{{ .Anchor | safeURL }}"> + <i class="fa fa-chain" aria-hidden="true"></i> + </a> +</h{{ .Level }}> diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..7031af3 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1,11 @@ +{{- /* A Hugo Markdown render hook to parse links, opening external links in new tabs. */ -}} +<a + href="{{ .Destination | safeURL }}" + {{ with .Title }} + title="{{ . }}" + {{ end }} + {{ if strings.HasPrefix .Destination "http" }} + target="_blank" rel="noopener" + {{ end }} + >{{ .Text | safeHTML }}</a +> diff --git a/layouts/_default/archive.terms.html b/layouts/_default/archive.terms.html deleted file mode 100644 index 7b5a540..0000000 --- a/layouts/_default/archive.terms.html +++ /dev/null @@ -1,21 +0,0 @@ -{{ define "main" }} -<div id="content" class="bg-near-white pa2 pt5"> - {{ range (where .Site.RegularPages "Section" "post").GroupByDate "2006" }} - <section class="f4 bb b--black-40 mw7 center"> - <h4 class="">{{ .Key }}</h4> - - {{ range .Pages.GroupByDate "January" }} - <ul class="list mv1"> - <li class="b">{{ .Key }}</li> - - <ul class="pv2"> - {{ range .Pages }} - <li class="black-50"><a href="{{ .Permalink }}" class="f4 dark-gray underline-hover">{{.Title}}</a> - {{ .Date.Format "Jan 2" }}</li> - {{ end}} - </ul> - </ul> - {{ end}} - </section> - {{ end }} -</div> -{{ end }} diff --git a/layouts/_default/author.html b/layouts/_default/author.html new file mode 100644 index 0000000..b2277dd --- /dev/null +++ b/layouts/_default/author.html @@ -0,0 +1,27 @@ +{{ define "hero" }} + {{ partial "hero.html" . }} +{{ end }} +{{ define "main" }} + {{- $sectionDelimiter := "<!-- section break -->" -}} + {{- $rawContentSections := split .RawContent $sectionDelimiter -}} + {{ range $rawContentSections }} + <div class="even:bg-gray-200"> + <div class="max-w-screen-md mx-auto py-2 px-1 main-content"> + {{ . | markdownify }} + </div> + </div> + {{ end }} + + {{ with where .Pages "Type" "publication" }} + {{ if gt (len .) 0 }} + <div class="even:bg-gray-200"> + <div class="max-w-screen-md mx-auto py-2 px-1"> + <h2 class="baskerville">Publications</h2> + {{ range . }} + {{ partial "post.html" . }} + {{ end }} + </div> + </div> + {{ end }} + {{ end }} +{{ end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 7f7c5ae..ffdabc9 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,12 +1,12 @@ -<!DOCTYPE html> -<html> - {{- partial "head.html" . -}} - <body class="bg-near-white sans-serif" - style="background:url('{{ .Site.Params.coverImage | absURL }}') fixed;"> - {{- partial "header.html" . -}} - {{- block "main" . }}{{- end }} - {{- partial "footer.html" . -}} - - {{- block "footerfiles" . }}{{- end }} - </body> +<!doctype html> +<html lang="{{ site.Language }}"> + {{- partial "head.html" . -}} + <body class="bg-white"> + {{- partial "header.html" . -}} + {{ block "hero" . }}{{ end }} + <div id="content" class="min-h-screen font-sans"> + {{- block "main" . }}{{- end }} + </div> + {{- partial "footer.html" . -}} + </body> </html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html index c9839f8..0eeb8c7 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,8 +1,12 @@ +{{ define "hero" }} + {{ partial "hero.html" . }} +{{ end }} + {{ define "main" }} -<section class="bg-near-white pb2 pt4"> - {{ range .Paginator.Pages }} - {{ .Render "summary" }} + <div class="max-w-screen-md mx-auto p-1"> + {{ range .Paginator.Pages.ByPublishDate.Reverse }} + {{ partial "post.html" . }} {{ end }} {{ partial "pagination.html" . }} -</section> + </div> {{ end }} diff --git a/layouts/_default/search.html b/layouts/_default/search.html index 4bf77f2..e61c9a0 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -1,30 +1,58 @@ -{{ define "footerfiles" }} -<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> -<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.2.1/fuse.min.js"></script> -<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js"></script> -<script src="{{ "js/search.js" | absURL }}"></script> -{{ end }} - {{ define "main" }} -<section class="bg-near-white pt5"> - <div class="mw7 center pv4" > - <form action="{{ .Permalink }}"> - <input id="search-query" name="s"/> - </form> - <div id="search-results"> - <h3>Matching pages</h3> - </div> + <div class="max-w-screen-md mx-auto p-1"> + <header> + <h2 class="baskerville px-1"> + {{ T "search" | humanize }} + </h2> + </header> + + <form action="{{ .Permalink }}"> + <input + id="search-query" + name="q" + placeholder="{{ T "search_placeholder" }}" + class="p-2 w-full border" + /> + </form> + + <div id="search-results" class="my-2"> + <p class="p-4 text-xl font-semibold text-center"> + {{ T "search_request" }} + </p> </div> -</section> -<!-- this template is sucked in by search.js and appended to the search-results div above. So editing here will adjust style --> -<script id="search-result-template" type="text/x-js-template"> - <div id="summary-${key}" class="bt bb b--black-10 ph4"> - <h4><a href="${link}">${title}</a></h4> - <p>${snippet}…</p> + </div> + <template id="no-match"> + <p + class="bg-red-100 p-4 text-red-600 text-xl font-semibold text-center border rounded border-current" + > + {{ T "no_match_found" }} + </p> + </template> + <template id="search-result-template"> + <article class="py-2 border-y border-gray-200 search_summary"> + <a class="hover:opacity-50 search_link" href=""> + <time class="float-right text-sm px-8 search_time"></time> + <h4 class="baskerville my-2 search_title"></h4> + <div class="search_snippet"></div> + </a> + </article> + </template> + <script + async + src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/7.0.0/fuse.min.js" + integrity="sha512-GrJ4P9yra6dftp5O0eaKFKS4ch1FYn1xR/VCHQIMJO1LNqcKhjkAkAETHYoE81Ffh3BjCJMWA/AZSYP521jxFA==" + crossorigin="anonymous" + referrerpolicy="no-referrer" + ></script> - ${ isset tags }<p><i class="fa fa-tags"></i> Tags: ${tags}</p>${ end } - ${ isset categories }<p><i class="fa fa-bookmark"></i> Categories: ${categories}</p>${ end } - </div> -</script> + {{ with resources.Get "js/search.js" | resources.Minify | fingerprint }} + <script + async + src="{{ .RelPermalink }}" + integrity="{{ .Data.Integrity }}" + crossorigin="anonymous" + referrerpolicy="no-referrer" + ></script> + {{ end }} {{ end }} diff --git a/layouts/_default/search.json b/layouts/_default/search.json new file mode 100644 index 0000000..9fae26d --- /dev/null +++ b/layouts/_default/search.json @@ -0,0 +1,13 @@ + +{{ $dateFormat := .Site.Params.dateFormat | default ":date_medium" }} +{{- $.Scratch.Add "index" slice -}} +{{- range (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) -}} + + {{- $.Scratch.Add "index" (dict "title" .Title + "tags" .Params.tags + "categories" .Params.categories + "contents" (.Summary | plainify) + "date" (time.Format $dateFormat .Date) + "permalink" .Permalink) -}} +{{- end -}} +{{- $.Scratch.Get "index" | jsonify -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e28413d..7c95390 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,71 +1,40 @@ {{ define "main" }} -<article> - <div id="post-header-cover" class="w-100 vh-50 dt bg-center cover bg-black-30 pt4" - {{ with .Params.coverimage }} - style="background-image:url({{ . }})" - {{ end }} > - <header class="dt pa2 pa5-ns mw7 center post-header white"> - <h1 class="f1 lh-title"> - {{ .Title }}</h1> - - {{ if not (eq .Params.showMeta false) }} - <div class="f4 tracked mb3">{{ .Date.Format "Mon, Jan 2, 2006" }}</div> - {{ partial "meta.html" . }} - {{ end }} - </header> - </div> - - <div id="content" class="bg-near-white"> - <div class="mw7 center lh-copy pv4 ph2 black-70"> - {{ .Content }} - </div> - - <footer class="mw7 center ph3 pb2 bt bb cf b--black-50"> - {{ with .Params.tags }} - <div class="fl-ns w-50-ns mb2"> - - <h5 class="f5 ttu black-60"><i class="fa fa-lg fa-tags"></i> Tagged in</h5> - {{ range . }} - <a class="f5 link br1 ph3 pv2 blue dib hover-bg-light-blue hover-white ba" - href="{{ $.Site.LanguagePrefix }}/tags/{{ . | urlize }}/">{{ . }}</a> - {{ end }} - </div> - {{ end }} - - <div class="fl-ns w-50-ns mb2"> - <h5 class="f5 ttu black-60"><i class="fa fa-lg fa-share-alt"></i> Share in Social Networks</h5> - {{ range .Site.Params.sharingOptions }} - <a class="f4 link br1 ph3 pv2 blue dib hover-bg-light-blue hover-white ba" target="new" href="{{ printf .url $.Permalink }}"> - <i class="fa {{ .icon }}"></i> - </a> - {{ end }} - </div> - </footer> - - <!-- Pagination Actions for posts --> - {{ if not (eq .Params.showActions false) }} - <div class="mv3 tc"> - {{ with .NextInSection }} - <a href="{{ .RelPermalink }}" class="dib f4 link br1 ma1 pa2 blue hover-bg-light-blue hover-white ba"> - <i class="fa fa-angle-left"></i> Newer <br/> - {{ .Title }} - </a> - {{ end}} - - {{ with .PrevInSection }} - <a href="{{ .RelPermalink }}" class="dib f4 link br1 ma1 pa2 blue hover-bg-light-blue hover-white ba"> - Older <i class="fa fa-angle-right"></i> <br/> - {{ .Title }} - </a> - {{ end}} - </div> - {{ end}} - - {{ if not (eq .Params.comments false) }} - <div class="mw7 center mv4 pa2"> - {{ template "_internal/disqus.html" . }} - </div> + <header class="max-w-screen-md mx-auto"> + <h1 class="baskerville px-1"> + {{ .Title }} + </h1> + + {{ with .Params.subtitle }} + <h3 class="text-2xl baskerville my-4 p-1">{{ . }}</h3> + {{ end }} + + {{ partial "meta_links.html" . }} + {{ if .Params.metadata }} + {{ partial "metadata.html" . }} + {{ end }} + + {{ partial "leading_image.html" . }} + </header> + <div class="main-content max-w-screen-md mx-auto px-1"> + {{ .Content }} + </div> + {{ partial "image-gallery" . }} + + {{ if .Site.Params.tipping }} + {{ partial "tipping" . }} + {{ end }} + <div class="py-2"> + {{ if in (slice "post" "talk") .Section }} + {{ range .Params.authors }} + {{ $name := . }} + {{ $path := printf "/%s/%s" "authors" ( $name | urlize ) }} + {{ with $.GetPage $path }} + {{ if .File }} + {{ partial "author_card" (merge .Params (dict "path" $path )) }} + {{ end }} {{ end }} - </div> -</article> + {{ end }} + {{ end }} + {{ partial "post_pager" . }} + </div> {{ end }} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html deleted file mode 100644 index 379694c..0000000 --- a/layouts/_default/summary.html +++ /dev/null @@ -1,25 +0,0 @@ -<article class="bt bb b--black-10 mw7 center"> - <a href='{{ .Permalink }}' class="db pv4 ph3 black no-underline dim"> - <header> - <h1 class="f2 lh-title black-90 "> - {{ .Title }} - </h1> - <div class="gray">{{ .Date.Format "Mon, Jan 2, 2006" }} - {{ .FuzzyWordCount }} Words </div> - </header> - <p class="f4 lh-copy black-80"> - {{ .Summary }} - </p> - <footer> - - <nobr class="link">Continue reading →</nobr> - {{ with .Params.thumbnailImage }} - <img src="{{ . }}" class="mt2 br2"> - {{ else }} - {{ if .Params.coverimage }} - <img src="{{ .Params.coverimage }}" class="mt2 br2" /> - {{ end}} - {{ end }} - - </footer> - </a> -</article> diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html deleted file mode 100644 index 42d5541..0000000 --- a/layouts/_default/terms.html +++ /dev/null @@ -1,19 +0,0 @@ -{{ define "main" }} -<div id="content" class="bg-near-white pa2 pt5"> - <section class="mw7 center"> - {{ range .Data.Terms.ByCount }} - <h4 class="f4"> - <a href="{{ .Name }}" class="dark-gray underline-hover"> - {{ .Name }} ({{ .Pages | len }}) - </a> - </h4> - - <ul class="bb b--black-50 pb2"> - {{ range .Pages.ByDate.Reverse }} - <li class="black-50"><a href="{{ .Permalink }}" class="f4 dark-gray underline-hover">{{.Title}}</a> - {{ .Date.Format "Jan 2, 2006" }}</li> - {{ end}} - </ul> - {{ end }} - </section> -</div> -{{ end }} |