Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <github@jimmycai.com>2022-03-04 01:11:19 +0300
committerGitHub <noreply@github.com>2022-03-04 01:11:19 +0300
commit04cdbcfedfe3f200013e05aecbb96dc3313424b3 (patch)
tree8aa0068d7e199d83855329d5e7f7da0b8800a1b0 /layouts
parentadf27aebf276f33301d2b8add199be1ceeafc30c (diff)
refactor: Use flexbox gap (#520)
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/archives.html24
-rw-r--r--layouts/_default/list.html94
-rw-r--r--layouts/page/search.html6
-rw-r--r--layouts/partials/article/components/related-contents.html20
-rw-r--r--layouts/partials/sidebar/left.html8
5 files changed, 81 insertions, 71 deletions
diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html
index 321aa6d..5d5243c 100644
--- a/layouts/_default/archives.html
+++ b/layouts/_default/archives.html
@@ -1,17 +1,19 @@
{{ define "body-class" }}template-archives{{ end }}
{{ define "main" }}
- {{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}}
- {{- $terms := $taxonomy.Pages -}}
- {{ if $terms }}
- <h2 class="section-title">{{ $taxonomy.Title }}</h2>
- <div class="subsection-list">
- <div class="article-list--tile">
- {{ range $terms }}
- {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }}
- {{ end }}
+ <header>
+ {{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}}
+ {{- $terms := $taxonomy.Pages -}}
+ {{ if $terms }}
+ <h2 class="section-title">{{ $taxonomy.Title }}</h2>
+ <div class="subsection-list">
+ <div class="article-list--tile">
+ {{ range $terms }}
+ {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }}
+ {{ end }}
+ </div>
</div>
- </div>
- {{ end }}
+ {{ end }}
+ </header>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 49a5c12..9bc618d 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,46 +1,48 @@
{{ define "main" }}
- <h3 class="section-title">
- {{ if eq .Parent (.GetPage "/") }}
- {{ T "list.section" }}
- {{ else }}
- {{ .Parent.Title }}
- {{ end }}
- </h3>
-
- <div class="section-card">
- <div class="section-details">
- <h3 class="section-count">{{ T "list.page" (len .Pages) }}</h3>
- <h1 class="section-term">{{ .Title }}</h1>
- {{ with .Params.description }}
- <h2 class="section-description">{{ . }}</h2>
+ <header>
+ <h3 class="section-title">
+ {{ if eq .Parent (.GetPage "/") }}
+ {{ T "list.section" }}
+ {{ else }}
+ {{ .Parent.Title }}
{{ end }}
- </div>
+ </h3>
- {{- $image := partialCached "helper/image" (dict "Context" . "Type" "section") .RelPermalink "section" -}}
- {{ if $image.exists }}
- <div class="section-image">
- {{ if $image.resource }}
- {{- $Permalink := $image.resource.RelPermalink -}}
- {{- $Width := $image.resource.Width -}}
- {{- $Height := $image.resource.Height -}}
-
- {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
- {{- $thumbnail := $image.resource.Fill "120x120" -}}
- {{- $Permalink = $thumbnail.RelPermalink -}}
- {{- $Width = $thumbnail.Width -}}
- {{- $Height = $thumbnail.Height -}}
- {{- end -}}
-
- <img src="{{ $Permalink }}"
- width="{{ $Width }}"
- height="{{ $Height }}"
- loading="lazy">
- {{ else }}
- <img src="{{ $image.permalink }}" loading="lazy" />
+ <div class="section-card">
+ <div class="section-details">
+ <h3 class="section-count">{{ T "list.page" (len .Pages) }}</h3>
+ <h1 class="section-term">{{ .Title }}</h1>
+ {{ with .Params.description }}
+ <h2 class="section-description">{{ . }}</h2>
{{ end }}
</div>
- {{ end }}
- </div>
+
+ {{- $image := partialCached "helper/image" (dict "Context" . "Type" "section") .RelPermalink "section" -}}
+ {{ if $image.exists }}
+ <div class="section-image">
+ {{ if $image.resource }}
+ {{- $Permalink := $image.resource.RelPermalink -}}
+ {{- $Width := $image.resource.Width -}}
+ {{- $Height := $image.resource.Height -}}
+
+ {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
+ {{- $thumbnail := $image.resource.Fill "120x120" -}}
+ {{- $Permalink = $thumbnail.RelPermalink -}}
+ {{- $Width = $thumbnail.Width -}}
+ {{- $Height = $thumbnail.Height -}}
+ {{- end -}}
+
+ <img src="{{ $Permalink }}"
+ width="{{ $Width }}"
+ height="{{ $Height }}"
+ loading="lazy">
+ {{ else }}
+ <img src="{{ $image.permalink }}" loading="lazy" />
+ {{ end }}
+ </div>
+ {{ end }}
+ </div>
+ </header>
{{- $subsections := .Sections -}}
{{- $pages := .Pages | complement $subsections -}}
@@ -53,14 +55,16 @@
{{- end -}}
{{- with $subsections -}}
- <h2 class="section-title">{{ T "list.subsection" (len $subsections) }}</h2>
- <div class="subsection-list">
- <div class="article-list--tile">
- {{ range . }}
- {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "section") }}
- {{ end }}
+ <aside>
+ <h2 class="section-title">{{ T "list.subsection" (len $subsections) }}</h2>
+ <div class="subsection-list">
+ <div class="article-list--tile">
+ {{ range . }}
+ {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "section") }}
+ {{ end }}
+ </div>
</div>
- </div>
+ </aside>
{{- end -}}
{{/* List only pages that are not a subsection */}}
diff --git a/layouts/page/search.html b/layouts/page/search.html
index 935b384..7c424a6 100644
--- a/layouts/page/search.html
+++ b/layouts/page/search.html
@@ -16,8 +16,10 @@
</button>
</form>
-<h3 class="search-result--title section-title"></h3>
-<div class="search-result--list article-list--compact"></div>
+<div class="search-result">
+ <h3 class="search-result--title section-title"></h3>
+ <div class="search-result--list article-list--compact"></div>
+</div>
<script>
window.searchResultTitleTemplate = "{{ T `search.resultTitle` }}"
diff --git a/layouts/partials/article/components/related-contents.html b/layouts/partials/article/components/related-contents.html
index 810b8e9..29cfff6 100644
--- a/layouts/partials/article/components/related-contents.html
+++ b/layouts/partials/article/components/related-contents.html
@@ -1,13 +1,13 @@
+{{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }}
+{{ with $related }}
<aside class="related-contents--wrapper">
- {{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }}
- {{ with $related }}
- <h2 class="section-title">{{ T "article.relatedContents" }}</h2>
- <div class="related-contents">
- <div class="flex article-list--tile">
- {{ range . }}
- {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "articleList") }}
- {{ end }}
- </div>
+ <h2 class="section-title">{{ T "article.relatedContents" }}</h2>
+ <div class="related-contents">
+ <div class="flex article-list--tile">
+ {{ range . }}
+ {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "articleList") }}
+ {{ end }}
</div>
- {{ end }}
+ </div>
</aside>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html
index 35d1c11..44d5307 100644
--- a/layouts/partials/sidebar/left.html
+++ b/layouts/partials/sidebar/left.html
@@ -5,7 +5,7 @@
</span>
</button>
- <header class="site-info">
+ <header>
{{ with .Site.Params.sidebar.avatar }}
{{ if (default true .enabled) }}
<figure class="site-avatar">
@@ -31,8 +31,10 @@
{{ end }}
{{ end }}
- <h1 class="site-name"><a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a></h1>
- <h2 class="site-description">{{ .Site.Params.sidebar.subtitle }}</h2>
+ <div class="site-meta">
+ <h1 class="site-name"><a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a></h1>
+ <h2 class="site-description">{{ .Site.Params.sidebar.subtitle }}</h2>
+ </div>
{{- with .Site.Menus.social -}}
<ol class="social-menu">