feat(SEO): add Json-LD meta and tags
All checks were successful
Deploy workflow / deploy (push) Successful in 13s

This commit is contained in:
Matthieu Bessat 2024-09-03 23:59:29 +02:00
parent 4ababc96dc
commit 96265bfbf3
7 changed files with 105 additions and 65 deletions

View file

@ -1,6 +1,9 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{- $title := partialCached "data/title" . .RelPermalink -}}
<title>{{ $title }} {{ if not .IsHome }}- VMEMS{{ end }}</title>
{{- $description := partialCached "data/description" . .RelPermalink -}}
<meta name="description" content="{{ $description }}">
@ -8,15 +11,18 @@
<meta name="author" content="{{ . }}">
{{ end }}
{{- $title := partialCached "data/title" . .RelPermalink -}}
<title>{{ $title }} {{ if not .IsHome }}- VMEMS{{ end }}</title>
{{ if .IsPage }}
{{- with .Params.tags -}}
<meta name="keywords" content="{{ range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}">
{{ end }}
{{- end -}}
<link rel="canonical" href="{{ .Permalink }}">
{{ partial "opengraph/include.html" . }}
{{- partial "metas/opengraph.html" . -}}
{{- partial "metas/json-ld.html" . -}}
{{ range .AlternativeOutputFormats }}
{{- range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end }}
@ -29,7 +35,7 @@
<meta name="theme-color" content="#198754">
<!-- 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 }}">
<meta name="htmx-config" content='{"selfRequestsOnly":false}'>

View file

@ -0,0 +1,23 @@
{{ if .IsPage }}
{{ if eq .Section "actualites" }}
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "BlogPosting",
"articleSection" : "{{ .Section | title }}",
"name" : "{{ .Title }}",
"headline" : "{{ .Title }}",
"description" : "{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}",
"inLanguage" : "fr-FR",
"author" : "{{ .Params.author }}",
"creator" : "VMEMS",
"accountablePerson" : "VMEMS",
"datePublished": "{{ .PublishDate.Format $.Site.Params.ISO8601 }}",
"dateModified" : "{{ .Lastmod.Format $.Site.Params.ISO8601 }}",
"url" : "{{ .Permalink }}",
"wordCount" : "{{ .WordCount }}",
"keywords" : [ {{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} ]
}
</script>
{{ end }}
{{ end }}