aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-02-05 16:13:01 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2026-02-05 16:13:01 +0100
commited3812eeb6daa45a98d8d513a8de49b385c4831c (patch)
treeb3a6b309e2892997185d6c572a0b7bc0034b5025 /backend
parent26b879bf95d801c337b194b1af4aa07c167729a6 (diff)
feat(template): remove image if nothing is set in SEO
Diffstat (limited to 'backend')
-rw-r--r--backend/config.go1
-rw-r--r--backend/data.go3
-rw-r--r--backend/templates/base.html4
-rw-r--r--backend/templates/components.html18
4 files changed, 12 insertions, 14 deletions
diff --git a/backend/config.go b/backend/config.go
index d4872b1..3e605c8 100644
--- a/backend/config.go
+++ b/backend/config.go
@@ -32,7 +32,6 @@ type Config struct {
Domain string `toml:"domain"`
Name string `toml:"name"`
Description string `toml:"description"`
- DefaultImage string `toml:"default_image"`
Quotes []string `toml:"quotes"`
Language string `toml:"language"`
Database string `toml:"database"`
diff --git a/backend/data.go b/backend/data.go
index 9fd6aea..6796b97 100644
--- a/backend/data.go
+++ b/backend/data.go
@@ -67,9 +67,6 @@ func (d *data) merge(cfg *Config, r *http.Request) {
d.Quote = cfg.Quotes[rand.Intn(len(cfg.Quotes))]
}
}
- if d.Image == "" {
- d.Image = cfg.DefaultImage
- }
if d.URL == "" {
d.URL = r.URL.Path
}
diff --git a/backend/templates/base.html b/backend/templates/base.html
index 24d7b1b..cbb0e71 100644
--- a/backend/templates/base.html
+++ b/backend/templates/base.html
@@ -13,7 +13,9 @@
<meta name="og:title" content="{{ .Title }}" />
<meta name="og:type" content="website" />
<meta name="og:url" content="https://{{ .Domain }}{{ .URL }}" />
- <meta name="og:image" content="{{ fullStatic .Image }}" />
+ {{ if ne (len .Image) 0 }}
+ <meta name="og:image" content="{{ fullStatic .Image }}" />
+ {{ end }}
<meta name="og:description" content="{{ .PageDescription }}" />
<meta name="og:local" content="fr_FR" />
<meta name="og:site_name" content="{{ .Name }}" />
diff --git a/backend/templates/components.html b/backend/templates/components.html
index dff4626..b249706 100644
--- a/backend/templates/components.html
+++ b/backend/templates/components.html
@@ -16,7 +16,7 @@
{{ define "data_display" }}
<article class="large">
<figure>
- <a href="/{{ .URI }}/{{ .Slug }}"><img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" /></a>
+ <a href="/{{ .URI }}/{{ .Slug }}"><img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" /></a>
<figcaption>{{ .Img.Legend }}</figcaption>
</figure>
<div>
@@ -26,15 +26,15 @@
</article>
{{ end }}
{{ define "section_pagination" }}
- <div class="pagination">
- {{ if .Paginate }}
- {{ template "pagination" . }}
- {{ else }}
- {{ if eq (len .Data) .LenMax }}
- <a href="/{{ .URI }}/">Voir plus</a>
- {{ end }}
+ <div class="pagination">
+ {{ if .Paginate }}
+ {{ template "pagination" . }}
+ {{ else }}
+ {{ if eq (len .Data) .LenMax }}
+ <a href="/{{ .URI }}/">Voir plus</a>
{{ end }}
- </div>
+ {{ end }}
+ </div>
{{ end }}
{{ define "section_display--no-first" }}
<article class="article__list">