fix: metas and opengraph

This commit is contained in:
Matthieu Bessat 2024-04-02 10:41:44 +02:00
parent 53c41662bd
commit 4ac2ea869a
9 changed files with 15 additions and 28 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -28,13 +28,13 @@ dateFmt = "02.01.2006 15:04"
mastodon = "https://attreno.fr/@etoiledebethleem" mastodon = "https://attreno.fr/@etoiledebethleem"
peertube = "https://peertube.iriseden.eu/c/etoiledebethleem/videos" peertube = "https://peertube.iriseden.eu/c/etoiledebethleem/videos"
[params.defaultLogoImage] [params.defaultImage]
local = true local = true
src = "images/default_logo.png" src = "images/logo_medium.png"
[params.defaultCoverImage] [params.defaultCoverImage]
local = true local = true
src = "cover/cover.jpg" src = "images/cover_1.jpg"
[taxonomies] [taxonomies]
imtag = 'imtags' imtag = 'imtags'

View file

@ -1,7 +1,5 @@
--- ---
title: "Campagne d'adhésion 2023-2024" title: "Campagne d'adhésion 2023-2024"
description: Campagne d'adhésion 2023-2024 de l'association des Amis de la Chapelle de Bethléem à Aubevoye. description: Campagne d'adhésion 2023-2024 de l'association des Amis de la Chapelle de Bethléem à Aubevoye.
featured_image:
src: ./images/default_logo.png
--- ---

View file

@ -1,8 +0,0 @@
---
title: "Campagne d'adhésion l'Étoile de Bethléem - 2023-2024"
with_header: false
with_footer: false
description: Ouverture de la campagne d'adhésion le 14 juillet 2023
featured_image:
src: ./images/default_logo.png
---

View file

@ -12,7 +12,7 @@
{{ range .Paginator.Pages }} {{ range .Paginator.Pages }}
<li class="news-item"> <li class="news-item">
<a href="{{ .RelPermalink }}" class="news-item__image"> <a href="{{ .RelPermalink }}" class="news-item__image">
{{ $featuredImage := (resources.Get (printf "%s" ("cover/cover.jpg" | safeURL))) }} {{ $featuredImage := (resources.Get (.Site.Params.defaultCoverImage.src | safeURL)) }}
{{ if .Params.featured_image }} {{ if .Params.featured_image }}
{{ $featuredImage = .Resources.GetMatch (.Params.featured_image.src | safeURL) }} {{ $featuredImage = .Resources.GetMatch (.Params.featured_image.src | safeURL) }}

View file

@ -29,6 +29,5 @@
{{- end -}} {{- end -}}
{{ $title = printf "%s - %s" $title $siteTitle }}
{{ return $title }} {{ return $title }}

View file

@ -1,6 +1,9 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
{{- $title := partialCached "data/title" . .RelPermalink -}}
<title>{{ $title }} — {{ .Site.Title }}</title>
{{- $description := partialCached "data/description" . .RelPermalink -}} {{- $description := partialCached "data/description" . .RelPermalink -}}
<meta name="description" content="{{ $description }}"> <meta name="description" content="{{ $description }}">
@ -8,10 +11,6 @@
<meta name="author" content="{{ . }}"> <meta name="author" content="{{ . }}">
{{ end }} {{ end }}
{{- $title := partialCached "data/title" . .RelPermalink -}}
<title>{{ $title }} {{ if not .IsHome }}- L'Étoile de Bethléem{{ end }}</title>
<link rel="canonical" href="{{ .Permalink }}"> <link rel="canonical" href="{{ .Permalink }}">
{{ partial "opengraph/include.html" . }} {{ partial "opengraph/include.html" . }}
@ -38,7 +37,6 @@
<meta name="msapplication-TileImage" content="/icons/ms-icon-144x144.png"> <meta name="msapplication-TileImage" content="/icons/ms-icon-144x144.png">
<meta name="theme-color" content="#025E73"> <meta name="theme-color" content="#025E73">
<!-- 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 }} {{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}"> <link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">

View file

@ -32,7 +32,7 @@
{{ else }} {{ else }}
<!-- Type arg is set, check for defaultImage setting --> <!-- Type arg is set, check for defaultImage setting -->
{{ $defaultImageSetting := .Context.Site.Params.defaultCoverImage }} {{ $defaultImageSetting := .Context.Site.Params.defaultImage }}
{{ $result = merge $result (dict "isDefault" true) }} {{ $result = merge $result (dict "isDefault" true) }}
{{ $result = merge $result (dict "exists" true) }} {{ $result = merge $result (dict "exists" true) }}

View file

@ -17,25 +17,25 @@
<meta property="og:locale" content="{{ .Site.LanguageCode }}"> <meta property="og:locale" content="{{ .Site.LanguageCode }}">
{{- if .IsPage -}} {{ if .IsPage }}
<meta property="article:section" content="{{ .Section | title }}" /> <meta property="article:section" content="{{ .Section | title }}" />
{{- range .Params.tags -}} {{- range .Params.tags -}}
<meta property="article:tag" content="{{ . }}" /> <meta property="article:tag" content="{{ . }}" />
{{- end -}} {{- end -}}
{{- end -}} {{ end }}
{{- if .IsPage -}} {{ if .IsPage }}
{{- if not .Date.IsZero -}} {{- if not .Date.IsZero -}}
<meta property="article:published_time" content="{{- .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML -}}" /> <meta property="article:published_time" content="{{- .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML -}}" />
{{- end -}} {{- end -}}
{{- if not .Lastmod.IsZero -}} {{- if not .Lastmod.IsZero -}}
<meta property="article:modified_time" content="{{- .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML -}}" /> <meta property="article:modified_time" content="{{- .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML -}}" />
{{- end -}} {{- end -}}
{{- else -}} {{ else }}
{{ if not .Site.LastChange.IsZero }} {{ if not .Site.LastChange.IsZero }}
<meta property="og:updated_time" content="{{- .Site.LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML -}}" /> <meta property="og:updated_time" content="{{- .Site.LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML -}}" />
{{- end -}} {{- end -}}
{{- end -}} {{ end }}
{{ $image := partial "helpers/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }} {{ $image := partial "helpers/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }}
{{ if $image.exists }} {{ if $image.exists }}