diff options
| -rw-r--r-- | backend/data.go | 1 | ||||
| -rw-r--r-- | backend/templates/base.html | 2 | ||||
| -rw-r--r-- | frontend/index.ts | 3 |
3 files changed, 5 insertions, 1 deletions
diff --git a/backend/data.go b/backend/data.go index fe5aa96..741a5c4 100644 --- a/backend/data.go +++ b/backend/data.go @@ -87,6 +87,7 @@ func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string if r.Context().Value(isUpdateKey).(bool) { exec = "body" w.Header().Set("Updated-Title", d.Title()) + w.Header().Set("Updated-Quote", d.Quote) } if custom == nil { err = t.ExecuteTemplate(w, exec, d) diff --git a/backend/templates/base.html b/backend/templates/base.html index fec24ef..a79f4c1 100644 --- a/backend/templates/base.html +++ b/backend/templates/base.html @@ -38,7 +38,7 @@ {{ template "body" . }} <footer> <p>© 2025 - Anhgelus Morthuuzh</p> - <p>« {{ .Quote }} »</p> + <p id="quote">« {{ .Quote }} »</p> <p><a href="/legal">Mentions légales</a>, <a href="https://git.anhgelus.world/anhgelus/small-web">code source</a>.</p> </footer> <script src="{{ assets "index.js" }}" defer></script> diff --git a/frontend/index.ts b/frontend/index.ts index c337e43..13997b3 100644 --- a/frontend/index.ts +++ b/frontend/index.ts @@ -19,6 +19,9 @@ function setupAnchors() { document.addEventListener("htmx:afterSettle", e => { const title = e.detail.xhr.getResponseHeader("Updated-Title") if (title?.length !== 0) document.title = title + const quote = e.detail.xhr.getResponseHeader("Updated-Quote") + if (quote?.length !== 0) + document.querySelector("#quote")!.innerHTML = "« " + quote + " »" window.history.pushState({}, "", e.detail.pathInfo.finalRequestPath) setupAnchors() }) |
