Compare commits

...

12 Commits

Author SHA1 Message Date
Simon 81c863689e chore(directus-to-markdown): Upgrade to 1.2.0 2022-04-29 12:22:06 +02:00
Simon d5c0ebda14 feat: Add json template 2022-03-10 19:16:40 +01:00
Simon c06ff39ffe feat: Add Plausible partial 2022-03-03 09:32:03 +01:00
Simon cdb7e47a88 feat: Don't Resize svg file 2022-03-03 09:31:43 +01:00
Simon 7dd4dbfd3c feat: Resize image only if width are great than maxWidth 2022-03-03 09:31:17 +01:00
Simon e0b3ed9a0f chore: Upgrade directus-to-markdown 2022-02-23 16:19:39 +01:00
Simon 64eaab93b2 fix: telephone partial 2022-02-23 11:26:53 +01:00
Simon 5089d181bd chore: Upgrade npm packages 2022-02-21 18:27:15 +01:00
Simon 42c60bc876 fix: site to Site 2022-02-16 12:58:24 +01:00
Simon 8576d3cb9d feat: Update twitter card 2022-02-16 12:53:52 +01:00
Simon 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: kosssi/hugo-theme-lowtech#1
2022-02-16 12:51:46 +01:00
Killian Kemps 63eb1b60bd feat: Add social metadata for LD+JSON 2022-02-15 10:09:08 +01:00
10 changed files with 2702 additions and 92 deletions

View File

@ -1,11 +1,17 @@
{{/*
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) }}
{{ if ne (substr $path -3 3) "svg" }}
{{ $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 }}
{{ $maxWidth := (default "610" site.Params.ImageWidth) }}
{{ if gt $image.Width $maxWidth }}
{{ $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 }}
{{ end }}
{{ end }}
<img src="{{ $path | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} loading="lazy" />

View File

@ -0,0 +1,3 @@
{
"data" : {{ block "response" .}}{{ end }}
}

View File

@ -0,0 +1,4 @@
{
"name": "{{ .Title }}",
"permalink" : "{{ .Permalink }}"
}

View File

@ -0,0 +1,7 @@
{{ define "response" }}
[
{{ range $index, $e := .Data.Pages }}
{{ if $index }}, {{ end }}{{ .Render "item" }}
{{ end }}
]
{{ end }}

View File

@ -0,0 +1 @@
{{ define "response" }} {{ .Render "item" }} {{ end }}

View File

@ -4,7 +4,7 @@
{{- if strings.HasPrefix $tel $protocol -}}
{{- $tel = substr $tel 4 -}}
{{- else -}}
{{- $telWithProtocol := print $protocol ":" (replace $tel " " "") -}}
{{- $telWithProtocol = print $protocol ":" (replace $tel " " "") -}}
{{- end -}}
<a
class="tel obfuscate"

View File

@ -0,0 +1,4 @@
{{ if or (eq hugo.Environment "production") (eq hugo.Environment "staging") }}
<script async defer data-api="/api/event" data-domain="{{ (urls.Parse .Site.BaseURL).Host }}" src="/js/script.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
{{ end }}

View File

@ -28,7 +28,7 @@
<meta name="twitter:title" content="{{ default .Site.Title .Title }}" />
<meta name="twitter:description" content="{{ $.Site.Params.description }}" />
<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 }}
<title>{{ .Title }} &middot; {{ .Site.Title }}</title>
<meta name="description" content="{{ .Description }}" />
@ -45,9 +45,9 @@
{{ end }}
<meta name="twitter:url" content="{{ .Permalink }}" />
{{ if .Params.SocialImage }}
<meta name="twitter:image:src" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" />
<meta name="twitter:image" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" />
{{ else }}
<meta name="twitter:image:src" content="{{ .Site.Params.SocialImage }}" />
<meta name="twitter:image" content="{{ .Site.BaseURL }}{{ .Site.Params.SocialImage }}" />
{{ end }}
{{ end }}
{{ if .Params.tags }}
@ -57,3 +57,13 @@
{{ else }}
<meta name="keywords" content="{{ $.Site.Params.Keywords }}" />
{{ 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>

2735
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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