Add more features for SEO

This commit is contained in:
kbe
2025-08-19 12:57:31 +02:00
parent 7adeb66c6c
commit 2bced48437
11 changed files with 1136 additions and 35 deletions

View File

@@ -0,0 +1,84 @@
{{- /* Dynamic meta tags based on content type */ -}}
{{- $description := "" -}}
{{- $keywords := "" -}}
{{- $title := .Title | default .Site.Title -}}
{{/* Dynamic description based on section */}}
{{- if eq .Section "tutorials" -}}
{{- $description = printf "Complete tutorial: %s. Learn %s in French with our step-by-step guide. %s"
.Title
(.Params.skill | default "the technology")
(.Params.summary | default "") -}}
{{- $keywords = printf "tutorial %s, french guide %s, %s, tutoriel informatique, guide technologie"
(.Params.category | default "")
(.Params.skill | default "")
(.Title | lower) -}}
{{- else if eq .Section "comparisons" -}}
{{- $description = printf "Detailed comparison: %s. %s Which to choose in 2024? Complete reviews and tests."
.Title
(.Params.summary | default "") -}}
{{- $keywords = printf "comparison %s, best %s 2024, review %s, comparatif %s"
(.Params.category | default "")
(.Params.category | default "")
(.Title | lower)
(.Params.category | default "") -}}
{{- else if eq .Section "security" -}}
{{- $description = printf "Computer security guide: %s. %s Learn to protect your data and systems effectively."
.Title
(.Params.summary | default "") -}}
{{- $keywords = printf "security %s, cybersecurity %s, protection %s, sécurité informatique"
(.Params.category | default "")
(.Title | lower)
(.Params.category | default "") -}}
{{- else if eq .Section "wordpress" -}}
{{- $description = printf "WordPress tutorial: %s. %s Complete guide to create and manage your WordPress site in French."
.Title
(.Params.summary | default "") -}}
{{- $keywords = printf "wordpress %s, tutorial wordpress %s, guide wordpress %s, créer site wordpress"
(.Params.category | default "")
(.Params.category | default "")
(.Title | lower) -}}
{{- else -}}
{{- $description = .Description | default .Summary | default .Site.Params.description | default .Site.Title -}}
{{- $keywords = delimit (.Keywords | default .Site.Params.keywords | default (slice)) ", " -}}
{{- end -}}
<!-- Dynamic meta tags -->
<meta name="description" content="{{ $description | truncate 160 }}">
<meta name="keywords" content="{{ $keywords | lower }}">
<!-- Content-type specific meta tags -->
{{- if eq .Section "tutorials" }}
<meta name="tutorial-type" content="{{ .Params.type | default "guide" }}">
<meta name="skill-level" content="{{ .Params.level | default "beginner" }}">
<meta name="estimated-time" content="{{ .Params.duration | default "30 min" }}">
{{- end }}
{{- if eq .Section "comparisons" }}
<meta name="comparison-year" content="2024">
<meta name="review-type" content="detailed">
{{- end }}
<!-- Article published/modified dates -->
{{- if .IsPage }}
<meta name="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
<meta name="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
{{- end }}
<!-- Author information -->
{{- $author := .Params.author | default .Site.Params.author | default .Site.Title }}
<meta name="article:author" content="{{ $author }}">
<meta name="author" content="{{ $author }}">
<!-- Category and tags -->
{{- if .Params.category }}
<meta name="article:section" content="{{ .Params.category }}">
{{- end }}
{{- range .Params.tags }}
<meta name="article:tag" content="{{ . }}">
{{- end }}