🎉 Initial commit

This commit is contained in:
Jimmy Cai
2020-08-22 13:20:08 +02:00
commit c698d944e6
69 changed files with 3781 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
{{ define "body_class" }}2-column{{ end }}
{{ define "main" }}
<div class="container extended flex on-phone--column align-items--flex-start">
{{ partial "sidebar/left.html" . }}
<main class="main full-width">
<div class="not-found-card">
<h1 class="article-title">Not Found</h1>
<h2 class="article-subtitle">This page does not exist.</h2>
</div>
</main>
</div>
{{ end }}
@@ -0,0 +1,18 @@
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
{{- $small := $image.Resize "480x" -}}
{{- $big := $image.Resize "1024x" -}}
{{- $alt := .PlainText | safeHTML -}}
{{- $caption := "" -}}
{{- with $alt -}}
{{- $caption = . | safeHTML -}}
{{- end -}}
<figure>
<a href="{{ $image.RelPermalink }}" data-size="{{ $image.Width }}x{{ $image.Height }}">
<img srcset="{{ $small.RelPermalink }} 480w, {{ $big.RelPermalink }} 1024w"
src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" loading="lazy"
alt="{{ if $alt }}{{ $alt }}{{ else if $caption }}{{ $caption | markdownify | plainify }}{{ else }}&nbsp;{{ end }}">
</a>
{{ with $caption }}
<figcaption>{{ . | markdownify }}</figcaption>
{{ end }}
</figure>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
{{- partial "head.html" . -}}
<body>
<div id="content">
{{- block "main" . }}{{- end }}
</div>
{{ partial "footer/script.html" . }}
{{ partial "footer/style.html" . }}
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
{{ define "body_class" }}2-column{{ end }}
{{ define "main" }}
<div class="container extended flex on-phone--column align-items--flex-start article-page">
{{ partial "sidebar/left.html" . }}
<div class="flex column do-not-overflow">
<main class="main">
<div id="article-toolbar">
<a href="{{ .Site.BaseURL }}" class="back-home">
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
<span>Back</span>
</a>
</div>
{{ partial "article/article.html" . }}
{{ partial "article/components/related-contents" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "article/components/comment" . }}
{{ end }}
{{ partialCached "footer" . }}
</main>
</div>
</div>
{{- partial "article/components/photoswipe.html" . -}}
{{ end }}
+41
View File
@@ -0,0 +1,41 @@
{{ define "body_class" }}2-column{{ end }}
{{ define "main" }}
<div class="container extended flex on-phone--column">
{{ partial "sidebar/left.html" . }}
<main class="main">
<h3 class="taxonomy-type">{{ .Type | singularize | humanize }}</h3>
<div class="taxonomy-card">
<div class="taxonomy-details">
<h3 class="taxonomy-count">{{ len .Pages }} post{{ if gt (len .Pages) 1 }}s{{ end }}</h3>
<h1 class="taxonomy-term">{{ .Title }}</h1>
{{ with .Params.description }}
<h2 class="taxonomy-description">{{ . }}</h2>
{{ end }}
</div>
{{ if .Params.image }}
{{- $image := partial "helper/image" . -}}
{{- $thumbnail := $image.Fill "120x120" -}}
<div class="taxonomy-image">
<img src="{{ $thumbnail.RelPermalink }}" width="{{ $thumbnail.Width }}"
height="{{ $thumbnail.Height }}" loading="lazy">
</div>
{{ end }}
</div>
<section class="article-list--compact">
{{ $v2 := where .Pages "Params.hidden" "!=" true }}
{{ $pag := .Paginate (.Pages) }}
{{ range $pag.Pages }}
{{ partial "article-list/compact" . }}
{{ end }}
</section>
{{- partial "pagination.html" . -}}
{{ partial "footer" . }}
</main>
</div>
{{ end }}
+25
View File
@@ -0,0 +1,25 @@
{{ define "body_class" }}3-column{{ end }}
{{ define "main" }}
<div class="container extended flex on-phone--column align-items--flex-start">
{{ partialCached "sidebar/left.html" . }}
<main class="main full-width">
{{ $postSection := $.Site.Params.postSection }}
{{ $v1 := where .Site.RegularPages "Section" $postSection }}
{{ $v2 := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $.Scratch.Set "filtered" ($v1 | intersect $v2) }}
{{ $pag := .Paginate ($.Scratch.Get "filtered") }}
<section class="article-list">
{{ range $index, $element := $pag.Pages }}
{{ partial "article-list/default" . }}
{{ end }}
{{- partial "pagination.html" . -}}
</section>
{{ partialCached "footer" . }}
</main>
{{ partialCached "sidebar/right.html" . }}
</div>
{{ end }}
+39
View File
@@ -0,0 +1,39 @@
{{ define "body_class" }}2-column{{ end }}
{{ define "main" }}
<div class="container extended flex on-phone--column align-items--flex-start">
{{ partial "sidebar/left.html" . }}
<main class="main template-archive">
<div class="widget">
<h1 class="widget-title">Categories</h1>
<div class="category-list">
<div class="article-list--tile">
{{ range ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ partial "article-list/tile" (dict "context" . "size" "250x150") }}
{{ end }}
</div>
</div>
</div>
{{ $postSection := $.Site.Params.postSection }}
{{ $v1 := where .Site.RegularPages "Section" $postSection }}
{{ $v2 := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := $v1 | intersect $v2 }}
{{ range $filtered.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }}
<div class="archive-group" id="{{ $id }}">
<h3 class="archive-date"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h3>
<div class="article-list--compact">
{{ range .Pages }}
{{ partial "article-list/compact" . }}
{{ end }}
</div>
</div>
{{ end }}
{{ partial "footer.html" . }}
</main>
</div>
{{ end }}
+18
View File
@@ -0,0 +1,18 @@
{{ define "body_class" }}2-column{{ end }}
{{ define "main" }}
<div class="container extended flex on-phone--column align-items--flex-start article-and-sidebar">
{{ partial "sidebar/left.html" . }}
<main class="main article-page do-not-overflow full-width">
{{ partial "article/article.html" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "article/components/comment" . }}
{{ end }}
</main>
</div>
{{ partial "article/components/photoswipe" . }}
{{ end }}
@@ -0,0 +1,24 @@
<article>
<div class="article-details">
<h2 class="article-title">
<a href="{{ .Permalink }}">
{{- .Title -}}
</a>
</h2>
<footer class="article-time">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
{{- .Date.Format ( or .Site.Params.dateFormat "Jan 02, 2006" ) -}}
</time>
</footer>
</div>
{{ if .Params.image }}
{{- $image := partial "helper/image" . -}}
{{- $thumbnail := $image.Fill "120x120" -}}
<div class="article-image">
<img src="{{ $thumbnail.RelPermalink }}" width="{{ $thumbnail.Width }}"
height="{{ $thumbnail.Height }}" loading="lazy">
</div>
{{ end }}
</article>
@@ -0,0 +1,51 @@
<article class="{{ if .Params.image }}has-image{{ end }}">
{{ if .Params.image }}
{{- $image := partial "helper/image" . -}}
{{- $thumbnailNotDesktop := $image.Resize "x500 smart" -}}
<div class="article-image">
<img src="{{ $thumbnailNotDesktop.RelPermalink }}"
width="{{ $thumbnailNotDesktop.Width }}" height="{{ $thumbnailNotDesktop.Height }}" loading="lazy"
alt="Featured image of post {{ .Title }}" />
</div>
{{ end }}
{{ $i := .Params.image }}
{{ $context := . }}
<div class="article-details">
{{ with $categories := .Params.categories }}
<header class="article-category">
{{ range first 1 $categories }}
{{ if $i }}
{{- $image := partial "helper/image" $context -}}
{{- $20x := $image.Fill "20x20 smart" -}}
<a href="/categories/{{ . | urlize }}" class="color-tag"
data-image="{{ $20x.RelPermalink }}">{{ . | humanize }}</a>
{{ else }}
<a href="/categories/{{ . | urlize }}">{{ . | humanize }}</a>
{{ end }}
{{ end }}
</header>
{{ end }}
<h2 class="article-title">
<a href="{{ .Permalink }}">
{{- .Title -}}
</a>
</h2>
{{ with .Params.description }}
<h3 class="article-subtitle">
{{ . }}
</h3>
{{ end }}
<footer class="article-time">
{{ (resources.Get "icons/clock.svg").Content | safeHTML }}
<time data-timeago="true" datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
{{- .Date.Format ( or .Site.Params.dateFormat "Jan 02, 2006" ) -}}
</time>
</footer>
</div>
</article>
+17
View File
@@ -0,0 +1,17 @@
<article class="{{ if .context.Params.image }}has-image{{ end }}">
<a href="{{ .context.Permalink }}">
{{ if .context.Params.image }}
{{- $thumbnail := (partial "helper/image" (.context) ).Fill .size -}}
<div class="article-image">
<img src="{{ $thumbnail.RelPermalink }}" width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}"
loading="lazy">
</div>
{{ end }}
<div class="article-details">
<h2 class="article-title">
{{- .context.Title -}}
</h2>
</div>
</a>
</article>
+75
View File
@@ -0,0 +1,75 @@
<article class="{{ if .Params.image }}has-image{{ end }} main-article">
<header class="article-header">
{{ if .Params.image }}
{{- $image := partial "helper/image" . -}}
{{- $tablet := $image.Resize "1024x" -}}
{{- $desktop := $image.Resize "2000x" -}}
{{- $20x := $image.Fill "20x20 smart" -}}
{{- .Scratch.Set "20x" $20x -}}
<div class="article-image">
<img srcset="{{ $tablet.RelPermalink }} 1024w, {{ $desktop.RelPermalink }} 2000w"
src="{{ $desktop.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"
loading="lazy"
alt="Featured image of post {{ .Title }}" />
</div>
{{ end }}
<div class="article-details">
{{ with $category := .Params.categories }}
<header class="article-category">
{{ range first 1 $category }}
{{ if $.Params.image }}
<a href="/categories/{{ . | urlize }}" class="color-tag"
data-image="{{ ($.Scratch.Get "20x").RelPermalink }}">{{ . | humanize }}</a>
{{ else }}
<a href="/categories/{{ . | urlize }}">{{ . | humanize }}</a>
{{ end }}
{{ end }}
</header>
{{ end }}
<h2 class="article-title">
<a href="{{ .Permalink }}">
{{- .Title -}}
</a>
</h2>
{{ with .Params.description }}
<h3 class="article-subtitle">
{{ . }}
</h3>
{{ end }}
<footer class="article-time">
{{ (resources.Get "icons/clock.svg").Content | safeHTML }}
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
{{- .Date.Format ( or .Site.Params.dateFormat "Jan 02, 2006" ) -}}
</time>
</footer>
</div>
</header>
<section class="article-content">
{{ .Content }}
</section>
<footer class="article-footer">
{{ with $tags := .Params.Tags }}
<section class="article-tags">
{{ range $tags }}
<a href="/tags/{{ . | urlize }}">{{ . | humanize }}</a>
{{ end }}
</section>
{{ end }}
{{ if .Site.Params.postLicense }}
<section class="article-copyright">
{{ (resources.Get "icons/copyright.svg").Content | safeHTML }}
<span>{{ .Site.Params.postLicense }}</span>
</section>
{{ end }}
</footer>
</article>
@@ -0,0 +1 @@
{{ template "_internal/disqus.html" . }}
@@ -0,0 +1,66 @@
<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true" style="display:none">
<!-- Background of PhotoSwipe.
It's a separate element as animating opacity is faster than rgba(). -->
<div class="pswp__bg"></div>
<!-- Slides wrapper with overflow:hidden. -->
<div class="pswp__scroll-wrap">
<!-- Container that holds slides.
PhotoSwipe keeps only 3 of them in the DOM to save memory.
Don't modify these 3 pswp__item elements, data is added later on. -->
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<!-- Controls are self-explanatory. Order can be changed. -->
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--share" title="Share"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
<!-- element will get class pswp__preloader--active when preloader is running -->
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,13 @@
<aside class="widget related-contents--wrapper">
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h1 class="widget-title">Related contents</h1>
<div class="related-contents">
<div class="flex article-list--tile">
{{ range . }}
{{ partial "article-list/tile" (dict "context" . "size" "250x350") }}
{{ end }}
</div>
</div>
{{ end }}
</aside>
+11
View File
@@ -0,0 +1,11 @@
{{- with .Description -}}
{{- . -}}
{{- else -}}
{{- if .IsPage -}}
{{- .Summary -}}
{{- else -}}
{{- with .Site.Params.subtitle -}}
{{- . -}}
{{- end -}}
{{- end -}}
{{- end -}}
+16
View File
@@ -0,0 +1,16 @@
{{- $title := .Title -}}
{{- $siteTitle := .Site.Title -}}
{{- $authorName := .Site.Author.name -}}
{{- if .IsHome -}}
{{- $v1 := where .Site.RegularPages "Type" "post" -}}
{{- $v2 := where .Site.RegularPages "Params.hidden" "!=" true -}}
{{- $filtered := $v1 | intersect $v2 -}}
{{- $pag := .Paginate ($filtered) -}}
{{ if .Paginator.HasPrev }}{{ .Paginator }} - {{ end }}{{ $siteTitle }}
{{- else if eq .Kind "term" -}}
{{- $pag := .Paginate (where .Data.Pages "Type" "post") -}}
{{ title .Data.Singular }}: {{ $title }}{{ if .Paginator.HasPrev }} - {{ .Paginator }}{{ end }} - {{ $siteTitle }}
{{- else -}}
{{- $title -}}
{{- end -}}
+7
View File
@@ -0,0 +1,7 @@
<footer class="site-footer">
<section class="copyright">&copy; {{ now.Format "2006" }} {{ .Site.Title }}</section>
<section class="powerby">
Built with <a href="https://gohugo.io/" target="_blank">Hugo</a> <br />
Theme <b>Stack</b> designed by <a href="https://jimmycai.com" target="_blank">Jimmy</a>
</section>
</footer>
+15
View File
@@ -0,0 +1,15 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/timeago.js/4.0.2/timeago.min.js"
integrity="sha512-SVDh1zH5N9ChofSlNAK43lcNS7lWze6DTVx1JCXH1Tmno+0/1jMpdbR8YDgDUfcUrPp1xyE53G42GFrcM0CMVg=="
crossorigin="anonymous"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-JavaScript-Templates/3.18.0/js/tmpl.min.js"
integrity="sha512-62X328c9VQQkWxrLMccNyRISbwvqQDjvF/HFuvHBMGtZJbNvTG30k1M2O+PYLyWUrcHFKIPvr2OkgmUmcaiccw=="
crossorigin="anonymous"></script>-->
<script src="https://cdn.jsdelivr.net/npm/node-vibrant@3.1.5/dist/vibrant.min.js"
integrity="sha256-5NovOZc4iwiAWTYIFiIM7DxKUXKWvpVEuMEPLzcm5/g=" crossorigin="anonymous"></script>
{{ $opts := dict "minify" hugo.IsProduction }}
{{ $script := resources.Get "ts/main.ts" | js.Build $opts }}
<script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script>
View File
+18
View File
@@ -0,0 +1,18 @@
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<meta name='description' content='{{ chomp (partial "data/description" . | plainify ) }}'>
<base href='{{ .Site.BaseURL }}'>
<title>{{ (trim (partial "data/title" .) "\n" ) | safeHTML }}</title>
<link rel='canonical' href='{{ .Permalink }}'>
{{ partial "head/style.html" . }}
{{ partial "head/script.html" . }}
{{ partial "head/opengraph.html" . }}
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
</head>
+51
View File
@@ -0,0 +1,51 @@
<meta property='og:title' content='{{ partial "data/title" . }}'>
<meta property='og:description' content='{{ chomp (partial "data/description" . | plainify ) }}'>
<meta property='og:url' content='{{ .Permalink }}'>
<meta property='og:site_name' content='{{ .Site.Title }}'>
<meta property='og:type' content='
{{- if .IsPage -}}
article
{{- else -}}
website
{{- end -}}
'>
{{ with .Site.Params.twitter }}
<meta name="twitter:site" content="{{ . }}">
{{ end }}
<meta name="twitter:title" content="{{ partial "data/title" . }}">
<meta name="twitter:description" content="{{ chomp (partial "data/description" . | plainify ) }}">
{{- with .Params.locale -}}
<meta property='og:locale' content='{{ . }}'>
{{- end -}}
{{- if .IsPage -}}
<meta property='article:section' content='{{ .Section | title }}' />
{{- range .Params.tags -}}
<meta property='article:tag' content='{{ . }}' />
{{- end -}}
{{- end -}}
{{- if .IsPage -}}
{{- if not .Date.IsZero -}}
<meta property='article:published_time' content='{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
{{- end -}}
{{- if not .Lastmod.IsZero -}}
<meta property='article:modified_time' content='{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
{{- end -}}
{{- else -}}
{{- if not .Site.LastChange.IsZero -}}
<meta property='og:updated_time' content='{{ .Site.LastChange.Format " 2006-01-02T15:04:05-07:00 " | safeHTML }}'/>
{{- end -}}
{{- end -}}
<meta name="twitter:card" content="summary_large_image">
{{- if .Params.image -}}
{{ $image := partial "helper/image" . }}
<meta property='og:image' content='{{ absURL $image.RelPermalink }}' />
<meta name="twitter:image" content='{{ absURL $image.RelPermalink }}' />
{{- else -}}
<meta property='og:image' content='{{ absURL .Site.Params.logo }}' />
{{- end -}}
View File
+5
View File
@@ -0,0 +1,5 @@
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap" rel="stylesheet">
{{ $sass := resources.Get "scss/style.scss" }}
{{ $style := $sass | resources.ToCSS | minify }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
+2
View File
@@ -0,0 +1,2 @@
{{- $image := .Resources.GetMatch (printf "%s" (.Params.image | safeURL)) -}}
{{ return $image }}
+26
View File
@@ -0,0 +1,26 @@
{{ if gt .Paginator.TotalPages 1 }}
<nav class='pagination'>
{{ $.Scratch.Set "hasPrevDots" false }}
{{ $.Scratch.Set "hasNextDots" false }}
{{ range .Paginator.Pagers }}
{{ if eq . $.Paginator }}
<span class='page-link current'>
{{- .PageNumber -}}
</span>
{{ else if or (or (eq . $.Paginator.First) (eq . $.Paginator.Prev)) (or (eq . $.Paginator.Next) (eq . $.Paginator.Last )) }}
<a class='page-link' href='{{ .URL }}'>
{{- .PageNumber -}}
</a>
{{ else }}
{{ if and (not ($.Scratch.Get "hasPrevDots")) (lt .PageNumber $.Paginator.PageNumber) }}
{{ $.Scratch.Set "hasPrevDots" true }}
<span class='page-link dots'>&hellip;</span>
{{ else if and (not ($.Scratch.Get "hasNextDots")) (gt .PageNumber $.Paginator.PageNumber) }}
{{ $.Scratch.Set "hasNextDots" true }}
<span class='page-link dots'>&hellip;</span>
{{ end }}
{{ end }}
{{ end }}
</nav>
{{ end }}
+33
View File
@@ -0,0 +1,33 @@
<aside class="sidebar left-sidebar sticky">
<button class="hamburger hamburger--spin" type="button" id="toggle-menu" aria-label="Toggle Menu">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
<header class="site-info">
<figure class="site-avatar">
{{ $avatar := resources.Get (.Site.Params.avatar) }}
{{ $avatarResized := $avatar.Resize "300x300" }}
<img src="{{ $avatarResized.RelPermalink }}" width="{{ $avatarResized.Width }}"
height="{{ $avatarResized.Height }}" class="site-logo" loading="lazy" alt="Avatar">
<span class="emoji">{{ .Site.Params.emoji }}</span>
</figure>
<h1 class="site-name"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
<h2 class="site-description">{{ .Site.Params.subtitle }}</h2>
</header>
<nav class="menu" id="main-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
<li {{ if $active }} class='current' {{ end }}>
<a href='{{ .URL }}'>
{{ (resources.Get (delimit (slice "icons/" .Pre ".svg") "")).Content | safeHTML }}
<span>{{- .Name -}}</span>
</a>
</li>
{{ end }}
</nav>
</aside>
+8
View File
@@ -0,0 +1,8 @@
{{ if .Site.Params.widgets.enabled }}
{{ $context := . }}
<aside class="sidebar right-sidebar sticky">
{{ range $widget := .Site.Params.widgets.enabled }}
{{ partial (printf "widget/%s" $widget) $context }}
{{ end }}
</aside>
{{ end }}
+19
View File
@@ -0,0 +1,19 @@
<section class="widget archive">
<div class="widget-icon">
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
</div>
<h1 class="widget-title">Archive</h1>
{{ $v1 := where .Site.RegularPages "Section" "post" }}
{{ $v2 := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := $v1 | intersect $v2 }}
{{ range $filtered.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }}
<div class="archive-year">
<a href="{{ $.Site.BaseURL }}/archive#{{ $id }}">
<span class="year">{{ .Key }}</span>
<span class="count">{{ len .Pages }}</span>
</a>
</div>
{{ end }}
</section>
+17
View File
@@ -0,0 +1,17 @@
{{ $tags := .Site.Taxonomies.tags.ByCount }}
{{ $v2 := where $tags "Term" "not in" (slice "hugo" "tag" "rss") }}
<section class="widget tagCloud">
<div class="widget-icon">
{{ (resources.Get "icons/tag.svg").Content | safeHTML }}
</div>
<h1 class="widget-title">Tags</h1>
<div class="tagCloud-tags">
{{ range first .Site.Params.widgets.tagCloud.limit $v2 }}
<a href="{{ $.Site.BaseURL }}tags/{{ .Term | urlize }}/" class="font_size_{{ .Count }}">
{{ .Term | humanize }}
</a>
{{ end }}
</div>
</section>
+9
View File
@@ -0,0 +1,9 @@
{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
{{- if not $pc.Disable -}}
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
{{- $id := .Get "id" | default (.Get 0) -}}
{{- $class := .Get "class" | default (.Get 1) }}
<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}>
<iframe loading="lazy" src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}allowfullscreen title="YouTube Video"></iframe>
</div>
{{ end -}}