Live data from Hacker News

Building websites with lots of little HTML pages

blog.jim-nielsen.com

81–88 of 88 posts

Re: Building websites with lots of little HTML pages

#81

On a similar note, does anyone know if it's possible without JavaScript for a link or form or something similar to be submitted without the whole page refreshing and still being able to update some text? For example, the upvote, favorite, and reply actions on hacker news website. They all require a whole page refresh. Is it possible to achieve it without page refresh and without JavaScript?

Have you tried HTMX?

Re: Building websites with lots of little HTML pages

#82
post #12

I love this approach. I just wish there was better tooling for HTML polyglot programming. PHP got it right by embedding itself within "HTML" documents. React also got it right by inventing JSX. There's Go templ too. They all said "HTML deserves first class support". Why can't this DX also be available for other general purpose PLs? I want my Python language server to detect that this or that string is HTML, and provi…

Slowly but surely... PEP 750 (still a proposal) adds "t-strings" Python. They're a simple extension of f-strings that give developers access to the static and interpolated parts of the string before they get combined into a final string. They're Python's answer to JavaScript template literals. This allows writing code like: user_name = current_user.user_name # something user-supplied and potentially unsafe foo: HTMLE…

Great! Hope the proposal gets support.

Re: Building websites with lots of little HTML pages

#83
post #82

Earlier quoted context omitted.

Slowly but surely... PEP 750 (still a proposal) adds "t-strings" Python. They're a simple extension of f-strings that give developers access to the static and interpolated parts of the string before they get combined into a final string. They're Python's answer to JavaScript template literals. This allows writing code like: user_name = current_user.user_name # something user-supplied and potentially unsafe foo: HTMLE…

Great! Hope the proposal gets support.

Good news on that front! https://discuss.python.org/t/pep750-template-strings-new-upd...

Re: Building websites with lots of little HTML pages

#84

On a similar note, does anyone know if it's possible without JavaScript for a link or form or something similar to be submitted without the whole page refreshing and still being able to update some text? For example, the upvote, favorite, and reply actions on hacker news website. They all require a whole page refresh. Is it possible to achieve it without page refresh and without JavaScript?

Have you tried HTMX?

HTMX requires incorporating script which goes against my question.

Re: Building websites with lots of little HTML pages

#85
post #82

Earlier quoted context omitted.

Great! Hope the proposal gets support.

Good news on that front! https://discuss.python.org/t/pep750-template-strings-new-upd...

Wow, literally an hour after my reply. Joyous news. Thank you for your contribution to making this happen!

Re: Building websites with lots of little HTML pages

#86

On a similar note, does anyone know if it's possible without JavaScript for a link or form or something similar to be submitted without the whole page refreshing and still being able to update some text? For example, the upvote, favorite, and reply actions on hacker news website. They all require a whole page refresh. Is it possible to achieve it without page refresh and without JavaScript?

If you do not wish to use any javascript, you can use iframes and the "target" attribute on links and forms:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#...

However the user experience is pretty rough, which is why people typically don't use this feature.

If you want a minimal amount of javascript to achieve this, we (the htmx folks) also have fixi:

https://github.com/bigskysoftware/fixi

Finally, we are working on introducing general transclusion into the HTML spec itself with the triptych project:

https://github.com/alexpetros/triptych

however that is a ways off (if ever)

Re: Building websites with lots of little HTML pages

#87

Earlier quoted context omitted.

Did you end up getting notifications working with your PWA? That's something I've worried about

> However, when I was about to give up and abandon the entire project, I had one of those moments, and got it to work. Yes. So much relief. Although it was a bit more difficult than I thought it would be.

What was the trick?

Re: Building websites with lots of little HTML pages

#88
post #2

This is brilliant. Instead of a single page app (SPA), you can almost picture the connections between all these little .html pages as some sort of web.

One spanning the world, perhaps. Even ... widely.

Needs a shorter name. Maybe "WoWiWe"?
Post reply on HN