Fork me on GitHub
#biff
<
2023-01-18
>
macrobartfast00:01:14

Can I integrate a client side router into Reitit or is there a strategy for that? To clarify, I mean a changing URL in the address bar that matches what’s going on in the app.

Epidiah Ravachol04:01:57

If you're using htmx, there's this: https://htmx.org/docs/#history

👌 2
macrobartfast06:01:11

Perfect. htmx… sigh… 😍

Jacob O'Bryant08:01:06

I'm curious about what the use case is? usually if I want to change the url, I just do a regular link/form post without htmx and load the whole page. hx-push-url might help to make the navigation slightly faster I suppose. though hx-boost is also worth looking at for that; I usually have that switched on.

👆 2
Jacob O'Bryant08:01:09

(to answer original question, you can do client side routing with reitit, but that's more a thing you'd use if you're always using clojure script etc for the frontend)

macrobartfast08:01:57

Well (and I hardly know what I’m talking about)… my app content changes when a menu item is clicked… but hard refreshing the browser page returned me to the state prior to the menu item click. That made me realize a link to, say, https://foobar.tld/app/some-detail-page may not get me there. However, I may have gone the wrong way about setting up the menu link to some-detail-page in the first place. I just just swapped the returned htmx onto a target that was the main div of my SPA.

macrobartfast08:01:43

Actually, I’m pretty embarrassed: https://biffweb.com/ clearly has all this sorted out.

macrobartfast08:01:09

It seems to reload on clicking, say, Docs… at any rate, I need to just study what’s going on there.

macrobartfast08:01:14

tl:dr I was asking about client side routing in my clumsy efforts to implement routing in general.

Andreas Edvardsson12:01:36

Someone in this channel shared a link to a book which I found helpful, it’s about building dynamic webpages with htmx. I found hx-boost takes care of most of my page-navigation concerns. Check out chapter 6 if you don’t have time to read the entire thing - here’s a direct link: https://hypermedia.systems/book/htmx-in-action/

Jacob O'Bryant20:01:15

http://Biffweb.com is just a regular static site, no htmx there 🙂. As far as navigation is concerned, it might help to think in terms of regular multi-page sites, with a different route for each page, rather than htmx. and then mainly use htmx for state changes within a particular page (for example, hitting the like button on a post).

macrobartfast20:01:56

Thank you! That’s helpful.