mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-06 00:33:39 +00:00
Rename theme path
This commit is contained in:
9
themes/hugo-theme-gruvbox/layouts/partials/comments.html
Normal file
9
themes/hugo-theme-gruvbox/layouts/partials/comments.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<!--
|
||||
Comments at the end of posts, e.g.:
|
||||
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
|
||||
|
||||
... or another comment engine.
|
||||
See also: https://gohugo.io/content-management/comments
|
||||
-->
|
29
themes/hugo-theme-gruvbox/layouts/partials/footer.html
Normal file
29
themes/hugo-theme-gruvbox/layouts/partials/footer.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<footer>
|
||||
<div class="copyright">
|
||||
{{ with $.Site.Copyright }}
|
||||
{{ . | safeHTML }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{{ $jsBuildOptions := dict "target" "es6" }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $jsBuildOptions = $jsBuildOptions | merge (dict "minify" "true") }}
|
||||
{{ end }}
|
||||
|
||||
{{ $prism := resources.Get "js/prism.js" | resources.ExecuteAsTemplate "js/prism.js" . }}
|
||||
{{ $bundle := slice $prism | resources.Concat "js/main.js" | js.Build $jsBuildOptions }}
|
||||
{{ $flexsearch := resources.Get "js/flexsearch.js" | resources.ExecuteAsTemplate "js/flexsearch.js" . | js.Build $jsBuildOptions }}
|
||||
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $bundle = $bundle | fingerprint "sha512" }}
|
||||
{{ $flexsearch = $flexsearch | fingerprint "sha512" }}
|
||||
{{ end }}
|
||||
|
||||
{{/* prettier-ignore-start */}}
|
||||
<script src="{{ $bundle.RelPermalink }}"></script>
|
||||
<script src="{{ $flexsearch.RelPermalink }}"></script>
|
||||
{{/* prettier-ignore-end */}}
|
||||
|
||||
<!-- Extensibility -->
|
||||
{{ partial "footer_end.html" . }}
|
@@ -0,0 +1,3 @@
|
||||
<!--
|
||||
Add custom HTML at the end of <body>
|
||||
-->
|
@@ -0,0 +1,10 @@
|
||||
{{ $jsBuildOptions := dict "target" "es6" }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $jsBuildOptions = $jsBuildOptions | merge (dict "minify" "true") }}
|
||||
{{ end }}
|
||||
|
||||
{{ $darkMode := resources.Get "js/dark-mode.js" | js.Build $jsBuildOptions }}
|
||||
|
||||
<script>
|
||||
{{ $darkMode.Content | safeJS }}
|
||||
</script>
|
@@ -0,0 +1,7 @@
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#282828" />
|
||||
<meta name="msapplication-TileColor" content="#282828" />
|
||||
<meta name="theme-color" content="#282828" />
|
21
themes/hugo-theme-gruvbox/layouts/partials/head/head.html
Normal file
21
themes/hugo-theme-gruvbox/layouts/partials/head/head.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
{{ partial "head/resource-hints.html" . }}
|
||||
{{ partial "head/seo.html" . }}
|
||||
|
||||
|
||||
<!-- Extensibility -->
|
||||
{{ partial "head/head_start.html" . }}
|
||||
|
||||
{{ partial "head/stylesheets.html" . }}
|
||||
|
||||
{{ partial "head/dark-mode.html" . }}
|
||||
|
||||
{{ partial "head/favicons.html" . }}
|
||||
|
||||
|
||||
<!-- Extensibility -->
|
||||
{{ partial "head/head_end.html" . }}
|
||||
</head>
|
@@ -0,0 +1,3 @@
|
||||
<!--
|
||||
Add custom HTML at the end of <head>
|
||||
-->
|
@@ -0,0 +1,3 @@
|
||||
<!--
|
||||
Add custom HTML at the start of <head>
|
||||
-->
|
@@ -0,0 +1,42 @@
|
||||
<!-- Preload commonly used font variations -->
|
||||
|
||||
<!-- Roboto Slab -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/roboto-slab-latin-400.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/roboto-slab-latin-700.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
|
||||
<!-- Fira Code -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/fira-code-latin-300.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/fira-code-latin-400.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/fira-code-latin-700.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
55
themes/hugo-theme-gruvbox/layouts/partials/head/seo.html
Normal file
55
themes/hugo-theme-gruvbox/layouts/partials/head/seo.html
Normal file
@@ -0,0 +1,55 @@
|
||||
{{ if eq .Kind "404" }}
|
||||
<meta name="robots" content="noindex, follow" />
|
||||
{{ else }}
|
||||
{{ with .Params.robots }}
|
||||
<meta name="robots" content="{{ . }}" />
|
||||
{{ else }}
|
||||
<meta
|
||||
name="robots"
|
||||
content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $title := .Title }}
|
||||
{{ if .IsHome }}
|
||||
{{ $title = .Site.Title }}
|
||||
{{ with .Site.Params.Subtitle }}
|
||||
{{ $title = printf "%s — %s" $title . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<title>{{ $title }}</title>
|
||||
|
||||
<meta
|
||||
name="description"
|
||||
content="
|
||||
{{- with .Description -}}
|
||||
{{- . -}}
|
||||
{{- else -}}
|
||||
{{- with .Summary | plainify -}}
|
||||
{{- . -}}
|
||||
{{- else -}}
|
||||
{{- .Site.Params.description -}}
|
||||
{{- end -}}
|
||||
{{- end -}}"
|
||||
/>
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
|
||||
<!-- Internal Hugo templates -->
|
||||
<!-- See https://gohugo.io/templates/internal -->
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/schema.html" . }}
|
||||
|
||||
|
||||
<!-- RSS feed -->
|
||||
<!-- See https://gohugo.io/templates/rss/#reference-your-rss-feed-in-head -->
|
||||
{{ range .AlternativeOutputFormats }}
|
||||
<link
|
||||
rel="{{ .Rel }}"
|
||||
type="{{ .MediaType.Type }}"
|
||||
href="{{ .RelPermalink }}"
|
||||
title="{{ $.Site.Title }}"
|
||||
/>
|
||||
{{ end }}
|
@@ -0,0 +1,67 @@
|
||||
<!-- Styles -->
|
||||
{{ $defaultTheme := .Param "defaultTheme" | default "light" }}
|
||||
|
||||
{{ $critical := sort (resources.Match "css/critical/*.css") "Name" | resources.Concat nil | resources.ExecuteAsTemplate nil . | resources.PostCSS }}
|
||||
{{ $nonCritical := sort (resources.Match "css/non-critical/*.css") "Name" | resources.Concat "css/non-critical.css" | resources.ExecuteAsTemplate "css/non-critical.css" . | resources.PostCSS }}
|
||||
{{ $prismDark := resources.Get "prism-themes/prism-gruvbox-dark.css" }}
|
||||
{{ $prismLight := resources.Get "prism-themes/prism-gruvbox-light.css" }}
|
||||
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $critical = $critical | resources.PostProcess }}
|
||||
{{ $nonCritical = $nonCritical | fingerprint "sha512" | resources.PostProcess }}
|
||||
{{ $prismDark = $prismDark | minify | fingerprint "sha512" }}
|
||||
{{ $prismLight = $prismLight | minify | fingerprint "sha512" }}
|
||||
{{ end }}
|
||||
|
||||
<style>
|
||||
/* stylelint-disable */
|
||||
{{ $critical.Content | safeCSS }}
|
||||
/* stylelint-enable */
|
||||
</style>
|
||||
|
||||
<link
|
||||
rel="preload"
|
||||
href="{{ $nonCritical.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
/>
|
||||
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
id="prism-dark"
|
||||
rel="preload"
|
||||
href="{{ $prismDark.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
{{ if eq $defaultTheme "light" }}disabled{{ end }}
|
||||
/>
|
||||
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
id="prism-light"
|
||||
rel="preload"
|
||||
href="{{ $prismLight.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
{{ if eq $defaultTheme "dark" }}disabled{{ end }}
|
||||
/>
|
||||
|
||||
<noscript>
|
||||
{{ if eq $defaultTheme "light" }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $prismLight.RelPermalink }}"
|
||||
/>
|
||||
{{ else }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $prismDark.RelPermalink }}"
|
||||
/>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $nonCritical.RelPermalink }}"
|
||||
/>
|
||||
</noscript>
|
62
themes/hugo-theme-gruvbox/layouts/partials/header.html
Normal file
62
themes/hugo-theme-gruvbox/layouts/partials/header.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<header>
|
||||
<a
|
||||
class="logo"
|
||||
href="
|
||||
{{- with $.Site.Params.Logo.URL -}}
|
||||
{{- . -}}
|
||||
{{- else -}}
|
||||
{{- $.Site.BaseURL -}}
|
||||
{{- end -}}"
|
||||
>
|
||||
{{ with $.Site.Params.Logo.Text }}
|
||||
<div class="logo__text">{{ . }}</div>
|
||||
{{ end }}
|
||||
<div class="logo__chevron">></div>
|
||||
<div class="logo__cursor">█</div>
|
||||
</a>
|
||||
|
||||
<div class="search">
|
||||
<input
|
||||
id="search__text"
|
||||
type="search"
|
||||
placeholder="Search..."
|
||||
aria-label="Search"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<div id="search__suggestions" class="search__suggestions--hidden"></div>
|
||||
</div>
|
||||
|
||||
<nav id="menu">
|
||||
<ul class="menu--horizontal">
|
||||
{{ range $.Site.Menus.main }}
|
||||
<li class="menu__item">
|
||||
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
<div class="menu__burger">
|
||||
<!-- Invisible checkbox indicating menu state -->
|
||||
<input class="menu__item" type="checkbox" aria-label="Open main menu" />
|
||||
|
||||
{{ partial "icons/tabler-icon.html" "menu-2" }}
|
||||
|
||||
|
||||
<ul class="menu--vertical">
|
||||
{{ range $.Site.Menus.main }}
|
||||
<li>
|
||||
<a class="menu__item" href="{{ .URL }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<button class="theme__toggle light--hidden" aria-label="Toggle light mode">
|
||||
{{ partial "icons/tabler-icon.html" "sun" }}
|
||||
</button>
|
||||
|
||||
<button class="theme__toggle dark--hidden" aria-label="Toggle dark mode">
|
||||
{{ partial "icons/tabler-icon.html" "moon" }}
|
||||
</button>
|
||||
</header>
|
@@ -0,0 +1 @@
|
||||
{{ partial "icons/svg.html" (printf "simple-icons/%s.svg" .) }}
|
@@ -0,0 +1,2 @@
|
||||
{{ $path := lower . }}
|
||||
{{ (resources.Get $path).Content | safeHTML }}
|
@@ -0,0 +1 @@
|
||||
{{ partial "icons/svg.html" (printf "tabler-icons/%s.svg" .) }}
|
95
themes/hugo-theme-gruvbox/layouts/partials/image.html
Normal file
95
themes/hugo-theme-gruvbox/layouts/partials/image.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<!-- prettier-ignore -->
|
||||
{{ if .caption }}
|
||||
<figure>
|
||||
{{ end }}
|
||||
|
||||
{{ if (strings.HasPrefix .src "http") }}
|
||||
<!-- External image -->
|
||||
<img
|
||||
src="{{ .src }}"
|
||||
alt="{{ .alt }}"
|
||||
{{ with .caption }}title="{{ . | markdownify | plainify }}"{{ end }}
|
||||
{{ if .lazy }}loading="lazy"{{ end }}
|
||||
/>
|
||||
{{ else if (strings.HasPrefix .src "/") }}
|
||||
<!-- Image from static/ -->
|
||||
{{ $imageConfig := imageConfig (path.Join "static" .src) }}
|
||||
<img
|
||||
src="{{ .src }}"
|
||||
alt="{{ .alt }}"
|
||||
{{ with .caption }}title="{{ . | markdownify | plainify }}"{{ end }}
|
||||
{{ if .lazy }}loading="lazy"{{ end }}
|
||||
width="{{ $imageConfig.Width }}"
|
||||
height="{{ $imageConfig.Height }}"
|
||||
/>
|
||||
{{ else }}
|
||||
{{ $src := .src }}
|
||||
{{ if strings.HasPrefix $src "./" }}
|
||||
<!-- Strip "./" prefix from relative path -->
|
||||
{{ $src = substr $src 2 }}
|
||||
{{ end }}
|
||||
<!-- Image from page bundle -->
|
||||
{{ $images := .page.Resources.ByType "image" }}
|
||||
{{ $image := $images.GetMatch $src }}
|
||||
{{ if eq $image.MediaType.SubType "svg" }}
|
||||
<!-- No processing for SVGs -->
|
||||
<img src="{{ $image.RelPermalink }}" alt="{{ .alt }}" />
|
||||
{{ else }}
|
||||
<!-- Calculate resize widths in increments of 100px -->
|
||||
{{ $minWidth := .page.Site.Params.imageResize.min | default 300 }}
|
||||
{{ $maxWidth := .page.Site.Params.imageResize.max | default 700 }}
|
||||
{{ $increment := .page.Site.Params.imageResize.increment | default 200 }}
|
||||
{{ $widths := seq $minWidth $increment $maxWidth }}
|
||||
{{ if lt $image.Width $maxWidth }}
|
||||
{{ $widths = $widths | append $image.Width }}
|
||||
{{ end }}
|
||||
{{ $widthsCount := len $widths }}
|
||||
|
||||
{{ $sizes := slice }}
|
||||
{{ $srcSet := slice }}
|
||||
{{ $webpSrcSet := slice }}
|
||||
{{ range $i, $width := $widths }}
|
||||
{{ if ge $image.Width $width }}
|
||||
{{ if eq $i (sub $widthsCount 1) }}
|
||||
{{ $sizes = $sizes | append (printf "%dpx" $width) }}
|
||||
{{ else }}
|
||||
{{ $maxWidth := (add $width (sub $increment 1)) }}
|
||||
{{ $sizes = $sizes | append (printf "(max-width: %dpx) %dpx" $maxWidth $width) }}
|
||||
{{ end }}
|
||||
{{ $resized := $image.Resize (printf "%dx" $width) }}
|
||||
{{ $srcSet = $srcSet | append (printf "%s %dw" $resized.RelPermalink $resized.Width) }}
|
||||
{{ if not (eq "webp" $image.MediaType.SubType) }}
|
||||
<!-- If image format is not WebP, add conversions -->
|
||||
{{ $webp := $image.Resize (printf "%dx webp" $width) }}
|
||||
{{ $webpSrcSet = $webpSrcSet | append (printf "%s %dw" $webp.RelPermalink $webp.Width) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<picture>
|
||||
<source
|
||||
type="image/webp"
|
||||
{{ with $webpSrcSet }}srcset="{{ delimit . "," }}"{{ end }}
|
||||
{{ with $sizes }}sizes="{{ delimit . "," }}"{{ end }}
|
||||
/>
|
||||
<img
|
||||
src="{{ $image.RelPermalink }}"
|
||||
{{ with $srcSet }}srcset="{{ delimit . "," }}"{{ end }}
|
||||
{{ with $sizes }}sizes="{{ delimit . "," }}"{{ end }}
|
||||
alt="{{ .alt }}"
|
||||
{{ with .caption }}title="{{ . | markdownify | plainify }}"{{ end }}
|
||||
{{ if .lazy }}loading="lazy"{{ end }}
|
||||
width="{{ $image.Width }}"
|
||||
height="{{ $image.Height }}"
|
||||
/>
|
||||
</picture>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
{{ if .caption }}
|
||||
<figcaption>{{ .page.RenderString .caption }}</figcaption>
|
||||
</figure>
|
||||
{{ end }}
|
15
themes/hugo-theme-gruvbox/layouts/partials/pagination.html
Normal file
15
themes/hugo-theme-gruvbox/layouts/partials/pagination.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<div class="pagination">
|
||||
{{ if .HasPrev }}
|
||||
<span class="pagination__button pagination__button--previous">
|
||||
<a href="{{ .Prev.URL }}">
|
||||
<span><</span>
|
||||
<span>Newer Posts</span>
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ if .HasNext }}
|
||||
<span class="pagination__button pagination__button--next">
|
||||
<a href="{{ .Next.URL }}">Older Posts ></a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
25
themes/hugo-theme-gruvbox/layouts/partials/post-list.html
Normal file
25
themes/hugo-theme-gruvbox/layouts/partials/post-list.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{{ range $pageIndex, $page := .Pages }}
|
||||
<article class="post">
|
||||
<div class="post-header">
|
||||
<h2>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
|
||||
</h2>
|
||||
{{ partial "post-meta.html" (dict "page" . "pageIndex" $pageIndex) }}
|
||||
</div>
|
||||
|
||||
<div class="post-content">
|
||||
{{ with .Description }}
|
||||
{{ . }}
|
||||
{{ else }}
|
||||
{{ .Summary }}
|
||||
{{ if .Truncated }}
|
||||
<div class="post-content__read-more">
|
||||
<a href="{{ .RelPermalink }}">Read more ></a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination.html" . }}
|
27
themes/hugo-theme-gruvbox/layouts/partials/post-meta.html
Normal file
27
themes/hugo-theme-gruvbox/layouts/partials/post-meta.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<div class="post-meta">
|
||||
{{- with .page.Date -}}
|
||||
<span>{{ .Format "2006-01-02" }}</span>
|
||||
{{- end -}}
|
||||
{{- with .page.Params.Author -}}
|
||||
<span> by </span><span class="post-meta__author">{{ . }}</span>
|
||||
{{- end -}}
|
||||
{{ with .page.Params.tags }}
|
||||
<div class="post-tags">
|
||||
{{ range . -}}
|
||||
<a class="post-tag" href="{{ urlize (printf "tags/%s" . ) | absURL }}">
|
||||
{{- /* Replace hyphen with non-breaking hyphen */ -}}
|
||||
{{- replace (urlize .) "-" "‑" | safeHTML -}}
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .page.Params.cover }}
|
||||
<!--
|
||||
Only lazy-load images below-the-fold. For post lists, start loading
|
||||
covers from the third post and onwards.
|
||||
-->
|
||||
{{ $lazy := ge .pageIndex 2 }}
|
||||
{{ partial "image.html" (dict "src" .page.Params.cover.src "alt" .page.Params.cover.alt "caption" .page.Params.cover.caption "page" .page "lazy" $lazy) }}
|
||||
{{ end }}
|
||||
</div>
|
19
themes/hugo-theme-gruvbox/layouts/partials/sidebar.html
Normal file
19
themes/hugo-theme-gruvbox/layouts/partials/sidebar.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<div class="sidebar">
|
||||
{{ if .Params.toc }}
|
||||
{{ with .TableOfContents }}
|
||||
<aside class="toc">
|
||||
<nav>
|
||||
<p class="sidebar__heading">Table Of Contents</p>
|
||||
{{ . }}
|
||||
</nav>
|
||||
</aside>
|
||||
<hr />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $.Site.Params.tagCloud.enable }}
|
||||
<aside>
|
||||
{{ partial "tag-cloud.html" . }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
</div>
|
20
themes/hugo-theme-gruvbox/layouts/partials/social-share.html
Normal file
20
themes/hugo-theme-gruvbox/layouts/partials/social-share.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{ $url := .Permalink }}
|
||||
{{ $title := .Title }}
|
||||
{{ with $.Site.Params.socialShare }}
|
||||
<div class="social-share">
|
||||
<strong class="social-share__heading">Share this post: </strong>
|
||||
{{ range . }}
|
||||
{{ $href := .formatString }}
|
||||
{{ $href := replace $href "{url}" (urlquery $url) }}
|
||||
{{ $href := replace $href "{title}" (urlquery $title) }}
|
||||
<a
|
||||
class="social-share__item"
|
||||
href="{{ $href | safeURL }}"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{{ partial (printf "icons/%s" .iconSuite) .iconName }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
32
themes/hugo-theme-gruvbox/layouts/partials/tag-cloud.html
Normal file
32
themes/hugo-theme-gruvbox/layouts/partials/tag-cloud.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
Original work by Artem Sidorenko: https://www.sidorenko.io/post/2017/07/nice-tagcloud-with-hugo/
|
||||
Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0/)
|
||||
-->
|
||||
|
||||
{{ with $.Site.Taxonomies.tags }}
|
||||
{{ $fontUnit := "rem" }}
|
||||
{{ $minFontSize := $.Site.Params.tagCloud.minFontSizeRem | default 0.8 }}
|
||||
{{ $maxFontSize := $.Site.Params.tagCloud.maxFontSizeRem | default 2.0 }}
|
||||
{{ $fontSizeSpread := sub $maxFontSize $minFontSize }}
|
||||
{{ $min := len (index .ByCount.Reverse 0).Pages }}
|
||||
{{ $max := add (len (index .ByCount 0).Pages) 1 }}
|
||||
|
||||
|
||||
<div class="tag-cloud">
|
||||
{{ range $tagName, $weightedPages := . }}
|
||||
{{ $count := len $weightedPages.Pages }}
|
||||
{{ $weight := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
|
||||
{{ $fontSize := (add $minFontSize (mul $fontSizeSpread $weight) ) }}
|
||||
<a
|
||||
href="{{ "/tags/" | relLangURL }}{{ $tagName | urlize }}"
|
||||
style="font-size:{{ $fontSize }}{{ $fontUnit }}"
|
||||
{{ if eq $.Page.Params.title $tagName -}}
|
||||
class="tag-cloud__tag tag-cloud__tag--active"
|
||||
{{ else -}}
|
||||
class="tag-cloud__tag"
|
||||
{{ end -}}
|
||||
>{{ $tagName }}</a
|
||||
>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
Reference in New Issue
Block a user