@ -1,13 +1,32 @@
|
||||
{{ define "main" }}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-10 col-xl-8">
|
||||
{{ range .Paginator.Pages }}
|
||||
<article>
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
|
||||
{{ .Description }}
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
<div class="col-md-12 col-lg-9">
|
||||
<h1 class="text-center">{{ .Title }}</h1>
|
||||
{{ with .Content -}}<div class="text-center">{{ . }}</div>{{ end -}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-1 row-cols-lg-2 g-lg-5">
|
||||
{{ $paginator := .Paginate (.Data.Pages) -}}
|
||||
{{ range $paginator.Pages -}}
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
{{- .Scratch.Set "fillImage" "1270x620 Center" -}}
|
||||
{{ partial "content/card-image.html" . }}
|
||||
<div class="card-body">
|
||||
<article>
|
||||
<h2 class="h3"><a class="stretched-link text-body" href="{{ .RelPermalink }}">{{ .Params.title }}</a></h2>
|
||||
<p>{{ .Params.excerpt | safeHTML }}</p>
|
||||
{{ partial "main/blog-meta.html" . -}}
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end -}}
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-9">
|
||||
{{ $.Scratch.Set "paginator" true }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
20
layouts/_default/terms.html
Normal file
20
layouts/_default/terms.html
Normal file
@ -0,0 +1,20 @@
|
||||
{{ define "main" }}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-10 col-xl-8">
|
||||
<h1 class="text-center">{{ .Title }}</h1>
|
||||
<div class="text-center">{{ .Content }}</div>
|
||||
<div class="card-list">
|
||||
{{ range .Paginator.Pages }}
|
||||
<div class="card card-terms my-3">
|
||||
<div class="card-body">
|
||||
<article>
|
||||
<a class="stretched-link" href="{{ .RelPermalink }}">{{ .Params.title | title }} →</a>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
@ -1,24 +0,0 @@
|
||||
{{ define "main" }}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-10 col-xl-8">
|
||||
<article>
|
||||
<h1 class="text-center">{{ .Title }}</h1>
|
||||
<div class="text-center">{{ .Content }}</div>
|
||||
<div class="card-list">
|
||||
{{ $paginator := .Paginate (.Data.Pages) -}}
|
||||
{{ range $paginator.Pages -}}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h2 class="h3"><a class="stretched-link text-body" href="{{ .RelPermalink }}">{{ .Params.title }}</a></h2>
|
||||
<p>{{ .Params.lead | safeHTML }}</p>
|
||||
{{ partial "main/blog-meta.html" . -}}
|
||||
</div>
|
||||
</div>
|
||||
{{ end -}}
|
||||
{{ $.Scratch.Set "paginator" true }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
@ -1,14 +1,59 @@
|
||||
{{ define "main" }}
|
||||
<article>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-10 col-xl-8">
|
||||
<article>
|
||||
<div class="blog-header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ partial "main/blog-meta.html" . }}
|
||||
</div>
|
||||
<p class="lead">{{ .Params.lead | safeHTML }}</p>
|
||||
{{ .Content }}
|
||||
</article>
|
||||
<div class="col-md-12 col-lg-10">
|
||||
<div class="blog-header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ partial "main/blog-meta.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-13">
|
||||
<div class="mt-n4">
|
||||
{{- .Scratch.Set "fillImage" "1270x715 Center" -}}
|
||||
{{ partial "content/figure.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-9">
|
||||
{{ .Content }}
|
||||
{{ if .Params.tags -}}
|
||||
<div class="mt-4">
|
||||
{{ range $index, $tag := .Params.tags -}}
|
||||
<a class="btn btn-light" href="{{ "/tags/" | absURL }}{{ . | urlize }}/" role="button">{{ . }}</a>
|
||||
{{ end -}}
|
||||
</div>
|
||||
{{ end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</article>
|
||||
|
||||
{{ $related := .Site.RegularPages.Related . | first 3 -}}
|
||||
{{ with $related -}}
|
||||
<div class="related-posts">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col">
|
||||
<h2 class="section-title">Related posts</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-lg-5">
|
||||
{{ range . -}}
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
{{- .Scratch.Set "fillImageCard" "1270x620 Center" -}}
|
||||
{{ partial "content/card-image.html" . }}
|
||||
<div class="card-body">
|
||||
<article>
|
||||
<h2 class="h3"><a class="stretched-link text-body" href="{{ .RelPermalink }}">{{ .Params.title }}</a></h2>
|
||||
<p>{{ .Params.excerpt | safeHTML }}</p>
|
||||
{{ partial "main/blog-meta.html" . -}}
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{ end -}}
|
||||
|
||||
{{ end }}
|
||||
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
{{ define "main" }}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-10 col-xl-8">
|
||||
<article>
|
||||
<h1 class="text-center">{{ .Title }}</h1>
|
||||
<div class="text-center">{{ .Content }}</div>
|
||||
<div class="card-list">
|
||||
{{ range .Data.Pages -}}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h2 class="h3"><a class="stretched-link text-body" href="{{ .RelPermalink }}">{{ .Params.title }}</a></h2>
|
||||
{{ if eq .Section "blog" -}}
|
||||
<p>{{ .Params.lead | safeHTML }}</p>
|
||||
{{ partial "main/blog-meta.html" . -}}
|
||||
{{ end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{ end -}}
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
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 -}}
|
@ -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">
|
||||
|
@ -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>
|
Reference in New Issue
Block a user