Live data from Hacker News

The theory versus the practice of “static websites”

utcc.utoronto.ca

21–30 of 221 posts

Re: The theory versus the practice of “static websites”

#21
From the perspective of a developer, I think the distinction is pretty clean and lies in the abstraction provides by the web (by which I mean hypermedia served over HTTP/S).

The semantics of that abstraction are that requests come in to a specific path with headers and a body, and then responses are sent back out with headers and a body. The intermediate networking details like TLS are hidden. In fact, more and more things are being hidden from the developer, with most modern frameworks automatically managing authorization sessions and request headers. Within that abstraction, the standard "static doesn't depend on request/state, dynamic does" is pretty clean, but it does rely on the semantics provided by the abstraction.

It's a little bit like TCP being a connection-oriented protocol over a fundamentally packet-based underlying infrastructure. I can use TCP for applications that require stream-like or packet-like data transfer. Then you could argue that "in reality, the distinction doesn't exist because it's built on IP which is packet-like". Sure — but you'd be on the wrong layer of abstraction.

That's not to say the article doesn't make a good point. As developers, we should certainly always keep in mind the underlying statefulness of "stateless websites". It's always good to know your abstractions a few layers deeper than you think you need.

Re: The theory versus the practice of “static websites”

#22
post #3

I run a content website for a living. This year I switched from Craft CMS to my own static site generator. I no longer think about the server or the CMS. I no longer need to keep it updated. I got rid of the heavy database and the elaborate caching setup. Now it's just a static file server. If it was just the blog it would be even easier to host. The website is more reliable and requires virtually no maintenance. The…

Static makes so much sense for sole-author sites with technical owners.

Would be great to make the tech more accessible to those without the skills to recompile and deploy. It's such a fast and affordable way to build websites, but existing tools like Hugo assume a lot from users that can put the tooling out of reach.

(Enjoyed your write-up too. I wrote the original version of html-to-markdown that you used in your migration; it's great to see it's still useful.)

Re: The theory versus the practice of “static websites”

#23
post #2

I’m skeptical cheap and easy is something inherent with static sites. I think a dynamic setup can have both those qualities, but there isn’t yet CMS/blog software that hits the sweet spot: self-contained, simple to setup, manage, and host.

Publii is a nice, easy to use, self-contained GUI for creating static websites. And Open Source, too.

[deleted]

Re: The theory versus the practice of “static websites”

#24
Seems obvious enough: a static website runs no server-side code to generate content, because the content is already complete. Perhaps more debatable, but I would also say no client-side code should be used. Just HTML, CSS, and static media files.

FWIW for my personal site, I run my own web server, which is incapable of running server-side code. It just copies files to sockets, nothing else.

Re: The theory versus the practice of “static websites”

#25

Seems obvious enough: a static website runs no server-side code to generate content, because the content is already complete. Perhaps more debatable, but I would also say no client-side code should be used. Just HTML, CSS, and static media files. FWIW for my personal site, I run my own web server, which is incapable of running server-side code. It just copies files to sockets, nothing else.

I think the key point that the original article was making was that there is server side generation going on - some server still needs load the file and turn it into an HTTP response, with all the correct headers, metadata, etc, and with the correct failures when the file can't be found. This server-side code needs to be implemented (and configured, etc) somewhere.

That said, as the second article points out, static vs dynamic can still be a useful abstraction layer, as static servers like nginx and Apache are so solid that you can usually just treat them as part of the basic HTTP infrastructure.

Re: The theory versus the practice of “static websites”

#26
post #2

I’m skeptical cheap and easy is something inherent with static sites. I think a dynamic setup can have both those qualities, but there isn’t yet CMS/blog software that hits the sweet spot: self-contained, simple to setup, manage, and host.

There are so many out there these days. It seems more likely to me that you just haven't found a static site generator which suits your workflow and technology preferences.

Re: The theory versus the practice of “static websites”

#27

As an "outsider" who dabbles in wasm I never understood why running custom code on the server to generate "dynamic" webpages would be better then a dumb server which just serves files, and the dynamic part is running in the browser instead (other then that 90's web browsers sucked for this type of stuff). E.g. nothing will ever beat a dumb file server with a cdn in front when it comes to simplicity and scalability.

I've had sites where I just write in Markdown and rsync it to a webserver. All pages were rendered dynamically. The advantage was that I set it up once then literally never care about a website again and just write in my beloved Markdown.

It was great. Until the webhost took away PHP anyway.

Re: The theory versus the practice of “static websites”

#28
post #3

I run a content website for a living. This year I switched from Craft CMS to my own static site generator. I no longer think about the server or the CMS. I no longer need to keep it updated. I got rid of the heavy database and the elaborate caching setup. Now it's just a static file server. If it was just the blog it would be even easier to host. The website is more reliable and requires virtually no maintenance. The…

Static makes so much sense for sole-author sites with technical owners. Would be great to make the tech more accessible to those without the skills to recompile and deploy. It's such a fast and affordable way to build websites, but existing tools like Hugo assume a lot from users that can put the tooling out of reach. (Enjoyed your write-up too. I wrote the original version of html-to-markdown that you used in your m…

Products like [decap CMS](https://github.com/decaporg/decap-cms) try to bridge that gap, but I agree that this space needs to be further developed. In fact I think there needs to be a bunch more work to allow mere mortals to use version control and branch workflows in day to day work.

Re: The theory versus the practice of “static websites”

#29

As an "outsider" who dabbles in wasm I never understood why running custom code on the server to generate "dynamic" webpages would be better then a dumb server which just serves files, and the dynamic part is running in the browser instead (other then that 90's web browsers sucked for this type of stuff). E.g. nothing will ever beat a dumb file server with a cdn in front when it comes to simplicity and scalability.

Not everything can be done in a browser.

You might want to store user-submitted content in a database, for example. Or you might want to do authentication. You might want to provide full-text search in a multi-gigabyte dataset. You might want to provide an interface to something which can't be accessed from a web browser. You might want to validate user-provided input.

All of those require custom code running on a server. So now you have to take whatever data you have on the server, translate it into a well-defined custom transfer protocol, send it to the client, translate it back, and finally turn it into html. And the same for the other direction, but now you suddenly have to do input validation on both the client and the server to prevent anyone creating a custom client from doing anything malicious.

Or you can just turn it directly into html on the server and be done with it. It's a lot less work, and provides basically the same experience for most applications.

Re: The theory versus the practice of “static websites”

#30

Big fan of NextJS and its static page export for that reason. I build and deploy just static .html/.js/.css to whatever CDN or static webserver of my choice. Since all indivudual pages/routes are pre-rendered during build, the first load is blazing fast and indexable by search engines. Also the way NextJS chunks the .js code and pre-loads contributes to the fast-load experience. For rich functionality you can interfa…

This is incredibly complex for many static site use cases (i.e. blogs, documentation, marketing pages). Most don’t need JavaScript let alone React/JSX/Middleware/SSR/et al. I can’t imagine the long-term maintenance of something with so many moving parts and npm dependencies. Not saying there’s not a use case, but we should KISS before jumping to projects with a 1.8 GiB Git checkout & 828,128 LoC just to make a landing page.
Post reply on HN