feat: add some style
This commit is contained in:
parent
4ce94a900d
commit
f0f90f14b2
21 changed files with 291 additions and 96 deletions
13
layouts/partials/data/description.html
Normal file
13
layouts/partials/data/description.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Use site subtitle by default -->
|
||||
{{ $description := .Site.Params.sidebar.subtitle }}
|
||||
|
||||
{{ if .Description }}
|
||||
<!-- Page description exists -->
|
||||
{{ $description = .Description }}
|
||||
{{ else if .IsPage }}
|
||||
<!-- Use page summary -->
|
||||
{{ $description = .Summary }}
|
||||
{{ end }}
|
||||
|
||||
{{ return ($description | plainify)}}
|
||||
|
||||
39
layouts/partials/data/title.html
Normal file
39
layouts/partials/data/title.html
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{{- $title := .Title -}}
|
||||
{{- $siteTitle := .Site.Title -}}
|
||||
|
||||
{{- if .IsHome -}}
|
||||
<!-- Homepage, and it's pagination -->
|
||||
|
||||
<!-- Build paginator -->
|
||||
{{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
|
||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||
{{ $pag := .Paginate ($filtered) }}
|
||||
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<!-- Paginated. Append page number to title -->
|
||||
{{ $title = printf "%s - %s" .Paginator $siteTitle }}
|
||||
{{ else }}
|
||||
{{ $title = $siteTitle}}
|
||||
{{ end }}
|
||||
{{- else if eq .Kind "term" -}}
|
||||
<!-- Taxonomy page -->
|
||||
|
||||
<!-- Build paginator -->
|
||||
{{ $notHidden := where .Pages "Params.hidden" "!=" true }}
|
||||
{{ $pag := .Paginate ($notHidden) }}
|
||||
|
||||
<!-- {TAXONOMY_TYPE}: {TAXONOMY_TERM} -->
|
||||
{{ $title = slice (title .Data.Singular) ": " $title }}
|
||||
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<!-- Add page number-->
|
||||
{{ $title = $title | append " - " .Paginator }}
|
||||
{{ end }}
|
||||
|
||||
{{ $title = $title | append " - " $siteTitle }}
|
||||
{{ $title = delimit $title "" }}
|
||||
{{- end -}}
|
||||
|
||||
{{ return $title }}
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<footer class="site-footer">
|
||||
<div class="site-footer__content page-container">
|
||||
<a href="/"><b>{{ .Site.Title }}</b></a>
|
||||
<a href="/a-propos-du-site">A propos de ce site</a>
|
||||
<a href="/contact">Nous contacter</a>
|
||||
<a href="/"><b>{{ .Site.Title }}</b></a>.
|
||||
<a href="/a-propos-du-site">A propos de ce site</a>.
|
||||
<a href="/contact">Nous contacter</a>.
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
29
layouts/partials/head.html
Normal file
29
layouts/partials/head.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{- $description := partialCached "data/description" . .RelPermalink -}}
|
||||
<meta name="description" content="{{ $description }}">
|
||||
|
||||
{{- with .Site.Params.author -}}
|
||||
<meta name="author" content="{{ . }}">
|
||||
{{ end }}
|
||||
|
||||
{{- $title := partialCached "data/title" . .RelPermalink -}}
|
||||
<title>{{ $title }}</title>
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
|
||||
{{ partial "opengraph/include.html" . }}
|
||||
|
||||
{{ range .AlternativeOutputFormats }}
|
||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.favicon }}
|
||||
<link rel="shortcut icon" href="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
<!-- Note: j'ai galérer à rajouter du scss car en fait y'avait déja une variable $style de définit plus haut... -->
|
||||
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
|
||||
|
||||
63
layouts/partials/helpers/image.html
Normal file
63
layouts/partials/helpers/image.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<!-- Modified to have the featured image field as a dict (being able to specify meta data and display option for image) -->
|
||||
{{ $result := dict "exists" false "permalink" nil "resource" nil "isDefault" false }}
|
||||
{{ $imageField := "featured_image" }}
|
||||
{{ $imageValue := index .Context.Params $imageField }}
|
||||
{{ printf "%#v" "hello debu" }}
|
||||
|
||||
{{ if $imageValue }}
|
||||
{{ $imageValue := index $imageValue "src" }}
|
||||
<!-- If page has `image` field set -->
|
||||
{{ $result = merge $result (dict "exists" true) }}
|
||||
{{ $url := urls.Parse $imageValue }}
|
||||
|
||||
{{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }}
|
||||
<!-- Is an external image -->
|
||||
{{ $result = merge $result (dict "permalink" $imageValue) }}
|
||||
{{ else }}
|
||||
{{ $pageResourceImage := .Context.Resources.GetMatch (printf "%s" ($imageValue | safeURL)) }}
|
||||
|
||||
{{ if $pageResourceImage }}
|
||||
<!-- If image is found under page bundle -->
|
||||
{{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
|
||||
|
||||
<!-- Disable SVG image processing, not supported by Hugo -->
|
||||
{{ if ne (path.Ext $imageValue) ".svg" }}
|
||||
{{ $result = merge $result (dict "resource" $pageResourceImage) }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<!-- Can not find the image under page bundle. Could be a relative linked image -->
|
||||
{{ $result = merge $result (dict "permalink" (relURL $imageValue)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
<!-- Type arg is set, check for defaultImage setting -->
|
||||
{{ $defaultImageSetting := .Context.Site.Params.defaultImage }}
|
||||
|
||||
{{ $result = merge $result (dict "isDefault" true) }}
|
||||
{{ $result = merge $result (dict "exists" true) }}
|
||||
|
||||
{{ if $defaultImageSetting.local }}
|
||||
{{ $siteResourceImage := resources.GetMatch (printf "%s" ($defaultImageSetting.src | safeURL)) }}
|
||||
|
||||
{{ if $siteResourceImage }}
|
||||
<!-- Try search image under site's assets folder -->
|
||||
{{ $result = merge $result (dict "permalink" $siteResourceImage.RelPermalink) }}
|
||||
{{ $result = merge $result (dict "resource" $siteResourceImage) }}
|
||||
{{ else }}
|
||||
<!-- Can not find the image -->
|
||||
{{ errorf "Failed loading image: %q" $defaultImageSetting.src }}
|
||||
{{ $result = merge $result (dict "exists" false) }}
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
<!-- External image -->
|
||||
{{ $result = merge $result (dict "permalink" (relURL $defaultImageSetting.src)) }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ return $result }}
|
||||
|
||||
|
|
@ -7,21 +7,19 @@
|
|||
{{ with .Content }}<div>{{ . }}</div>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="gallery-tags__title">Filtrer par étiquettes</div>
|
||||
<div class="gallery-tags__list">
|
||||
<ul>
|
||||
{{- if eq (.Scratch.Get "image_list_context") "imtags" -}}
|
||||
<li>
|
||||
<a href="/images">Tout</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- range .Site.Taxonomies.imtags -}}
|
||||
<li>
|
||||
<a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
<p class="gallery-tags__title">Filtrer par étiquettes :</p>
|
||||
<ul class="gallery-tags__list tags-list">
|
||||
{{- if eq (.Scratch.Get "image_list_context") "imtags" -}}
|
||||
<li class="gallery-tags__item tags-list__item">
|
||||
<a href="/images">Tout</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- range .Site.Taxonomies.imtags -}}
|
||||
<li class="gallery-tags__item tags-list__item">
|
||||
<a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="gallery__items-container">
|
||||
|
|
|
|||
42
layouts/partials/opengraph/include.html
Normal file
42
layouts/partials/opengraph/include.html
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{{- $title := partialCached "data/title" . .RelPermalink -}}
|
||||
{{- $description := partialCached "data/description" . .RelPermalink -}}
|
||||
|
||||
<meta property='og:title' content='{{ $title }}'>
|
||||
<meta property='og:description' content='{{ $description }}'>
|
||||
<meta property='og:url' content='{{ .Permalink }}'>
|
||||
<meta property='og:site_name' content='{{ .Site.Title }}'>
|
||||
<meta property='og:type' content='
|
||||
{{- if .IsPage -}}
|
||||
article
|
||||
{{- else -}}
|
||||
website
|
||||
{{- end -}}
|
||||
'>
|
||||
|
||||
<meta property='og:locale' content='{{ .Site.LanguageCode }}'>
|
||||
|
||||
{{- if .IsPage -}}
|
||||
<meta property='article:section' content='{{ .Section | title }}' />
|
||||
{{- range .Params.tags -}}
|
||||
<meta property='article:tag' content='{{ . }}' />
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .IsPage -}}
|
||||
{{- if not .Date.IsZero -}}
|
||||
<meta property='article:published_time' content='{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
|
||||
{{- end -}}
|
||||
{{- if not .Lastmod.IsZero -}}
|
||||
<meta property='article:modified_time' content='{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if not .Site.LastChange.IsZero -}}
|
||||
<meta property='og:updated_time' content='{{ .Site.LastChange.Format " 2006-01-02T15:04:05-07:00 " | safeHTML }}'/>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ $image := partialCached "helpers/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }}
|
||||
{{- if $image.exists -}}
|
||||
<meta property='og:image' content='{{ absURL $image.permalink }}' />
|
||||
{{- end -}}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue