Compare commits
4 Commits
9905066046
...
d9a3c4b4a1
Author | SHA1 | Date | |
---|---|---|---|
d9a3c4b4a1
|
|||
8834c6dc21
|
|||
6353c33ae2
|
|||
08b8041c43
|
@@ -10,7 +10,7 @@ img {
|
||||
|
||||
figcaption {
|
||||
text-align: center;
|
||||
padding-top: 0.5rem;
|
||||
padding-top: 1rem;
|
||||
color: color-mix(in srgb, var(--text) 50%, var(--background));
|
||||
}
|
||||
}
|
||||
|
@@ -2,11 +2,11 @@
|
||||
.post {
|
||||
display: block;
|
||||
|
||||
>a {
|
||||
> a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
>a:hover {
|
||||
> a:hover {
|
||||
color: var(--text-800);
|
||||
}
|
||||
|
||||
|
@@ -18,13 +18,13 @@
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 5rem;
|
||||
height: auto;
|
||||
padding: 1rem 2rem;
|
||||
text-align: center;
|
||||
line-height: 1.5rem;
|
||||
|
||||
.meta {
|
||||
font-size: 0.7rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
|
@@ -1,7 +1,3 @@
|
||||
{{ partial "components/image/index.html" (dict "page" .Page "image" (dict
|
||||
"src" .Destination
|
||||
"caption" .Text
|
||||
"alt" .Title
|
||||
))
|
||||
}}
|
||||
{{ $data := partial "components/image/process.html" (dict "page" .Page "src" .Destination) }}
|
||||
{{ partial "components/image/index.html" (merge $data (dict "caption" .Text "title" .Title)) }}
|
||||
{{- /* chomp trailing newline */ -}}
|
||||
|
25
layouts/_shortcodes/exif-image.html
Normal file
25
layouts/_shortcodes/exif-image.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{{ $src := "" }}
|
||||
{{ if .IsNamedParams }}
|
||||
{{ $src = .Get "src" }}
|
||||
{{ else }}
|
||||
{{ $src = .Get 0 }}
|
||||
{{ end }}
|
||||
|
||||
{{ $title := "" }}
|
||||
{{ if .IsNamedParams }}
|
||||
{{ $title = .Get "title" }}
|
||||
{{ else }}
|
||||
{{ $title = .Get 1 }}
|
||||
{{ end }}
|
||||
|
||||
{{ $alt := "" }}
|
||||
{{ if .IsNamedParams }}
|
||||
{{ $alt = .Get "alt" }}
|
||||
{{ else }}
|
||||
{{ $alt = .Get 1 }}
|
||||
{{ end }}
|
||||
|
||||
{{ $data := partial "components/image/process.html" (dict "page" .Page "src" $src) }}
|
||||
{{ $caption := partial "components/image/exif.html" $data.original }}
|
||||
{{ partial "components/image/index.html" (merge $data (dict "caption" $caption "title" $title "alt" $alt)) }}
|
||||
{{- /* chomp trailing newline */ -}}
|
@@ -1,5 +1,17 @@
|
||||
<section class="hero">
|
||||
<h1 class="title">{{ .Title }}</h1>
|
||||
{{ partial "components/meta/index.html" . }}
|
||||
{{ partial "components/image/index.html" (dict "page" .Page "image" .Params.hero) }}
|
||||
|
||||
{{ $hero := partial "components/hero/process.html" .Params.hero }}
|
||||
{{ if $hero.src }}
|
||||
{{ $data := partial "components/image/process.html" (dict "page" .Page "src" $hero.src) }}
|
||||
|
||||
{{ $final := merge $data $hero }}
|
||||
{{ if $hero.exif }}
|
||||
{{ $caption := partial "components/image/exif.html" $data.original }}
|
||||
{{ $final = merge $final (dict "caption" $caption) }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/image/index.html" $final }}
|
||||
{{ end }}
|
||||
</section>
|
||||
|
17
layouts/partials/components/hero/process.html
Normal file
17
layouts/partials/components/hero/process.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{- $src := "" -}}
|
||||
{{- $caption := "" -}}
|
||||
{{- $title := "" -}}
|
||||
{{- $alt := "" -}}
|
||||
{{- $exif := false -}}
|
||||
|
||||
{{- if reflect.IsMap . -}}
|
||||
{{- $src = .src -}}
|
||||
{{- $caption = .caption -}}
|
||||
{{- $title = .title -}}
|
||||
{{- $alt = .alt -}}
|
||||
{{- $exif = .exif | default false -}}
|
||||
{{- else -}}
|
||||
{{- $src = . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return dict "src" $src "caption" $caption "title" $title "alt" $alt "exif" $exif -}}
|
22
layouts/partials/components/image/exif.html
Normal file
22
layouts/partials/components/image/exif.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ $exif := .Exif.Tags }}
|
||||
|
||||
{{ $make := $exif.Make }}
|
||||
{{ $model := $exif.Model }}
|
||||
|
||||
{{ $lensMake := $exif.LensMake }}
|
||||
{{ $lensModel := $exif.LensModel }}
|
||||
|
||||
{{ $lens := "" }}
|
||||
{{ if ne $make $lensMake }}
|
||||
{{ $lens = printf "%s %s" $lensMake $lensModel }}
|
||||
{{ else }}
|
||||
{{ $lens = $lensModel }}
|
||||
{{ end }}
|
||||
|
||||
{{ $focal := printf "%.1f" (float $exif.FocalLength) }}
|
||||
{{ $focal35 := printf "%.1f" (float $exif.FocalLengthIn35mmFormat) }}
|
||||
{{ $shutter := printf "%d" $exif.ExposureTime }}
|
||||
{{ $aperture := printf "%d" $exif.FNumber }}
|
||||
{{ $iso := printf "%d" $exif.ISO }}
|
||||
|
||||
{{ return printf "%s %s, %s @ %s mm (%s mm), %s s, f/%s, ISO %s" $make $model $lens $focal $focal35 $shutter $aperture $iso }}
|
@@ -1,59 +1,26 @@
|
||||
{{- $page := .page -}}
|
||||
{{- $image := .image -}}
|
||||
|
||||
{{- $src := $image -}}
|
||||
{{- $caption := "" -}}
|
||||
{{- $title := "" -}}
|
||||
{{- $alt := "" -}}
|
||||
|
||||
{{- if reflect.IsMap $image -}}
|
||||
{{- $src = $image.src | default "" -}}
|
||||
{{- $caption = $image.caption | default "" -}}
|
||||
{{- $title = $image.title | default $caption | default "" | plainify -}}
|
||||
{{- $alt = $image.alt | default $title | default "" | plainify -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $src -}}
|
||||
{{- $isRemote := strings.HasPrefix $src "http" -}}
|
||||
|
||||
{{- if $isRemote -}}
|
||||
{{- $remote := resources.GetRemote $src -}}
|
||||
{{- $image = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}}
|
||||
{{- else -}}
|
||||
{{- $image = ($page.Resources.Get $src) | default (resources.Get $src) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $image -}}
|
||||
{{ $full := . | images.Filter (images.Process "webp q90") }}
|
||||
|
||||
{{ $thumb := . }}
|
||||
{{- if gt .Width 2000 -}}
|
||||
{{- $thumb = . | images.Filter (images.Process "resize 2000x webp q75") -}}
|
||||
{{- else -}}
|
||||
{{- $thumb = . | images.Filter (images.Process "webp q75") -}}
|
||||
{{- end -}}
|
||||
{{- $caption := .caption | default "" -}}
|
||||
{{- $title := .title | default $caption | plainify -}}
|
||||
{{- $alt := .alt | default $title | plainify -}}
|
||||
|
||||
|
||||
<figure class="captioned-image lightbox">
|
||||
<a
|
||||
href="{{- $full.RelPermalink -}}"
|
||||
data-pswp-src="{{- $full.RelPermalink -}}"
|
||||
data-pswp-width="{{- $full.Width -}}"
|
||||
data-pswp-height="{{- $full.Height -}}"
|
||||
class="pswp-image"
|
||||
>
|
||||
<img
|
||||
src="{{- $thumb.RelPermalink -}}"
|
||||
width="{{- $thumb.Width -}}"
|
||||
height="{{- $thumb.Height -}}"
|
||||
loading="lazy"
|
||||
{{ with $title }}title="{{- . -}}"{{ end }}
|
||||
{{ with $alt }}alt="{{- . -}}"{{ end }}
|
||||
/>
|
||||
</a>
|
||||
{{ with $caption }}
|
||||
<figcaption>{{ . | safeHTML }}</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{- end -}}
|
||||
<figure class="captioned-image lightbox">
|
||||
<a
|
||||
href="{{- .full.RelPermalink -}}"
|
||||
data-pswp-src="{{- .full.RelPermalink -}}"
|
||||
data-pswp-width="{{- .full.Width -}}"
|
||||
data-pswp-height="{{- .full.Height -}}"
|
||||
class="pswp-image"
|
||||
>
|
||||
<img
|
||||
src="{{- .thumb.RelPermalink -}}"
|
||||
width="{{- .thumb.Width -}}"
|
||||
height="{{- .thumb.Height -}}"
|
||||
loading="lazy"
|
||||
{{ with $title }}title="{{- . -}}"{{ end }}
|
||||
{{ with $alt }}alt="{{- . -}}"{{ end }}
|
||||
/>
|
||||
</a>
|
||||
{{ with $caption }}
|
||||
<figcaption>{{ . | safeHTML }}</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
|
23
layouts/partials/components/image/process.html
Normal file
23
layouts/partials/components/image/process.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{{- $page := .page -}}
|
||||
{{- $src := .src -}}
|
||||
|
||||
{{- $original := "" -}}
|
||||
|
||||
{{- $isRemote := strings.HasPrefix $src "http" -}}
|
||||
{{- if $isRemote -}}
|
||||
{{- $remote := resources.GetRemote $src -}}
|
||||
{{- $original = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}}
|
||||
{{- else -}}
|
||||
{{- $original = ($page.Resources.Get $src) | default (resources.Get $src) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $full := $original | images.Filter (images.Process "webp q90") -}}
|
||||
|
||||
{{- $thumb := "" -}}
|
||||
{{- if gt $original.Width 2000 -}}
|
||||
{{- $thumb = $original | images.Filter (images.Process "resize 2000x webp q75") -}}
|
||||
{{- else -}}
|
||||
{{- $thumb = $original | images.Filter (images.Process "webp q75") -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return dict "original" $original "full" $full "thumb" $thumb -}}
|
@@ -1,14 +1,18 @@
|
||||
<div class="meta">
|
||||
<span class="date">{{ .Date | time.Format ":date_medium" }}</span>
|
||||
·
|
||||
|
||||
{{ if eq .Kind "page" }}
|
||||
{{ range .Params.tags }}
|
||||
<a href="/tags/{{ . | urlize }}" class="tag">{{ . }}</a>
|
||||
·
|
||||
<a href="/tags/{{ . | urlize }}" class="tag">{{ . }}</a>
|
||||
{{ end }}
|
||||
|
||||
{{ if ge .ReadingTime 1 }}
|
||||
·
|
||||
<span class="duration">
|
||||
{{ printf "%d min. read" .ReadingTime }}
|
||||
</span>
|
||||
{{ end }}
|
||||
<span class="duration">
|
||||
{{ printf "%d min. read" .ReadingTime }}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{ $count := len .Pages }}
|
||||
<span class="duration">
|
||||
|
@@ -2,34 +2,36 @@
|
||||
<div class="grid-sizer"></div>
|
||||
{{ range sort .Pages "Date" "desc" }}
|
||||
{{ if not .Params.private }}
|
||||
{{ $page := . }}
|
||||
{{ $imageData := partial "components/image/reflect.html" .Params.hero }}
|
||||
{{ with $imageData.image }}
|
||||
{{ $hero := partial "components/hero/process.html" .Params.hero }}
|
||||
{{ if $hero.src }}
|
||||
{{ $data := partial "components/image/process.html" (dict "page" . "src" $hero.src) }}
|
||||
|
||||
{{- $caption := .Title -}}
|
||||
{{- $title := $hero.title | default $caption | plainify -}}
|
||||
{{- $alt := $hero.alt | default $title | plainify -}}
|
||||
|
||||
|
||||
<div class="image grid-item">
|
||||
<a
|
||||
href="{{- $page.RelPermalink -}}"
|
||||
data-pswp-src="{{- .RelPermalink -}}"
|
||||
data-pswp-width="{{- .Width -}}"
|
||||
data-pswp-height="{{- .Height -}}"
|
||||
href="{{- .RelPermalink -}}"
|
||||
data-pswp-src="{{- $data.full.RelPermalink -}}"
|
||||
data-pswp-width="{{- $data.full.Width -}}"
|
||||
data-pswp-height="{{- $data.full.Height -}}"
|
||||
class="pswp-image"
|
||||
>
|
||||
<img
|
||||
src="{{- .RelPermalink -}}"
|
||||
width="{{- .Width -}}"
|
||||
height="{{- .Height -}}"
|
||||
src="{{- $data.thumb.RelPermalink -}}"
|
||||
width="{{- $data.thumb.Width -}}"
|
||||
height="{{- $data.thumb.Height -}}"
|
||||
loading="lazy"
|
||||
{{ with $imageData.title }}title="{{- . -}}"{{ end }}
|
||||
{{ with $imageData.alt }}alt="{{- . -}}"{{ end }}
|
||||
{{ with $title }}title="{{- . -}}"{{ end }}
|
||||
{{ with $alt }}alt="{{- . -}}"{{ end }}
|
||||
/>
|
||||
</a>
|
||||
<div class="pswp-caption-content">
|
||||
<div>
|
||||
{{ upper $page.Title }}
|
||||
<div class="meta">
|
||||
{{ $page.Date | time.Format ":date_medium" }}
|
||||
·
|
||||
<a href="{{- $page.RelPermalink -}}">View Post</a>
|
||||
</div>
|
||||
<a href="{{- .RelPermalink -}}">{{ $caption }}</a>
|
||||
{{ partial "components/meta/index.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user