1

Charge la clé de recherche via l'environnement

This commit is contained in:
2026-03-06 22:37:05 +01:00
parent fa72fea745
commit d16c29fc5d
2 changed files with 11 additions and 1 deletions

View File

@@ -7,6 +7,12 @@ disableHugoGeneratorInject: true
enableEmoji: true
timeZone: Europe/Paris
theme: ["2026"]
security:
funcs:
getenv:
- "^HUGO_"
- "^CI$"
- "^MEILI_SEARCH_API_KEY$"
params:
lists:
layout: spotlight

View File

@@ -1,6 +1,10 @@
{{ define "main" }}
{{- $search := .Site.Params.search -}}
{{- $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">
{{ partialCached "header-brand.html" .Site .Site.Title (.Site.Params.logo | default "logo-large.png") }}
<h1>{{ .Title }}</h1>
@@ -9,7 +13,7 @@
class="search-page"
data-search-endpoint="{{ $meili.endpoint }}"
data-search-index="{{ $meili.indexUid }}"
data-search-api-key="{{ $meili.apiKey }}"
data-search-api-key="{{ $apiKey }}"
data-search-limit="{{ $meili.hitsPerPage }}"
data-search-param="{{ $search.param }}"
>