initialisation du site

This commit is contained in:
2024-02-02 12:39:18 +01:00
commit fc5c2f4972
73 changed files with 1305 additions and 0 deletions

View File

@ -0,0 +1,11 @@
{{/*
S'il n'y a pas de / dans l'url d'une image alors on ajoute le path de l'article
*/}}
{{ $path := cond (in .Destination "/") .Destination (path.Join "/" .Page.File.Dir .Destination) }}
{{ $image := .Page.Resources.GetMatch (printf "*%s*" .Destination) }}
{{ with $image }}
{{ $width := cond (gt .Width 960) 960 .Width }}
{{ $resized := $image.Resize (printf "%sx q100 webp" (string $width)) }}
{{ $path = $resized.RelPermalink }}
{{ end }}
<img src="{{ $path | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} loading="lazy" />

View File

@ -0,0 +1,35 @@
{{/*
S'il n'y a pas de / dans l'url d'un lien alors on ajoute le path du répertoire
*/}}
{{ $isExternalLink := strings.HasPrefix .Destination "http" }}
{{ $isWebLink := or $isExternalLink (eq 0 (.Destination | strings.Count ":")) }}
{{ $isTelLink := strings.HasPrefix .Destination "tel:" }}
{{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }}
{{ $hasSlash := in .Destination "/" }}
{{- if $isWebLink -}}
{{ $link := cond (and $isWebLink (and (not $hasSlash) (not $isExternalLink))) (path.Join "/" .Page.File.Dir .Destination) .Destination }}
<a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isExternalLink }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
{{- else -}}
{{- $separators := cond $isMailtoLink ":@." ":" -}}
{{- $regex := cond $isMailtoLink "[a-z]*:(.*)" "[a-z]*:([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})"}}
{{- $replace := cond $isMailtoLink "$1" "$1 $2 $3 $4 $5" -}}
{{- $string := .Destination -}}
{{- $params := slice -}}
{{- range split $separators "" }}
{{ $parts := split $string . }}
{{ $params = $params | append (index $parts 0) }}
{{ $string = index $parts 1 }}
{{ end }}
{{- $params = $params | append (string $string) -}}
<span
class="obfuscate{{ if $isMailtoLink }} at{{ end }}"
data-separators="{{ $separators }}"
{{ range $param_index, $param_value := $params }}
data-param{{add $param_index 1}}="{{ range $index := seq (sub (len $param_value) 1) 0}}{{ substr $param_value $index 1}}{{ end }}"
{{ end }}
data-regex="{{ $regex }}"
data-replace="{{ $replace }}"
>
</span>
{{- end -}}

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Takubeh - Kombucha</title>
<link rel="canonical" href="{{ .Permalink }}" />
{{ with .OutputFormats.Get "RSS" }}<link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" />{{ end }}
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
{{ if ne hugo.Environment "production" }}<meta name="robots" content="noindex">{{ end }}
{{ partial "styles.html" . }}
</head>
<body>
{{ partial "en_tete.html" . }}
{{ block "main" . }}{{ end }}
{{ partial "pied_de_page.html" . }}
{{ partial "javascripts.html" . }}
</body>
</html>

View File

@ -0,0 +1,3 @@
{{ define "main" }}
{{ .Content }}
{{ end }}

View File

@ -0,0 +1,15 @@
{{ define "main" }}
<div class="container">
<h1>{{ .RenderString .Title }}</h1>
<div class="container md">
{{ .Content }}
<ul>
{{ block "list" . }}
{{ range .Pages }}
<li><a href="{{ .Permalink }}">{{ .RenderString .Title }}</a></li>
{{ end }}
{{ end }}
</ul>
</div>
</div>
{{ end }}

View File

@ -0,0 +1,3 @@
{{ define "main" }}
{{ .Content }}
{{ end }}