HTMX Out-of-Bound Swaps
2024-07-06
At this point in building this site, I had a bit of an issue. While I wanted to use hx-boost
to create a snappy “Read More” feature on the article cards, I also needed flexibility on how the boosted page looked in the list view, compared to its standalone look.
This produced some fairly… interesting results at first.
Maybe I could try to just send the bare fragment, but now the page is unstyled when viewed on its direct URL, as it’s missing the necessary meta attributes.
htmx-swap-oob to the rescue!
I just sprinkle hx-swap-oob
directives in a couple places…
And now only the content gets boosted into the article list view. Nice.