summaryrefslogtreecommitdiff
path: root/pages/shop/_product/index.fnl
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-11-25 22:28:15 +0600
committerunwox <me@unwox.com>2025-12-15 11:26:39 +0600
commit3fac776752322761404cd6150eacfc3ac0cf5e72 (patch)
treec19874440fe87cada559af5c2572b98a5ff5b907 /pages/shop/_product/index.fnl
parent4edb2d7d0f9b5d1ff730599d07e99aabb7f4b39c (diff)
small navigation improvements
Diffstat (limited to 'pages/shop/_product/index.fnl')
-rw-r--r--pages/shop/_product/index.fnl14
1 files changed, 12 insertions, 2 deletions
diff --git a/pages/shop/_product/index.fnl b/pages/shop/_product/index.fnl
index 30cbc33..6903144 100644
--- a/pages/shop/_product/index.fnl
+++ b/pages/shop/_product/index.fnl
@@ -57,11 +57,21 @@
(HTML
[:div {:class "content"}
(if (not agreed-to-cookies?) (templates.cookies-agreement) "")
- [:div {:class "back"} [:a {:href "/shop"} "⟵ Обратно к списку"]]
+ ;; this method of going back to the list requires JS and is bug prone but
+ ;; at the same time it's the simplest one. doing the same thing without
+ ;; JS would require storing "back URL" in query parameter (which will make
+ ;; URLs ugly and also hurt SEO) or in a cookie (which is brittle)
+ ;; TODO: also add <noscript> version of this link
+ [:div {:class "back"} [:a {:href "#"
+ :onclick "history.length > 1
+ ? history.back()
+ : location.assign('/shop')"}
+ "⟵ Обратно к списку"]]
[:div {:class "product-page-layout"}
[:section {}
- [:h2 {:class "product-page-title" :id "content"} product.title]
+ [:div {:id "content"} ""]
+ [:h2 {:class "product-page-title"} product.title]
(if authenticated?
(HTML
[:div {:class "mb-1" :style "margin-top: -0.5rem;"}