Compare commits
18 Commits
42be182916
...
d16c29fc5d
| Author | SHA1 | Date | |
|---|---|---|---|
| d16c29fc5d | |||
| fa72fea745 | |||
| 88927a6343 | |||
| a203120e21 | |||
| 08036b566d | |||
| 84af2115be | |||
| 3b3733cb96 | |||
| ea8aa8f3ec | |||
| fde4e5f5e6 | |||
| ce22aae00f | |||
| 0d1ef97aba | |||
| b21f7038ab | |||
| 36bae28f6d | |||
| 518ca65e29 | |||
| 8a1ce77c17 | |||
| 16b95458f1 | |||
| 4e99c13f18 | |||
| d33d7459ef |
@@ -7,6 +7,12 @@ disableHugoGeneratorInject: true
|
|||||||
enableEmoji: true
|
enableEmoji: true
|
||||||
timeZone: Europe/Paris
|
timeZone: Europe/Paris
|
||||||
theme: ["2026"]
|
theme: ["2026"]
|
||||||
|
security:
|
||||||
|
funcs:
|
||||||
|
getenv:
|
||||||
|
- "^HUGO_"
|
||||||
|
- "^CI$"
|
||||||
|
- "^MEILI_SEARCH_API_KEY$"
|
||||||
params:
|
params:
|
||||||
lists:
|
lists:
|
||||||
layout: spotlight
|
layout: spotlight
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ favicon: /favicon.png
|
|||||||
# Pas de / pour les ressources qui seront transformées
|
# Pas de / pour les ressources qui seront transformées
|
||||||
# Et les placer dans /assets et non dans /static
|
# Et les placer dans /assets et non dans /static
|
||||||
logo: logo-large.png
|
logo: logo-large.png
|
||||||
description: "et ses opinions impopulaires"
|
description: "Richard Dern et ses opinions impopulaires"
|
||||||
|
themeColor: "#060c14"
|
||||||
search:
|
search:
|
||||||
action: /recherche/
|
action: /recherche/
|
||||||
param: q
|
param: q
|
||||||
meilisearch:
|
meilisearch:
|
||||||
endpoint: /api/search
|
endpoint: /api/search
|
||||||
indexUid: blog_posts
|
indexUid: blog_posts
|
||||||
apiKey: "cf49bcdb1b08e5c502c41956d38ce0be80d5e79e9f084e6f15f4485f87d63c30"
|
|
||||||
hitsPerPage: 20
|
hitsPerPage: 20
|
||||||
|
|||||||
18
layouts/partials/head/description.html
Normal file
18
layouts/partials/head/description.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{{- $description := .Description | default "" -}}
|
||||||
|
{{- if not $description -}}
|
||||||
|
{{- $description = .Summary | plainify | htmlUnescape -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if not $description -}}
|
||||||
|
{{- $description = .Plain | htmlUnescape -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if not $description -}}
|
||||||
|
{{- $description = .Content | plainify | htmlUnescape -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if not $description -}}
|
||||||
|
{{- $description = site.Params.description | default "" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $description = $description | replaceRE "\\s+" " " | strings.TrimSpace -}}
|
||||||
|
{{- if gt (len $description) 180 -}}
|
||||||
|
{{- $description = truncate 180 $description -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- return $description -}}
|
||||||
68
layouts/partials/head/metadata.html
Normal file
68
layouts/partials/head/metadata.html
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{{- $title := site.Title -}}
|
||||||
|
{{- if not .IsHome -}}
|
||||||
|
{{- $title = printf "%s | %s" .Title site.Title -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $socialTitle := site.Title -}}
|
||||||
|
{{- if not .IsHome -}}
|
||||||
|
{{- $socialTitle = .Title -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $description := partial "head/description.html" . -}}
|
||||||
|
{{- $socialImage := partial "head/social-image.html" . -}}
|
||||||
|
{{- $searchPath := site.Params.search.action | relURL -}}
|
||||||
|
{{- $isSearchPage := eq .RelPermalink $searchPath -}}
|
||||||
|
{{- $robots := "max-image-preview:large" -}}
|
||||||
|
{{- if $isSearchPage -}}
|
||||||
|
{{- $robots = "noindex, follow" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $ogType := "website" -}}
|
||||||
|
{{- if and .IsPage (not $isSearchPage) -}}
|
||||||
|
{{- $ogType = "article" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $localeCode := site.LanguageCode | default site.Language.LanguageCode | default "fr-FR" -}}
|
||||||
|
{{- $locale := replace $localeCode "-" "_" -}}
|
||||||
|
<title>{{ $title }}</title>
|
||||||
|
{{- with $description }}
|
||||||
|
<meta name="description" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
<meta name="theme-color" content="{{ site.Params.themeColor | default "#060c14" }}">
|
||||||
|
<meta name="robots" content="{{ $robots }}">
|
||||||
|
<link rel="canonical" href="{{ .Permalink }}">
|
||||||
|
<meta property="og:locale" content="{{ $locale }}">
|
||||||
|
<meta property="og:site_name" content="{{ site.Title }}">
|
||||||
|
<meta property="og:type" content="{{ $ogType }}">
|
||||||
|
<meta property="og:title" content="{{ $socialTitle }}">
|
||||||
|
<meta property="og:url" content="{{ .Permalink }}">
|
||||||
|
{{- with $description }}
|
||||||
|
<meta property="og:description" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- with $socialImage.url }}
|
||||||
|
<meta property="og:image" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- with $socialImage.width }}
|
||||||
|
<meta property="og:image:width" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- with $socialImage.height }}
|
||||||
|
<meta property="og:image:height" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- with $socialImage.alt }}
|
||||||
|
<meta property="og:image:alt" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
<meta name="twitter:card" content="summary">
|
||||||
|
<meta name="twitter:title" content="{{ $socialTitle }}">
|
||||||
|
{{- with $description }}
|
||||||
|
<meta name="twitter:description" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- with $socialImage.url }}
|
||||||
|
<meta name="twitter:image" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- with $socialImage.alt }}
|
||||||
|
<meta name="twitter:image:alt" content="{{ . }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- if eq $ogType "article" -}}
|
||||||
|
{{- with .Date }}
|
||||||
|
<meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Lastmod }}
|
||||||
|
<meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
55
layouts/partials/head/social-image.html
Normal file
55
layouts/partials/head/social-image.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{{- $image := false -}}
|
||||||
|
{{- $isCoverImage := false -}}
|
||||||
|
{{- $alt := "" -}}
|
||||||
|
{{- with .Params.cover -}}
|
||||||
|
{{- $cover := $.Resources.GetMatch . -}}
|
||||||
|
{{- if and $cover (ne $cover.MediaType.SubType "svg") -}}
|
||||||
|
{{- $image = $cover -}}
|
||||||
|
{{- $isCoverImage = true -}}
|
||||||
|
{{- $coverName := path.Base . | replaceRE "\\.[^.]+$" "" -}}
|
||||||
|
{{- $coverDataFile := $.Resources.Get (printf "data/images/%s.yaml" $coverName) -}}
|
||||||
|
{{- if not $coverDataFile -}}
|
||||||
|
{{- $coverDataFile = $.Resources.Get (printf "data/%s.yaml" $coverName) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $coverData := dict -}}
|
||||||
|
{{- if $coverDataFile -}}
|
||||||
|
{{- $coverData = $coverDataFile.Content | transform.Unmarshal -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $alt = index $coverData "description" | default "" -}}
|
||||||
|
{{- if not $alt -}}
|
||||||
|
{{- $alt = index $coverData "title" | default "" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if not $image -}}
|
||||||
|
{{- $logoPath := site.Params.logo | default "logo-large.png" -}}
|
||||||
|
{{- $logo := resources.GetMatch $logoPath -}}
|
||||||
|
{{- if and $logo (ne $logo.MediaType.SubType "svg") -}}
|
||||||
|
{{- $image = $logo -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if not $alt -}}
|
||||||
|
{{- if and $image $isCoverImage -}}
|
||||||
|
{{- if and .IsPage (not .IsHome) -}}
|
||||||
|
{{- $alt = printf "Image de partage pour %s" .Title -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $alt = printf "Logo du site %s" site.Title -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else if $image -}}
|
||||||
|
{{- $alt = printf "Logo du site %s" site.Title -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $data := dict -}}
|
||||||
|
{{- if $image -}}
|
||||||
|
{{- $data = dict
|
||||||
|
"url" $image.Permalink
|
||||||
|
"alt" ($alt | strings.TrimSpace | truncate 420)
|
||||||
|
-}}
|
||||||
|
{{- with $image.Width -}}
|
||||||
|
{{- $data = merge $data (dict "width" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with $image.Height -}}
|
||||||
|
{{- $data = merge $data (dict "height" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- return $data -}}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{- $search := .Site.Params.search -}}
|
{{- $search := .Site.Params.search -}}
|
||||||
{{- $meili := $search.meilisearch -}}
|
{{- $meili := $search.meilisearch -}}
|
||||||
|
{{- $apiKey := getenv "MEILI_SEARCH_API_KEY" -}}
|
||||||
|
{{- if eq $apiKey "" -}}
|
||||||
|
{{- errorf "MEILI_SEARCH_API_KEY is required to render the search page" -}}
|
||||||
|
{{- end -}}
|
||||||
<header class="article-header">
|
<header class="article-header">
|
||||||
{{ partialCached "header-brand.html" .Site .Site.Title (.Site.Params.logo | default "logo-large.png") }}
|
{{ partialCached "header-brand.html" .Site .Site.Title (.Site.Params.logo | default "logo-large.png") }}
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
@@ -9,7 +13,7 @@
|
|||||||
class="search-page"
|
class="search-page"
|
||||||
data-search-endpoint="{{ $meili.endpoint }}"
|
data-search-endpoint="{{ $meili.endpoint }}"
|
||||||
data-search-index="{{ $meili.indexUid }}"
|
data-search-index="{{ $meili.indexUid }}"
|
||||||
data-search-api-key="{{ $meili.apiKey }}"
|
data-search-api-key="{{ $apiKey }}"
|
||||||
data-search-limit="{{ $meili.hitsPerPage }}"
|
data-search-limit="{{ $meili.hitsPerPage }}"
|
||||||
data-search-param="{{ $search.param }}"
|
data-search-param="{{ $search.param }}"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
<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>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
{{ partial "head/metadata.html" . }}
|
||||||
{{ with .Description }}
|
|
||||||
<meta name="description" content="{{ . }}">
|
|
||||||
{{ else }}
|
|
||||||
{{ with site.Params.description }}
|
|
||||||
<meta name="description" content="{{ . }}">
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
||||||
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
||||||
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256">
|
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
{{ partial "head/metadata.html" . }}
|
||||||
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
||||||
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
||||||
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256" />
|
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256" />
|
||||||
|
|||||||
Reference in New Issue
Block a user