Merge branch 'master' into scroll-spy
This commit is contained in:
22
layouts/partials/content/card-image.html
Normal file
22
layouts/partials/content/card-image.html
Normal file
@ -0,0 +1,22 @@
|
||||
{{ $fillImage := .Scratch.Get "fillImageCard" }}
|
||||
{{ if not $fillImage -}}
|
||||
{{ $fillImage = site.Params.fillImage }}
|
||||
{{ end -}}
|
||||
|
||||
{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }}
|
||||
{{ if not $image -}}
|
||||
{{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }}
|
||||
{{ end -}}
|
||||
|
||||
{{ $webp := printf "%s%s" $fillImage " webp" }}
|
||||
{{ $image = $image.Resize $webp}}
|
||||
|
||||
{{ $lqip := $image.Resize site.Params.lqipWidth -}}
|
||||
|
||||
<img
|
||||
class="card-img-top img-fluid lazyload blur-up"
|
||||
src="{{ $lqip.Permalink }}"
|
||||
data-src="{{ $image.Permalink }}"
|
||||
width="{{ $image.Width }}"
|
||||
height="{{ $image.Height }}"
|
||||
alt="{{ .Title }}">
|
37
layouts/partials/content/figure.html
Normal file
37
layouts/partials/content/figure.html
Normal file
@ -0,0 +1,37 @@
|
||||
{{ $fillImage := .Scratch.Get "fillImage" }}
|
||||
{{ if not $fillImage -}}
|
||||
{{ $fillImage = site.Params.fillImage }}
|
||||
{{ end -}}
|
||||
|
||||
{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }}
|
||||
{{ if not $image -}}
|
||||
{{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }}
|
||||
{{ end -}}
|
||||
|
||||
{{ $image = $image.Fill $fillImage }}
|
||||
{{ $lqip := $image.Resize site.Params.lqipWidth -}}
|
||||
|
||||
{{ $imgSrc := "" -}}
|
||||
{{ $imgSrcSet := slice -}}
|
||||
|
||||
{{ $widths := site.Params.landscapePhotoWidths -}}
|
||||
{{ if gt $image.Height $image.Width -}}
|
||||
{{ $widths = site.Params.portraitPhotoWidths -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ range $widths -}}
|
||||
{{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}}
|
||||
{{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}}
|
||||
{{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}}
|
||||
{{ end -}}
|
||||
{{ $imgSrcSet = (delimit $imgSrcSet ",") -}}
|
||||
|
||||
{{ if gt $image.Width site.Params.smallLimit -}}
|
||||
<figure class="figure">
|
||||
<img class="figure-img img-fluid lazyload blur-up" data-sizes="auto" src="{{ $lqip.Permalink }}" data-srcset="{{ $imgSrcSet }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ .Title }}">
|
||||
<noscript><img class="figure-img img-fluid" sizes="100vw" srcset="{{ $imgSrcSet }}" src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ .Title }}"></noscript>
|
||||
<!-- {{ with .Title }}<figcaption class="figure-caption">{{ . | safeHTML }}</figcaption>{{ end -}} -->
|
||||
</figure>
|
||||
{{ else -}}
|
||||
<img class="img-fluid lazyload blur-up" src="{{ $lqip.Permalink }}" data-src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ .Title }}">
|
||||
{{ end -}}
|
32
layouts/partials/content/image.html
Normal file
32
layouts/partials/content/image.html
Normal file
@ -0,0 +1,32 @@
|
||||
{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }}
|
||||
{{ if not $image -}}
|
||||
{{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }}
|
||||
{{ end -}}
|
||||
|
||||
{{ $image = $image.Fill site.Params.fillImage }}
|
||||
{{ $lqip := $image.Resize site.Params.lqipWidth -}}
|
||||
|
||||
{{ $imgSrc := "" -}}
|
||||
{{ $imgSrcSet := slice -}}
|
||||
|
||||
{{ $widths := site.Params.landscapePhotoWidths -}}
|
||||
{{ if gt $image.Height $image.Width -}}
|
||||
{{ $widths = site.Params.portraitPhotoWidths -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ range $widths -}}
|
||||
{{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}}
|
||||
{{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}}
|
||||
{{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}}
|
||||
{{ end -}}
|
||||
{{ $imgSrcSet = (delimit $imgSrcSet ",") -}}
|
||||
|
||||
{{ if gt $image.Width site.Params.smallLimit -}}
|
||||
<figure class="figure">
|
||||
<img class="figure-img img-fluid lazyload blur-up" data-sizes="auto" src="{{ $lqip.Permalink }}" data-srcset="{{ $imgSrcSet }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ .Title }}">
|
||||
<noscript><img class="figure-img img-fluid" sizes="100vw" srcset="{{ $imgSrcSet }}" src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ .Title }}"></noscript>
|
||||
<!-- {{ with .Title }}<figcaption class="figure-caption">{{ . | safeHTML }}</figcaption>{{ end -}} -->
|
||||
</figure>
|
||||
{{ else -}}
|
||||
<img class="img-fluid lazyload blur-up" src="{{ $lqip.Permalink }}" data-src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ .Title }}">
|
||||
{{ end -}}
|
@ -34,9 +34,14 @@
|
||||
{{ $slice = $slice | append $instantPage -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if .Site.Params.options.flexSearch -}}
|
||||
{{ $showFlexSearch := .Site.Params.options.flexSearch }}
|
||||
|
||||
{{ if $showFlexSearch -}}
|
||||
{{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.bundle.js" -}}
|
||||
{{ $slice = $slice | append $flexSearch -}}
|
||||
{{ if and (isset .Site.Params.options "searchsectionsshow") (not (eq .Site.Params.options.searchSectionsShow "ALL")) -}}
|
||||
{{ $showFlexSearch = or (eq (len .Site.Params.options.searchSectionsShow) 0) (in .Site.Params.options.searchSectionsShow .Section) (and .IsHome (in .Site.Params.options.searchSectionsShow "HomePage")) -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if .Site.Params.options.darkMode -}}
|
||||
@ -60,6 +65,12 @@
|
||||
{{ $scrollLock := resources.Get "js/scroll-lock.js" | js.Build -}}
|
||||
{{ $slice = $slice | append $scrollLock -}}
|
||||
|
||||
{{ if .Site.Params.options.toTopButton -}}
|
||||
{{ $toTopButton := resources.Get "js/to-top.js" -}}
|
||||
{{ $toTopButton := $toTopButton | js.Build -}}
|
||||
{{ $slice = $slice | append $toTopButton -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ $js := $slice | resources.Concat "main.js" -}}
|
||||
|
||||
{{ if eq (hugo.Environment) "development" -}}
|
||||
@ -77,7 +88,7 @@
|
||||
{{ with .Params.mermaid -}}
|
||||
<script src="{{ $mermaid.RelPermalink }}" defer></script>
|
||||
{{ end -}}
|
||||
{{ if .Site.Params.options.flexSearch -}}
|
||||
{{ if $showFlexSearch -}}
|
||||
<script src="{{ $index.RelPermalink }}" defer></script>
|
||||
{{ end -}}
|
||||
{{ else -}}
|
||||
@ -102,7 +113,7 @@
|
||||
{{ with .Params.mermaid -}}
|
||||
<script src="{{ $mermaid.RelPermalink }}" integrity="{{ $mermaid.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
||||
{{ end -}}
|
||||
{{ if .Site.Params.options.flexSearch -}}
|
||||
{{ if $showFlexSearch -}}
|
||||
<script src="{{ $index.Permalink }}" integrity="{{ $index.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
@ -53,7 +53,7 @@
|
||||
{{- $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) -}}
|
||||
{{- $active = or $active (eq .Name $current.Title) -}}
|
||||
{{- $active = or $active (and (eq .Name ($section | humanize)) (eq $current.Section $section)) -}}
|
||||
{{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "contributors")) -}}
|
||||
{{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "contributors" "categories" "tags")) -}}
|
||||
{{ if .HasChildren }}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle ps-0 py-1" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
@ -77,7 +77,14 @@
|
||||
{{ end -}}
|
||||
</ul>
|
||||
|
||||
{{ if .Site.Params.options.flexSearch -}}
|
||||
{{- $showFlexSearch := .Site.Params.options.flexSearch }}
|
||||
{{- if $showFlexSearch }}
|
||||
{{- if and (isset .Site.Params.options "searchsectionsshow") (not (eq .Site.Params.options.searchSectionsShow "ALL")) }}
|
||||
{{- $showFlexSearch = or (eq (len .Site.Params.options.searchSectionsShow) 0) (in .Site.Params.options.searchSectionsShow .Section) (and .IsHome (in .Site.Params.options.searchSectionsShow "HomePage")) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ if $showFlexSearch -}}
|
||||
<hr class="text-black-50 my-4 d-lg-none">
|
||||
<form class="doks-search position-relative flex-grow-1 ms-lg-auto me-lg-2">
|
||||
<input id="search" class="form-control is-search" type="search" placeholder="Search docs..." aria-label="Search docs..." autocomplete="off">
|
||||
|
@ -1,2 +1,2 @@
|
||||
{{ $last := sub (len .Params.contributors) 1 }}
|
||||
<p><small>Posted {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }}{{ if eq $index $last }} and {{ else }}, {{ end }}{{ end }}<a class="stretched-link position-relative" href="{{ "/contributors/" | relURL }}{{ . | urlize }}/">{{ . }}</a>{{ end -}}{{ end -}} ‐ <strong>{{ .ReadingTime -}} min read</strong></small><p>
|
||||
<p><small>Posted{{ if .Params.categories -}} in {{ range $index, $category := .Params.categories -}}{{ if gt $index 0 -}}, {{ end -}}<a class="stretched-link position-relative link-muted" href="{{ "/categories/" | absURL }}{{ . | urlize }}/">{{ . }}</a>{{ end -}}{{ end -}} on {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }}{{ if eq $index $last }} and {{ else }}, {{ end }}{{ end }}<a class="stretched-link position-relative" href="{{ "/contributors/" | relURL }}{{ . | urlize }}/">{{ . }}</a>{{ end -}}{{ end -}} ‐ <strong>{{ .ReadingTime -}} min read</strong></small><p>
|
@ -3,7 +3,7 @@
|
||||
{{ $currentPage := . -}}
|
||||
{{ $section := $currentPage.Section -}}
|
||||
{{ range (where .Site.Sections "Section" "in" $section) }}
|
||||
{{ range .Sections.ByWeight.Reverse }}
|
||||
{{ range .Sections }}
|
||||
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||
<li class="mb-1">
|
||||
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ md5 .Title }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
|
||||
@ -54,4 +54,4 @@
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</ul>
|
||||
|
@ -2,7 +2,7 @@
|
||||
{{ $currentPage := . -}}
|
||||
{{ $section := $currentPage.Section -}}
|
||||
{{ range (where .Site.Sections "Section" "in" $section) }}
|
||||
{{ range .Sections.ByWeight.Reverse }}
|
||||
{{ range .Sections }}
|
||||
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
|
||||
<h3 class="h6 text-uppercase mb-2">{{ .Title }}</h3>
|
||||
<ul class="list-unstyled">
|
||||
|
Reference in New Issue
Block a user