Infinite scroll with HTMX in Drupal. #HTMX #drupal
https://dri.es/infinite-scroll-with-htmx
jinja2-fragments now has proper #Starlette support: https://jinja2-fragments.readthedocs.io/latest/framework_integrations.html#starlette-integration
If you are using #htmx with Starlette, this might be of interest to you :)
jinja2-fragments now has proper #Starlette support: https://jinja2-fragments.readthedocs.io/latest/framework_integrations.html#starlette-integration
If you are using #htmx with Starlette, this might be of interest to you :)
Looking for some help with interaction issues between NGINX, HTMX, and GoToSocial.
The issue
My GET request from my website HaugenHus | Now Test
hx-get="https://fedi.haugenh.us/@kaleb/feed.rss"
hx-headers='{"Accept": "application/feed+json"}'
…is returning two basic CORS errors:
- [Error] Request header field HX-Request is not allowed by Access-Control-Allow-Headers.
- [Error] XMLHttpRequest cannot load https://fedi.haugenh.us/@kaleb/feed.rss due to access control checks.
…that I can’t figure out how to resolve.
Things I’ve tried
I ’ve added
add_header 'Access-Control-Allow-Origin' 'https://fedi.haugenh.us';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, HX-Request';
to my nginx.conf (actually I’ve imported it from another .conf and verified that the config is being included with nginx -T), but it has no impact on the errors.
I have confirmed that the page loads successfully including the remote JSON when I set my browser to ignore CORS.
Additionally, I am able to successfully load the remote feed.rss when I use the hx-request='{"noHeaders": true}’, but doing so returns XML rather than the desired JSON due the JSON Feed implementation in GoToSocial RSS
TIL htmx is is coming out with version 4. Some updates will include out-of-the-box streaming response and SSE support, among other things...
#htmx v4 is in alpha: https://htmx.org/essays/the-fetchening/
#htmx v4 is in alpha: https://htmx.org/essays/the-fetchening/
</> Htmx – The Fetch()ening
https://htmx.org/essays/the-fetchening/
#HackerNews #Htmx #Fetching #WebDevelopment #JavaScript #Frontend #Technology
Do you like RSS, Python, and web development? Do you want to start contributing to FLOSS?
This is my personal RSS reader (running locally only), opened as a FLOSS project. There's a lot that I plan to add to it, but I don't have so much time for now. However, it might be interesting to some folks, at least for learning purposes. So, here it goes.
MESH: I tried HTMX, then ditched it - Alex Moon
「 My big problem with HTMX, as it stands, is that it lacks that structure. Taking a look at HTMX the first time, my reaction was: "...so, declarative jQuery." I could see, as if before my very eyes, the spaghetti that inevitably grows out of a library like this. HTMX leaves it up to the developer to impose discipline on their code, however they see fit 」
More #HTMX news for #Drupal, how to make cascading selects in Drupal: https://tresbien.tech/blog/how-use-htmx-forms-drupal-113/
More #HTMX news for #Drupal, how to make cascading selects in Drupal: https://tresbien.tech/blog/how-use-htmx-forms-drupal-113/
Recently I got sufficiently annoyed at authoring posts in two places so that they were visible both here and on HaugenHus: Now – this is also in part because I prefer to write in Markdown which GoToSocial handles marvellously – that I decided to start looking at options. Of course there are many, but I chose to pursue an exclusively client-side solution with a static pageset to lighten the load on my little Raspberry Pi.
I landed on a solution built on HTMX + GoToSocial:RSS + XSLT which can be seen on HaugenHus: XSLT Test, but was horrified to find that after 26 years Firefox hasn’t managed to solve for HTML within an XML node. Of course it’s easy to get frustrated with a second-rate browser like Firefox 😁 – WebKit all the way baby! – but why bother when someone else has keep the flame war burning for 24 years Bug 98168 🤣. Of course with every ugly battle there are some heroes, and Scott Trenda was clearly one of these both offering a viable workaround and serving as a calm voice of reason.
So with a viable workaround to my XSLT woes, why haven’t I finished this little project? Well, there are two reasons: the first is that a workaround should never be allowed to become a permanent solution; and secondly, my WebKit enthusiasm may have been misplaced. It turns out that the fine folks over at Apple – @annevk – have expressed interest in killing my XSLT dreams 🥺.
With all of that said, what I found most interesting about this whole thing is that while I have been aware of XSLT for years, I unknowingly decided to play with it just as a storm appears to be brewing. Eventually I will get over my desire to minimize my dependence on JavaScript, but until then I’m sure there many other ways to solve this problem. I might just need to change the constraints.
(Maybe @gotosocial@superseriousbusiness.org would give us JSON Feed . . . feature request incoming after a bit more research 🤓.)
Additional Reading
XSLT Debate Leads to Bigger Questions of Web Governance
#Now #XSLT #Firefox #WebKit #GoToSocial #HTMX #RSS #JSONFeed
Recently I got sufficiently annoyed at authoring posts in two places so that they were visible both here and on HaugenHus: Now – this is also in part because I prefer to write in Markdown which GoToSocial handles marvellously – that I decided to start looking at options. Of course there are many, but I chose to pursue an exclusively client-side solution with a static pageset to lighten the load on my little Raspberry Pi.
I landed on a solution built on HTMX + GoToSocial:RSS + XSLT which can be seen on HaugenHus: XSLT Test, but was horrified to find that after 26 years Firefox hasn’t managed to solve for HTML within an XML node. Of course it’s easy to get frustrated with a second-rate browser like Firefox 😁 – WebKit all the way baby! – but why bother when someone else has keep the flame war burning for 24 years Bug 98168 🤣. Of course with every ugly battle there are some heroes, and Scott Trenda was clearly one of these both offering a viable workaround and serving as a calm voice of reason.
So with a viable workaround to my XSLT woes, why haven’t I finished this little project? Well, there are two reasons: the first is that a workaround should never be allowed to become a permanent solution; and secondly, my WebKit enthusiasm may have been misplaced. It turns out that the fine folks over at Apple – @annevk – have expressed interest in killing my XSLT dreams 🥺.
With all of that said, what I found most interesting about this whole thing is that while I have been aware of XSLT for years, I unknowingly decided to play with it just as a storm appears to be brewing. Eventually I will get over my desire to minimize my dependence on JavaScript, but until then I’m sure there many other ways to solve this problem. I might just need to change the constraints.
(Maybe @gotosocial@superseriousbusiness.org would give us JSON Feed . . . feature request incoming after a bit more research 🤓.)
Additional Reading
XSLT Debate Leads to Bigger Questions of Web Governance
#Now #XSLT #Firefox #WebKit #GoToSocial #HTMX #RSS #JSONFeed
Do you like RSS, Python, and web development? Do you want to start contributing to FLOSS?
This is my personal RSS reader (running locally only), opened as a FLOSS project. There's a lot that I plan to add to it, but I don't have so much time for now. However, it might be interesting to some folks, at least for learning purposes. So, here it goes.
https://social.coop/@smallcircles/114878688112419149
You might have a look if maybe there isn't a cool combination to make with #Datastar at https://data-star.dev which recently went v1.0
They continue where #HTMX stopped, in #hypermedia land, where they use #WebComponents for complex UI.
Put together a pretty cool live @ListenBrainz widget on my website! Auto-updates every 10 seconds, and shows as much metadata as I can cram into the widget space. All that metadata is the bonus of ListenBrainz being so closely tied to MusicBrainz
(and don't worry, I have some pretty aggressive caching so I won't hammer the ListenBrainz or MusicBrainz APIs)