aboutsummaryrefslogtreecommitdiff
path: root/backend/templates
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-10-27 13:32:39 +0100
committerWilliam Hergès <william@herges.fr>2025-10-27 13:32:39 +0100
commitf1e008670cd865520eb5f21fe6e7b56f02076a23 (patch)
tree33f099bced477c3e84fa60b20136354535d0c18c /backend/templates
parent7bd309f3ca44930c5207b94acc2d425b24d4b369 (diff)
feat(config): supports multiple sections
Diffstat (limited to 'backend/templates')
-rw-r--r--backend/templates/components.html20
-rw-r--r--backend/templates/home.html4
-rw-r--r--backend/templates/log.html2
-rw-r--r--backend/templates/rss.xml12
4 files changed, 16 insertions, 22 deletions
diff --git a/backend/templates/components.html b/backend/templates/components.html
index da133a6..9792784 100644
--- a/backend/templates/components.html
+++ b/backend/templates/components.html
@@ -1,26 +1,16 @@
{{define "logs_display"}}
<article>
- {{ range .Logs }}
+ {{ $uri := .URI }}
+ {{ range .Data }}
<article>
- <h2><a href="/logs/{{ .Slug }}">{{ .LogTitle }}</a></h2>
+ <h2><a href="/{{ $uri }}/{{ .Slug }}">{{ .DataTitle }}</a></h2>
<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 }}
- <div class="pagination">
- <nav>
- {{ if ne .CurrentPage 1 }}<a href="?page={{ before .CurrentPage }}">Précédent</a>{{else}}
- <p></p>
- {{end}}
- <p>{{ .CurrentPage }}/{{ .PagesNumber }}</p>
- {{ if ne .CurrentPage .PagesNumber }}<a href="?page={{ next .CurrentPage }}">Suivant</a>{{else}}
- <p></p>
- {{end}}
- </nav>
- </div>
{{ end }}
+ <a href="/{{ $uri }}/">Voir plus</a>
</article>
{{end}}
diff --git a/backend/templates/home.html b/backend/templates/home.html
index 7a76e48..ce4f4e8 100644
--- a/backend/templates/home.html
+++ b/backend/templates/home.html
@@ -4,6 +4,10 @@
<h1>logs</h1>
<p>{{ .PageDescription }}</p>
</div>
+ {{ range .Sections }}
+ <div>
{{ template "logs_display" . }}
+ </div>
+ {{ end }}
</main>
{{end}}
diff --git a/backend/templates/log.html b/backend/templates/log.html
index 75e0a42..a384459 100644
--- a/backend/templates/log.html
+++ b/backend/templates/log.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/rss.xml b/backend/templates/rss.xml
index c8390da..6d99272 100644
--- a/backend/templates/rss.xml
+++ b/backend/templates/rss.xml
@@ -3,18 +3,18 @@
<channel>
<atom:link href="https://{{ .Domain }}{{ .URL }}" rel="self" type="application/rss+xml" />
<title>{{ .Title }}</title>
- <link>https://{{ .Domain }}/logs/</link>
+ <link>https://{{ .Domain }}/{{ .URI }}/</link>
<description>{{ .PageDescription }}</description>
<language>fr-fr</language>
{{ $domain := .Domain }}
- {{ range .Logs }}
+ {{ range .Section.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>