Live data from Hacker News

Building websites with lots of little HTML pages

blog.jim-nielsen.com

21–30 of 88 posts

Re: Building websites with lots of little HTML pages

#21
post #18
post #6

Views transitions are very useful in content-first websites. I've used them extensively when working on https://stack.lol Try and navigate through pages, or change the language, and you'll get these neat effects "for free". Frameworks like AstroJS also help a lot as they facilitate using view transitions.

Sorry to report this doesn’t work well on mobile Safari. Tapping one of the items in the list causes mayhem. Going ‘back’ causes stuff to flicker all over the screen.

Didn't try on Mobile Safari. That's on me. Going to fix that one.

Kudos to you for reporting it so nicely.

Re: Building websites with lots of little HTML pages

#22
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…

I think PHP was brilliant, and to this day is still an underrated model, but as websites grow in complexity, particularly around data and access controls, The model needs to be inverted. When logic gets sprinkled throughout templates, it can turn into an unreadable nightmare. Personally, I think ERB in Ruby with Sinatra or rails really nailed The approach.

Re: Building websites with lots of little HTML pages

#23
post #11

Old school web tech is the best. I still reach for multipart/form-data every day. Many of my web applications do not even have javascript. I hope at some point the original pattern is re-discovered and made popular again because it would make things so much snappier: 1. Initial GET request from user's browser against index and maybe favicon. 2. Server provides static/dynamic HTML document w/ optional JS, all based up…

What exactly do you mean by "part of the same context"?

Re: Building websites with lots of little HTML pages

#24
> "I build separate, small HTML pages for each “interaction” I want, then I let CSS transitions take over and I get something that feels better than its JS counterpart for way less work."

I'm not understanding how you are achieving the css transitions between what look like new page loads under the hood...Can you elaborate on how that works?

Re: Building websites with lots of little HTML pages

#25
Yes, rip out all the advanced coding skills and simply do it the way it was originally intended.

I have a single php file with a textarea. It creates pages or updates them. The textarea only displays the article. Everything above and below is removed and added again. When publishing it adds the article to the index.html archive-2025.html and tagname.html pages. I haven't bothered automating removal. If it ever happens I'll do it by hand.

The search engine is a bit odd, it is a 26x26 list of raw files named aa.html ab.html each bit in those refers to an article. If you type foobar it loads fo oo ob ba and ar.html then performs and AND on the files. What html's remain are loaded and searched for foobar.

I should really store everything in a db in stead. (Just for searching)

Edit: near zero maintenance over two decades. One instance where the host upgraded php and the editor stopped working but the website worked just fine so it doesn't really count.

Re: Building websites with lots of little HTML pages

#26

> "I build separate, small HTML pages for each “interaction” I want, then I let CSS transitions take over and I get something that feels better than its JS counterpart for way less work." I'm not understanding how you are achieving the css transitions between what look like new page loads under the hood...Can you elaborate on how that works?

View transitions api, it's pretty new: https://developer.chrome.com/docs/web-platform/view-transiti...

Re: Building websites with lots of little HTML pages

#27

> "I build separate, small HTML pages for each “interaction” I want, then I let CSS transitions take over and I get something that feels better than its JS counterpart for way less work." I'm not understanding how you are achieving the css transitions between what look like new page loads under the hood...Can you elaborate on how that works?

View transitions api, it's pretty new: https://developer.chrome.com/docs/web-platform/view-transiti...

Surprisingly, Firefox of all browsers doesn't support it.

https://caniuse.com/view-transitions

Re: Building websites with lots of little HTML pages

#28
post #11

Old school web tech is the best. I still reach for multipart/form-data every day. Many of my web applications do not even have javascript. I hope at some point the original pattern is re-discovered and made popular again because it would make things so much snappier: 1. Initial GET request from user's browser against index and maybe favicon. 2. Server provides static/dynamic HTML document w/ optional JS, all based up…

You can also have both. Our apps are all spa. Bundled in single js, html and and js file. But we also have an ssr app runner that contains hundreds of thousands cached static html pages. Initial page load is from the ssr. Further interaction pure clientside. This way you have best app like experience and maximum seo. Setup is maybe 400 lines of code.

Re: Building websites with lots of little HTML pages

#29

> "I build separate, small HTML pages for each “interaction” I want, then I let CSS transitions take over and I get something that feels better than its JS counterpart for way less work." I'm not understanding how you are achieving the css transitions between what look like new page loads under the hood...Can you elaborate on how that works?

View transitions api, it's pretty new: https://developer.chrome.com/docs/web-platform/view-transiti...

Very cool, thanks!

Re: Building websites with lots of little HTML pages

#30

the web is so built for this. when you go to sites like this it just feels right. we could have had this as our future instead of the craziness of javascript and nextjs and react. now some new devs dont know html exist. they think react is the web.

imagine what the future could have been if the html spec was enhanced to support the features of htmx rather than the push for javascript enhancements.

We may have had a future without javascript ever running on a server.

Post reply on HN