Compare commits

..

30 Commits

Author SHA1 Message Date
64eaab93b2 fix: telephone partial 2022-02-23 11:26:53 +01:00
5089d181bd chore: Upgrade npm packages 2022-02-21 18:27:15 +01:00
42c60bc876 fix: site to Site 2022-02-16 12:58:24 +01:00
8576d3cb9d feat: Update twitter card 2022-02-16 12:53:52 +01:00
2f1f498090 Merge pull request 'feat: Add social metadata for LD+JSON' (#1) from killian/hugo-theme-lowtech:social-metadata-ls into master
## Détails

- Ajoute des metadata standards pour les réseaux sociaux

## Pourquoi

Ne pas dépendre des conventions Twitter et Facebook. Utiliser les standards de l'IndieWeb

## Références
https://tree.taiga.io/project/killiankemps-resilien/us/411

Reviewed-on: https://git.weko.io/kosssi/hugo-theme-lowtech/pulls/1
2022-02-16 12:51:46 +01:00
63eb1b60bd feat: Add social metadata for LD+JSON 2022-02-15 10:09:08 +01:00
679a554715 Revert "fix: Remove richtypo on head"
This reverts commit abc114f66a.
2022-02-02 17:41:15 +01:00
abc114f66a fix: Remove richtypo on head 2022-02-01 17:08:58 +01:00
ae3473dcea feat: Add new parameters on hugo to fix resize image 2022-02-01 12:12:02 +01:00
2b026a00ab feat: Remove element base
It's not mandatory, and actually should be create error on anchor
https://www.geeksforgeeks.org/how-to-specify-the-base-url-for-all-relative-urls-in-a-document-using-html5/
2022-02-01 10:53:49 +01:00
6b9914f4e3 chore: Update dependency 2022-01-28 00:20:13 +01:00
fde8378910 feat: Add new dependencies 2022-01-27 17:48:56 +01:00
ad8b29d7af feat: Add list on default layout list... 2022-01-14 12:31:42 +01:00
437ab76c51 fix: Remove unnecessary command 2021-11-18 21:26:55 +01:00
65a8c9b939 feat: Upgrade command to use docker compose v2 2021-11-18 18:38:15 +01:00
1a2c8fa3fd feat: Add build prod command 2021-11-17 23:22:49 +01:00
6390d59703 docs: Add documentation for shortcode year 2021-11-17 23:22:49 +01:00
cda43d557f feat: Remove blank parameter it's a bad practice, why it's here ? 2021-10-22 17:04:26 +02:00
0a9d9cabfc feat: Add space on phone number 2021-10-21 22:50:06 +02:00
ad3107622a feat: Add specific render to add lazy loading 2021-10-21 22:25:55 +02:00
2e74dbfa2b feat: Don't minify when debug params is true
Pour se mettre en mode debug il faut modifier le fichier config.yml:

params:
  debug: true

On est obligé de passer par params puisque Hugo ne peut pas utiliser la variable debug directement
2021-10-21 22:24:16 +02:00
1221094d75 feat: Simplify management of emails and phone number 2021-10-21 21:47:42 +02:00
8ca72479d4 fix: Deploy error with closed pipe
see https://github.com/docker/compose/issues/8218
2021-09-17 16:33:30 +02:00
d9122917fc feat: Add noindex on staging
https://support.google.com/webmasters/answer/7440203#indexed_though_blocked_by_robots_txt
https://developers.google.com/search/docs/advanced/crawling/block-indexing?visit_id=637660232047502724-3233221921&rd=1
2021-08-31 18:17:41 +02:00
4675c3a10f feat: Used transparent background on favicon 2021-07-30 23:04:52 +02:00
04b6bd0203 feat: Create partial year 2021-07-30 23:04:31 +02:00
5dd616b360 feat: Remove - on copyright 2021-07-30 23:04:02 +02:00
b8ae0a19ca feat: Add obfuscates partials 2021-07-03 16:03:24 +02:00
84539d10ae feat: Add svg favicon 2021-07-01 15:29:20 +02:00
01aafb89a1 feat: Add contact partials 2021-06-11 15:59:39 +02:00
26 changed files with 1827 additions and 1535 deletions

View File

@ -1,6 +1,16 @@
# theme lowtech # theme lowtech
Création d'un site ## Shortcodes
### Year
Pour afficher l'année en court :
```
{{< year >}}
```
## Initialisation d'un nouveau site
```sh ```sh
hugo new site exemple hugo new site exemple
@ -15,6 +25,10 @@ cd themes
git submodule add https://git.weko.io/kosssi/hugo-theme-lowtech.git git submodule add https://git.weko.io/kosssi/hugo-theme-lowtech.git
``` ```
## Contact
Pour la gestion de contact il est possible d'utiliser des shortcodes spécifiques `{{< mail >}}` ou `{{< tel >}}`
## Inspirations ## Inspirations
- https://github.com/yuin/goldmark/issues/59 - https://github.com/yuin/goldmark/issues/59

View File

@ -1,19 +0,0 @@
const obfuscates = document.getElementsByClassName("obfuscate");
for (const element of obfuscates) {
const link = document.createElement("a");
const separators = element.dataset.separators;
const protocol = element.dataset.param1.split("").reverse().join("");
let url = protocol;
for (let i = 0; i < separators.length; i++) {
url += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("");
}
let text = element.dataset.param2.split("").reverse().join("");
for (let i = 1; i < separators.length; i++) {
text += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("");
}
link.innerText = url.replace(new RegExp(element.dataset.regex, 'i'), element.dataset.replace);
link.href = url;
link.rel = "nofollow";
element.parentElement.insertBefore(link, element);
}
while (obfuscates.length > 0) obfuscates[0].remove();

9
assets/js/obfuscates.js Normal file
View File

@ -0,0 +1,9 @@
export default function abfuscates() {
const obfuscates = document.getElementsByClassName("obfuscate");
while (obfuscates.length > 0) {
const element = obfuscates[0]
element.href = element.dataset.link.split("").reverse().join("");
element.innerText = element.innerText.split("").reverse().join("");
element.classList.remove('obfuscate');
}
}

View File

@ -0,0 +1,3 @@
.obfuscate
unicode-bidi: bidi-override
direction: rtl

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 }}
{{ $resizeParams := delimit (slice (default "610x" site.Params.ImageSize) (default "q100" site.Params.ImageQuality) (default "webp" site.Params.ImageFormat)) " " }}
{{ $resized := $image.Resize (string $resizeParams) }}
{{ $path = $resized.RelPermalink }}
{{ end }}
<img src="{{ $path | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} loading="lazy" />

View File

@ -5,31 +5,12 @@
{{ $isWebLink := or $isExternalLink (eq 0 (.Destination | strings.Count ":")) }} {{ $isWebLink := or $isExternalLink (eq 0 (.Destination | strings.Count ":")) }}
{{ $isTelLink := strings.HasPrefix .Destination "tel:" }} {{ $isTelLink := strings.HasPrefix .Destination "tel:" }}
{{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }} {{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }}
{{ $hasSlash := in .Destination "/" }}
{{- if $isWebLink -}} {{- if $isWebLink -}}
{{ $hasSlash := in .Destination "/" }}
{{ $link := cond (and $isWebLink (and (not $hasSlash) (not $isExternalLink))) (path.Join "/" .Page.File.Dir .Destination) .Destination }} {{ $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> <a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isExternalLink }} rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
{{- else -}} {{- else if $isMailtoLink -}}
{{- $separators := cond $isMailtoLink ":@." ":" -}} {{ partial "contact/mail" .Destination }}
{{- $regex := cond $isMailtoLink "[a-z]*:(.*)" "[a-z]*:([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})"}} {{- else if $isTelLink -}}
{{- $replace := cond $isMailtoLink "$1" "$1 $2 $3 $4 $5" -}} {{ partial "contact/telephone" .Destination }}
{{- $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 -}} {{- end -}}

View File

@ -4,7 +4,7 @@
<body> <body>
{{ partial "header.html" . }} {{ partial "header.html" . }}
{{ partial "debug.html" . }} {{ partial "debug.html" . }}
<main id="content"> <main>
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</main> </main>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

View File

@ -1,3 +1,8 @@
{{ define "main" }} {{ define "main" }}
{{ .Content }} {{ .Content }}
<ul>
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }} {{ end }}

View File

@ -0,0 +1,6 @@
{{- with .Site.Data.contact.adresse -}}
<p>
{{ .rue }} <br>
{{ .cp }}{{ " " }}{{ .ville }}
</p>
{{- end -}}

View File

@ -0,0 +1,3 @@
{{- with .Site.Data.contact.instagram -}}
<a class="instagram" href="https://www.instagram.com/{{ . }}/">@{{ . }}</a>
{{- end -}}

View File

@ -0,0 +1,12 @@
{{- $protocol := "mailto" -}}
{{- $mail := . -}}
{{- $mailWithProtocol := $mail -}}
{{- if strings.HasPrefix $mail $protocol -}}
{{- $mail = substr $mail 7 -}}
{{- else -}}
{{- $mailWithProtocol = print $protocol ":" $mail -}}
{{- end -}}
<a
class="mail obfuscate"
data-link="{{ range $index := seq (sub (len $mailWithProtocol) 1) 0}}{{ substr $mailWithProtocol $index 1}}{{ end }}"
>{{ range $index := seq (sub (len $mail) 1) 0}}{{ substr $mail $index 1}}{{ end }}</a>

View File

@ -0,0 +1,12 @@
{{- $protocol := "tel" -}}
{{- $tel := . -}}
{{- $telWithProtocol := $tel -}}
{{- if strings.HasPrefix $tel $protocol -}}
{{- $tel = substr $tel 4 -}}
{{- else -}}
{{- $telWithProtocol = print $protocol ":" (replace $tel " " "") -}}
{{- end -}}
<a
class="tel obfuscate"
data-link="{{ range $index := seq (sub (len $telWithProtocol) 1) 0}}{{ substr $telWithProtocol $index 1}}{{ end }}"
>{{ range $index := seq (sub (len $tel) 1) 0}}{{ substr $tel $index 1}}{{if modBool $index 2}} {{ end }}{{ end }}</a>

View File

@ -0,0 +1 @@
<p>© {{ .Site.Title }}{{ " " }}{{ partial "year" }}</p>

View File

@ -2,12 +2,12 @@
<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">
<base href="{{ .Site.BaseURL }}">
<link rel="canonical" href="{{ .Permalink }}" /> <link rel="canonical" href="{{ .Permalink }}" />
{{ with .OutputFormats.Get "RSS" }}<link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" />{{ end }} {{ with .OutputFormats.Get "RSS" }}<link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" />{{ end }}
<meta name="HandheldFriendly" content="True"> <meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320"> <meta name="MobileOptimized" content="320">
{{ if ne hugo.Environment "production" }}<meta name="robots" content="noindex">{{ end }}
{{ partial "social_metadata.html" . }} {{ partial "social_metadata.html" . }}
{{ partial "style.html" . }} {{ partial "style.html" . }}

View File

@ -1,5 +1,9 @@
{{ $js := resources.Get "js/main.js" }} {{ $js := resources.Get "js/main.js" }}
{{ with $js }} {{ with $js }}
{{ $secureJS := . | resources.Minify | resources.Fingerprint }} {{ $secureJS := . | js.Build }}
{{ if not $.Site.Params.debug }}
{{ $secureJS = $secureJS | minify }}
{{ end }}
{{ $secureJS = $secureJS | fingerprint }}
<script src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script> <script src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
{{ end }} {{ end }}

View File

@ -1,5 +1,13 @@
{{/* https://github.com/msfjarvis/hugo-social-metadata */}} {{/* https://github.com/msfjarvis/hugo-social-metadata */}}
{{ if .Site.Params.FaviconEmoji }}
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{ .Site.Params.FaviconEmoji }}</text></svg>">
{{ else if .Site.Params.FaviconSVG }}
<link rel="icon" href="data:image/svg+xml;{{ safeURL .Site.Params.FaviconSVG }}">
{{ else if .Site.Params.FaviconFile }}
<link rel="icon" href="{{ .Site.Params.FaviconFile }}">
{{ end }}
<!-- Configure meta and title tags --> <!-- Configure meta and title tags -->
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
{{ if .Site.Params.TwitterCardType }} {{ if .Site.Params.TwitterCardType }}
@ -20,7 +28,7 @@
<meta name="twitter:title" content="{{ default .Site.Title .Title }}" /> <meta name="twitter:title" content="{{ default .Site.Title .Title }}" />
<meta name="twitter:description" content="{{ $.Site.Params.description }}" /> <meta name="twitter:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:url" content="{{ .Site.BaseURL }}" /> <meta name="twitter:url" content="{{ .Site.BaseURL }}" />
<meta name="twitter:image:src" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" /> <meta name="twitter:image" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" />
{{ else }} {{ else }}
<title>{{ .Title }} &middot; {{ .Site.Title }}</title> <title>{{ .Title }} &middot; {{ .Site.Title }}</title>
<meta name="description" content="{{ .Description }}" /> <meta name="description" content="{{ .Description }}" />
@ -37,9 +45,9 @@
{{ end }} {{ end }}
<meta name="twitter:url" content="{{ .Permalink }}" /> <meta name="twitter:url" content="{{ .Permalink }}" />
{{ if .Params.SocialImage }} {{ if .Params.SocialImage }}
<meta name="twitter:image:src" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" /> <meta name="twitter:image" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" />
{{ else }} {{ else }}
<meta name="twitter:image:src" content="{{ .Site.Params.SocialImage }}" /> <meta name="twitter:image" content="{{ .Site.BaseURL }}{{ .Site.Params.SocialImage }}" />
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if .Params.tags }} {{ if .Params.tags }}
@ -49,3 +57,13 @@
{{ else }} {{ else }}
<meta name="keywords" content="{{ $.Site.Params.Keywords }}" /> <meta name="keywords" content="{{ $.Site.Params.Keywords }}" />
{{ end }} {{ end }}
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "WebSite",
"name": "{{ default .Site.Title .Title }}",
"image": "{{ .Site.BaseURL}}{{ default .Site.Params.SocialImage .Params.SocialImage }}",
"about": "{{ .Site.Params.description }}"
}
</script>

View File

@ -1,2 +1,9 @@
{{ $style := resources.Get "styles/main.sass" | toCSS | minify | fingerprint }} {{ $style := resources.Get "styles/main.sass" }}
<link rel="stylesheet" href="{{ $style.Permalink }}"> {{ with $style }}
{{ $styleCSS := . | toCSS }}
{{ if not $.Site.Params.debug }}
{{ $styleCSS = $styleCSS | minify }}
{{ end }}
{{ $styleCSS = $styleCSS | fingerprint }}
<link rel="stylesheet" href="{{ $styleCSS.Permalink }}" integrity="{{ $styleCSS.Data.Integrity }}">
{{ end }}

View File

@ -0,0 +1 @@
{{- now.Format "2006" -}}

View File

@ -0,0 +1 @@
{{ partial "contact/adresse" . }}

View File

@ -0,0 +1 @@
{{- partial "contact/instagram" . -}}

View File

@ -0,0 +1 @@
{{- partial "contact/mail" .Site.Data.contact.mail -}}

View File

@ -0,0 +1 @@
{{- partial "contact/telephone" .Site.Data.contact.telephone -}}

View File

@ -1 +1 @@
{{- now.Format "2006" -}} {{ partial "year" . }}

3138
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,12 @@
"author": "Simon <simon@lamelio.fr>", "author": "Simon <simon@lamelio.fr>",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@resilien/directus-to-markdown": "1.0.1",
"imagemin-cli": "^6.0.0", "imagemin-cli": "^6.0.0",
"imagemin-webp": "^6.0.0", "imagemin-webp": "^6.0.0",
"richtypo": "4.0.7", "richtypo": "4.1.9",
"richtypo-rules-common": "4.0.2", "richtypo-rules-common": "4.1.8",
"richtypo-rules-fr": "4.0.2" "richtypo-rules-fr": "4.0.11",
"url-slug": "3.0.3"
} }
} }

View File

@ -31,12 +31,9 @@ stats() {
} }
install() { install() {
echo "📦 Installation des dépendances 📦"
echo "----------------------------------"
echo echo
echo "- Récupération du theme" echo "📦 Installation des dépendances node du theme 📦"
git submodule update --init echo
echo "- Installation des dépendances node du theme"
cd themes/hugo-theme-lowtech && npm i cd themes/hugo-theme-lowtech && npm i
} }
@ -50,6 +47,12 @@ dev_prod() {
hugo server hugo server
} }
build_prod() {
rm -rf public
hugo --minify --environment production
node themes/hugo-theme-lowtech/scripts/typo
}
prod() { prod() {
echo echo
echo "🚀 Déploiement du site en mode production 🚀" echo "🚀 Déploiement du site en mode production 🚀"
@ -58,7 +61,7 @@ prod() {
hugo --minify --environment production hugo --minify --environment production
node themes/hugo-theme-lowtech/scripts/typo node themes/hugo-theme-lowtech/scripts/typo
#DATE=`date +\"%Y0101\"` && find public -exec touch -d $DATE {} + #DATE=`date +\"%Y0101\"` && find public -exec touch -d $DATE {} +
docker-compose --context $DOCKER_CONTEXT -f docker-compose.prod.yml up -d --build --force-recreate DOCKER_CONTEXT=$DOCKER_CONTEXT docker compose -f docker-compose.prod.yml up -d --build --force-recreate
} }
staging() { staging() {
@ -69,14 +72,27 @@ staging() {
hugo --minify -DF --environment staging hugo --minify -DF --environment staging
node themes/hugo-theme-lowtech/scripts/typo node themes/hugo-theme-lowtech/scripts/typo
#DATE=`date +\"%Y0101\"` && find public -exec touch -d $DATE {} + #DATE=`date +\"%Y0101\"` && find public -exec touch -d $DATE {} +
docker-compose --context $DOCKER_CONTEXT -f docker-compose.staging.yml up -d --build --force-recreate DOCKER_CONTEXT=$DOCKER_CONTEXT docker compose -f docker-compose.staging.yml up -d --build --force-recreate
} }
favicons() { favicons() {
echo echo
if [ -f "static/logo.png" ]; then
echo "🔍 Génération des favicons à partir d'une image 512px" echo "🔍 Génération des favicons à partir d'une image 512px"
echo echo
convert static/logo.png -resize 32x32 -colors 16 \( -clone 0 -resize 16x16 -extent 16x16 \) \( -clone 0 -resize 32x32 -extent 32x32 \) -delete 0 static/favicon.ico convert static/logo.png -background transparent -resize 48x48 -colors 16 \( -clone 0 -resize 16x16 -extent 16x16 \) \( -clone 0 -resize 32x32 -extent 32x32 \) \( -clone 0 -resize 48x48 -extent 48x48 \) -delete 0 static/favicon.ico
elif [ -f "static/logo.svg" ]; then
echo "🔍 Génération des favicons à partir d'une image SVG"
echo
convert static/logo.svg -background transparent -resize 48x48 -colors 16 \( -clone 0 -resize 16x16 -extent 16x16 \) \( -clone 0 -resize 32x32 -extent 32x32 \) \( -clone 0 -resize 48x48 -extent 48x48 \) -delete 0 static/favicon.ico
else
echo "🚧 Il faut un fichier 'logo.svg' ou 'logo.png' dans le dossier static"
fi
echo
echo "Aide :"
echo "- liste des emoji : https://www.unicode.org/emoji/charts/full-emoji-list.html"
echo "- les emoji de twitter : https://github.com/twitter/twemoji"
echo "- Pour créer un base64 : \`echo \"data:image/svg+xml;base64,\$(cat static/logo.svg | base64 | tr -d '\r\n')\"\`"
} }
optimizer() { optimizer() {
@ -127,7 +143,7 @@ help_generic() {
echo "- ./run logs_backup 📥 Sauvegarde les logs" echo "- ./run logs_backup 📥 Sauvegarde les logs"
echo "- ./run logs_restore 📤 Restaure les logs" echo "- ./run logs_restore 📤 Restaure les logs"
echo "- ./run stats 🌠 Mise à jour de GoAccess" echo "- ./run stats 🌠 Mise à jour de GoAccess"
echo "- ./run favicons 🔍 Génération des favicons à partir d'une image 512px" echo "- ./run favicons 🔍 Génération des favicons à partir d'une image 512px ou un SVG"
echo "- ./run optimizer 🖼️ Optimisation des images" echo "- ./run optimizer 🖼️ Optimisation des images"
} }