Replies: 1 comment 1 reply
-
|
For a static file server, the simplest approach is to have <a href="/blog/my_post/" mu-target="#content" mu-source="#content">My Post</a>µJS fetches the full page but only injects the If you're using a static site generator, producing full pages should be straightforward. The tradeoff is a slightly heavier response than a bare fragment, but for a static site that's usually acceptable. That said, your use case is interesting. I'll think about adding a parameter to explicitly control the URL pushed to the browser history. No promises though! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've started using the following pattern (more like, hack tbh) to have a static SPA site that replaces fragments,
This works fine with HTMX because you can specify an URL for the apparent link and another for the fragment contents,
This way users only see the
/blog/my_post/path which works fine with the SPA redirect hack, and don't get to see the/blog/my_post/_.pathwhich is uglier and worse, would render a broken page without the needed skeleton to contain and style it.Currently the recommendation for µJS is to conditionally serve either the fragment or full page,
but when trying to serve from a simple file server this isn't possible and you must resort to serving from 2 different files.
Is there a way to work with a separate fragment file?
Beta Was this translation helpful? Give feedback.
All reactions