feat(gallery): add historical date parsing
feat: add logo file
This commit is contained in:
parent
5fc2e809cf
commit
6bc5fded11
9 changed files with 124 additions and 18 deletions
36
layouts/partials/FormatHistoricalDate.html
Normal file
36
layouts/partials/FormatHistoricalDate.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{{ $formattedDate := "" }}
|
||||
{{ $rawDate := . }}
|
||||
{{- $date := "1800-01-01" -}}
|
||||
{{- $datePrecision := "day" -}}
|
||||
|
||||
{{ if reflect.IsMap $rawDate }}
|
||||
{{ partial "FormatHistoricalDate" ($rawDate.from) }}
|
||||
-
|
||||
{{ partial "FormatHistoricalDate" ($rawDate.to) }}
|
||||
{{ else }}
|
||||
{{ $rawDate = string $rawDate }}
|
||||
{{ if eq (len $rawDate) 4 }}
|
||||
{{ $datePrecision = "year" }}
|
||||
{{ $date = printf "%s-01-01" $rawDate }}
|
||||
{{ end }}
|
||||
{{ if eq (len $rawDate) 7 }}
|
||||
{{ $datePrecision = "month" }}
|
||||
{{ $date = printf "%s-01" $rawDate }}
|
||||
{{ end }}
|
||||
{{ if eq (len $rawDate) 10 }}
|
||||
{{ $datePrecision = "day" }}
|
||||
{{ $date = $rawDate }}
|
||||
{{ end }}
|
||||
|
||||
{{- if eq $datePrecision "year" -}}
|
||||
{{ $formattedDate = ($date | time.Format "2006") }}
|
||||
{{- end -}}
|
||||
{{- if eq $datePrecision "month" -}}
|
||||
{{ $formattedDate = ($date | time.Format "January 2006") }}
|
||||
{{- end -}}
|
||||
{{- if eq $datePrecision "day" -}}
|
||||
{{ $formattedDate = ($date | time.Format "2 January 2006") }}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ printf "%s" $formattedDate }}
|
||||
|
|
@ -12,29 +12,30 @@
|
|||
<div class="gallery-tags__title">Filtrer par étiquettes</div>
|
||||
<div class="gallery-tags__list">
|
||||
<ul>
|
||||
{{- if eq (.Scratch.Get "image_list_context") "imtags" -}}
|
||||
{{- if eq (.Scratch.Get "image_list_context") "imtags" -}}
|
||||
<li>
|
||||
<a href="/images">Tout</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- range .Site.Taxonomies.imtags -}}
|
||||
<a href="/images">Tout</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- range .Site.Taxonomies.imtags -}}
|
||||
<li>
|
||||
<a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gallery__items-container">
|
||||
<div class="gallery__items">
|
||||
{{ range (.Paginator 8).Pages }}
|
||||
{{ range $item := (.Paginator 8).Pages }}
|
||||
<a class="gallery__item" href="{{ .RelPermalink }}">
|
||||
{{ $image := .Resources.GetMatch "original.jpg" }}
|
||||
{{ $image := $image.Resize "x350" }}
|
||||
{{ with $image }}
|
||||
<img
|
||||
class="gallery__image"
|
||||
title="{{ $item.Title }}"
|
||||
src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}"
|
||||
/>
|
||||
{{ end }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue