aboutsummaryrefslogtreecommitdiff
path: root/backend/templates
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-10-27 16:32:58 +0000
committerAnhgelus Morhtuuzh <william@herges.fr>2025-10-27 16:32:58 +0000
commitdb0b5c34432b4c0135af8c5c885fd6ad348c3691 (patch)
tree8f38b973a8dd3fc22bbd28498004940451621b41 /backend/templates
parent7bd309f3ca44930c5207b94acc2d425b24d4b369 (diff)
parent1e2ad3a8f8cd2c12786b92210616325a33d1b209 (diff)
Merge pull request '[Feat] Custom sections' (#1) from feat/custom-sections into main
Reviewed-on: https://git.anhgelus.world/anhgelus/small-web/pulls/1
Diffstat (limited to 'backend/templates')
-rw-r--r--backend/templates/base.html2
-rw-r--r--backend/templates/components.html15
-rw-r--r--backend/templates/data.html (renamed from backend/templates/log.html)2
-rw-r--r--backend/templates/home.html12
-rw-r--r--backend/templates/home_log.html3
-rw-r--r--backend/templates/home_section.html10
-rw-r--r--backend/templates/rss.xml16
7 files changed, 40 insertions, 20 deletions
diff --git a/backend/templates/base.html b/backend/templates/base.html
index 0a54096..436a1c2 100644
--- a/backend/templates/base.html
+++ b/backend/templates/base.html
@@ -1,5 +1,5 @@
<!doctype html>
-<html lang="fr" prefix="og: https://ogp.me/ns/article#">
+<html lang="{{ .Language }}" prefix="og: https://ogp.me/ns/article#">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
diff --git a/backend/templates/components.html b/backend/templates/components.html
index da133a6..5365445 100644
--- a/backend/templates/components.html
+++ b/backend/templates/components.html
@@ -1,16 +1,17 @@
-{{define "logs_display"}}
+{{define "section_display"}}
<article>
- {{ range .Logs }}
+ {{ $uri := .URI }} {{ range .Data }}
<article>
- <h2><a href="/logs/{{ .Slug }}">{{ .LogTitle }}</a></h2>
+ <h3><a href="/{{ $uri }}/{{ .Slug }}">{{ .DataTitle }}</a></h3>
<figure>
- <a href="/logs/{{ .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>
<p>{{ .Description }}</p>
</article>
- {{ end }} {{ if ne .PagesNumber 1 }}
+ {{ end }}
<div class="pagination">
+ {{ if .Paginate }}
<nav>
{{ if ne .CurrentPage 1 }}<a href="?page={{ before .CurrentPage }}">Précédent</a>{{else}}
<p></p>
@@ -20,7 +21,9 @@
<p></p>
{{end}}
</nav>
+ {{ else }}
+ <a href="/{{ $uri }}/">Voir plus</a>
+ {{ end }}
</div>
- {{ end }}
</article>
{{end}}
diff --git a/backend/templates/log.html b/backend/templates/data.html
index 75e0a42..a384459 100644
--- a/backend/templates/log.html
+++ b/backend/templates/data.html
@@ -1,6 +1,6 @@
{{define "body"}}
<article id="content">
- <h1>{{ .LogTitle }}</h1>
+ <h1>{{ .DataTitle }}</h1>
<p>{{ .Description }}</p>
<figure>
<img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" class="large" />
diff --git a/backend/templates/home.html b/backend/templates/home.html
index 7a76e48..d574525 100644
--- a/backend/templates/home.html
+++ b/backend/templates/home.html
@@ -1,9 +1,17 @@
{{define "body"}}
<main id="content">
<div class="introduction">
- <h1>logs</h1>
+ <h1>{{ .Name }}</h1>
<p>{{ .PageDescription }}</p>
</div>
- {{ template "logs_display" . }}
+ <div class="sections">
+ {{ range .Sections }}
+ <section>
+ <h2>{{ .Name }}</h2>
+ <p>{{ .Description }}</p>
+ {{ template "section_display" . }}
+ </section>
+ {{ end }}
+ </div>
</main>
{{end}}
diff --git a/backend/templates/home_log.html b/backend/templates/home_log.html
deleted file mode 100644
index 485661c..0000000
--- a/backend/templates/home_log.html
+++ /dev/null
@@ -1,3 +0,0 @@
-{{define "body"}}
-<main id="content">{{ template "logs_display" . }}</main>
-{{end}}
diff --git a/backend/templates/home_section.html b/backend/templates/home_section.html
new file mode 100644
index 0000000..cf7595d
--- /dev/null
+++ b/backend/templates/home_section.html
@@ -0,0 +1,10 @@
+{{define "body"}}
+<main id="content">
+ {{ range .Sections }}
+ <div class="introduction">
+ <h1>{{ .Name }}</h1>
+ <p>{{ .Description }}</p>
+ </div>
+ {{ template "section_display" . }} {{ end }}
+</main>
+{{end}}
diff --git a/backend/templates/rss.xml b/backend/templates/rss.xml
index c8390da..039a2f7 100644
--- a/backend/templates/rss.xml
+++ b/backend/templates/rss.xml
@@ -3,18 +3,20 @@
<channel>
<atom:link href="https://{{ .Domain }}{{ .URL }}" rel="self" type="application/rss+xml" />
<title>{{ .Title }}</title>
- <link>https://{{ .Domain }}/logs/</link>
+ {{ $sec := first .Sections }}
+ {{ $uri := uri $sec.URI }}
+ <link>https://{{ .Domain }}/{{ $uri }}</link>
<description>{{ .PageDescription }}</description>
- <language>fr-fr</language>
+ <language>{{ .Language }}</language>
{{ $domain := .Domain }}
- {{ range .Logs }}
+ {{ range $sec.Data }}
<item>
- <title>{{ .LogTitle }}</title>
- <link>https://{{ $domain }}/logs/{{ .Slug }}</link>
- <guid>https://{{ $domain }}/logs/{{ .Slug }}</guid>
+ <title>{{ .DataTitle }}</title>
+ <link>https://{{ $domain }}/{{ $uri }}{{ .Slug }}</link>
+ <guid>https://{{ $domain }}/{{ $uri }}{{ .Slug }}</guid>
<description>{{ .Description }}</description>
<pubDate>{{ .PubDateRSS }}</pubDate>
</item>
{{ end }}
</channel>
-</rss> \ No newline at end of file
+</rss>