mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-31 01:57:54 +00:00
Update layouts with the latest components
This commit is contained in:
parent
beb38008a7
commit
e66c5124aa
@ -12,5 +12,6 @@
|
||||
<script data-goatcounter="https://foo-dogsquared.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
|
||||
{{- end }}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
@ -4,7 +4,10 @@
|
||||
|
||||
{{- /* The homepage should show only pages from the given sections (with `$.Site.Params.mainSections`).
|
||||
Otherwise, we take the pages of a section. */ -}}
|
||||
{{- $pages := where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
|
||||
{{ $pages := .Pages }}
|
||||
{{ if .IsHome }}
|
||||
{{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
|
||||
{{ end }}
|
||||
|
||||
<ul class="posts--list">
|
||||
{{- $paginator := .Paginate $pages }}
|
@ -1,97 +0,0 @@
|
||||
{{ define "main" }}
|
||||
|
||||
<article class="post--single">
|
||||
<header>
|
||||
<h1>{{ .Title }}</h1>
|
||||
</header>
|
||||
{{- partial "partials/components/post-meta.html" . }}
|
||||
|
||||
{{- $is_toc := cond (ne .Params.toc nil) .Params.toc $.Site.Params.toc }}
|
||||
{{- if (and $is_toc (gt (countrunes .TableOfContents) 0)) }}
|
||||
<style>
|
||||
#TableOfContents:not(:empty)::before {
|
||||
content: "{{ i18n "table_of_contents" }}";
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
{{ .TableOfContents }}
|
||||
{{ end }}
|
||||
|
||||
<main>
|
||||
{{ .Content }}
|
||||
</main>
|
||||
|
||||
<hr>
|
||||
{{ $timeFmt := "2006-01-02 15:04:05 -0700" }}
|
||||
<div class="post__meta--single">
|
||||
{{- with .Params.author }}
|
||||
{{- $names := slice }}
|
||||
{{- range . }}{{ $names = $names | append .name }}{{ end }}
|
||||
<p data-content-author="{{ jsonify $names }}">
|
||||
<span>{{ i18n "published_by" }}</span>
|
||||
<span>{{ delimit $names ", " (printf " %s " (i18n "and")) }}</span>
|
||||
</p>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Only show the creation date if the `date` field is valid. */ -}}
|
||||
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
||||
<p data-content-publication-date="{{ .PublishDate }}">
|
||||
<span>Published:</span>
|
||||
<span><time datetime="{{ .PublishDate.Format $timeFmt }}">{{ .PublishDate.Format $timeFmt }}</time></span>
|
||||
</p>
|
||||
{{- end }}
|
||||
|
||||
{{- /* Publication date */ -}}
|
||||
{{- if and (ne (.Date.Format "2006") "0001") (ne .Date .PublishDate) -}}
|
||||
<p data-content-creation-date="{{ .Date }}">
|
||||
<span>Created:</span>
|
||||
<span><time datetime="{{ .Date.Format "2006-01-02 15:04:05 -0700" }}">{{ .Date.Format $timeFmt }}</time></span>
|
||||
</p>
|
||||
{{- end }}
|
||||
|
||||
{{- /* Modification date (will only appear if the publication date is less than the modified date.) */ -}}
|
||||
{{- if ne .Date .Lastmod }}
|
||||
<p data-content-modification-date="{{ .Lastmod }}">
|
||||
<span>{{ i18n "updated_on" }}:</span>
|
||||
<span><time datetime="{{ .Lastmod.Format "2006-01-02 15:04:05 -0700" }}">{{ .Lastmod.Format $timeFmt }}</time></span>
|
||||
</p>
|
||||
{{- end }}
|
||||
|
||||
{{- /* Link the translated versions if the article has at least one translated page. */ -}}
|
||||
{{- if .IsTranslated }}
|
||||
{{- $lang_links := slice }}
|
||||
{{- $langs := slice }}
|
||||
{{- range .Translations }}
|
||||
{{- $lang := cond (ne .Language.LanguageName nil) .Language.LanguageName .Lang }}
|
||||
{{- $lang_links = $lang_links | append (printf "<a href=%s>%s</a>" .Permalink $lang) }}
|
||||
{{- $langs = $langs | append $lang }}
|
||||
{{- end }}
|
||||
<p data-content-translations="{{ jsonify $langs }}">
|
||||
<span>{{ i18n "available_translations" }}:</span>
|
||||
<span>{{ delimit $lang_links "," (printf " %s " (i18n "and")) }}</span>
|
||||
</p>
|
||||
{{- end }}
|
||||
|
||||
{{- with .Params.tags }}
|
||||
{{- $tags := slice }}
|
||||
{{- range $index, $tag := . }}
|
||||
{{- $tag := printf `<a href="%s#%s">%s</a>` ("/tags" | relLangURL) ($tag | urlize) $tag }}
|
||||
{{- $tags = $tags | append $tag }}
|
||||
{{- end }}
|
||||
<p data-content-tags="{{ jsonify $tags }}">
|
||||
<span>Topic:</span>
|
||||
<span>{{ delimit $tags "." }}</span>
|
||||
</p>
|
||||
{{- end -}}
|
||||
|
||||
{{- with .GitInfo }}
|
||||
<p data-content-hash="{{ .Hash }}">
|
||||
<span>Hash:</span>
|
||||
<span>{{ .Hash }}</span>
|
||||
</p>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{{ end }}
|
||||
|
@ -1,26 +0,0 @@
|
||||
{{ define "main" }}
|
||||
{{ .Content }}
|
||||
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{- range .Data.Terms }}
|
||||
{{- $pages := .Pages }}
|
||||
{{- if ge (len $pages) 1 }}
|
||||
<section id="{{ .Page.Title | urlize }}">
|
||||
<header class="taxonomy__header">
|
||||
<h2>{{ .Page.Title }}</h2>
|
||||
<small>(<a href="{{ .Page.RelPermalink }}">{{ i18n "permalink" | default "Permalink" }}</a>)</small>
|
||||
</header>
|
||||
<ul class="taxonomy__pages">
|
||||
{{- range $pages }}
|
||||
<li class="taxonomy__page">
|
||||
<date datetime="{{ .PublishDate }}">{{ .PublishDate.Format "2006-01-02" }}</date>
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ end }}
|
@ -1,81 +0,0 @@
|
||||
{{- /*
|
||||
Here's where all of the inline partials are defined.
|
||||
If the partial is short enough, it should be put here.
|
||||
*/ -}}
|
||||
|
||||
{{- /* This is a partial that creates an icon from the icon templates. */ -}}
|
||||
{{- define "partials/components/icon.html" }}
|
||||
{{- $icon := . }}
|
||||
{{- $res := resources.ExecuteAsTemplate (printf $icon.output $icon.id) $icon.id (resources.Get $icon.template) }}
|
||||
<svg class="icon">
|
||||
<use href="{{ $res.Permalink }}#{{ $icon.id }}"></use>
|
||||
</svg>
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- /* A partial that aliases the Heroicon template from the icon partial */ -}}
|
||||
{{- define "partials/components/heroicon.html" }}
|
||||
{{- partial "components/icon.html" (dict "id" . "output" "icons/generic/%s.svg" "template" "templates/heroicon.svg") }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{- define "partials/components/theme-button.html" }}
|
||||
{{- if gt (len (index $.Site.Data "more-contentful").themes) 1 }}
|
||||
<div class="site__theme-btn" aria-label="Theme toggle">
|
||||
{{ partial "components/heroicon.html" "color-swatch" }}
|
||||
<div class="site__theme-dropdown">
|
||||
{{- range $filename, $scheme := (index $.Site.Data "more-contentful").themes }}
|
||||
{{- $name := cond (eq $filename "_index") (printf "%s (default)" .scheme) .scheme }}
|
||||
<div class="site__theme-item" {{ if ne $filename "_index" }}data-theme="{{ .scheme }}"{{ end }}>{{ $name }}</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
</svg>
|
||||
</div>
|
||||
<script defer>
|
||||
const themeDropdown = document.querySelector('.site__theme-btn');
|
||||
themeDropdown.addEventListener('click', (event) => {
|
||||
const { target } = event;
|
||||
if (target.classList.contains("site__theme-item")) {
|
||||
if (target.dataset.theme) {
|
||||
theme = target.dataset.theme;
|
||||
window.localStorage.setItem("theme", theme);
|
||||
document.documentElement.dataset.theme = theme;
|
||||
} else {
|
||||
window.localStorage.removeItem("theme");
|
||||
delete document.documentElement.dataset.theme;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- define "partials/components/post-meta.html" }}
|
||||
<div class="list post__meta">
|
||||
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
||||
<time datetime="{{ .PublishDate }}">
|
||||
{{ partial "components/heroicon.html" "calendar" }}
|
||||
<span style="margin-left: 0.5em;">{{ .PublishDate.Format "2006-01-02" }}</span>
|
||||
</time>
|
||||
{{- end }}
|
||||
|
||||
{{- if and .GitInfo (ne (.Date.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
|
||||
<time datetime="{{ .Lastmod }}">
|
||||
{{ partial "components/heroicon.html" "refresh" }}
|
||||
<span style="margin-left: 0.5em;">{{ .Lastmod.Format "2006-01-02" }}</span>
|
||||
</time>
|
||||
{{- end }}
|
||||
|
||||
{{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}}
|
||||
{{ with .Params.author }}
|
||||
{{ $author := index (first 1 .) 0 }}
|
||||
<span data-authors="{{ jsonify . }}">
|
||||
{{ partial "components/heroicon.html" "pencil" }}
|
||||
<span style="margin-left: 0.5em;">
|
||||
{{ $author.name }}{{ if ge (len .) 2 }}, et al.{{ end }}
|
||||
</span>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{- end }}
|
@ -37,16 +37,22 @@
|
||||
|
||||
|
||||
<!-- Copyright info. -->
|
||||
<p>{{ with $.Site.Copyright }}{{ . | markdownify }}{{ else }}© {{ now.Year }} {{ with $.Site.Author.name }}{{ . }}{{ else }}{{ $.Site.Title }}{{ end }}{{ end }}</p>
|
||||
{{- $markdownifyOpt := dict "display" "inline"
|
||||
"markup" "markdown" -}}
|
||||
<p>{{ with $.Site.Copyright }}{{ trim . " " | $.Page.RenderString $markdownifyOpt }}{{ else }}© {{ now.Year }} {{ with $.Site.Author.name }}{{ . }}{{ else }}{{ $.Site.Title }}{{ end }}{{ end }}</p>
|
||||
|
||||
{{- /* Extra notes */ -}}
|
||||
{{- with $.Site.Params.extraNotes }}
|
||||
<p>{{ trim . " " | markdownify }}</p>
|
||||
<p>{{ trim . " " | $.Page.RenderString $markdownifyOpt }}</p>
|
||||
{{- end }}
|
||||
|
||||
<p>
|
||||
<small>Generated on {{ now.Format "2006-01-02 15:04:05 -0700" }}</small></p>
|
||||
|
||||
{{ with (getenv "LAST_COMMIT_DATE") }}
|
||||
<p>Last updated: {{ time . | dateFormat "2 Jan 2006" }}</p>
|
||||
{{ end }}
|
||||
|
||||
{{ $logo := resources.Get "svg/logo.svg" }}
|
||||
<div id="logo" data-tooltip="Hey there! :3">
|
||||
{{ $logo.Content | safeHTML }}
|
||||
|
@ -66,6 +66,7 @@ It's a very small script so there's little effect on perceived performance. */ -
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/components/prism-core.min.js"></script>
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/plugins/keep-markup/prism-keep-markup.min.js"></script>
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
|
||||
|
||||
{{- /* medium-zoom */ -}}
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.5/dist/medium-zoom.min.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user