Hacker News new | past | comments | ask | show | jobs | submit login

There is still not a censuses as to the definition of a static website. Is a website without a MYSQL database still static if it has JavaScript or php template include files? A pure static website in which each page has to be manually edited would be a headache.



There definitely is a consensus on what static website means. Have you tried doing a basic Web search of the term?

> A pure static website in which each page has to be manually edited would be a headache.

There are static site generators for a reason.


Here's me waffling about this question for about four paragraphs, copied below for your reading pleasure :p :) (source: https://www.evalapply.org/posts/shite-the-static-sites-from-... )

> What is a static website?

> Static simply means as-is. Its inverse is "dynamic", meaning in-transit. The "static" part of "static website" corresponds to stored information. The "website" part corresponds to where from and how, the information gets to one's computer. A web-site is literally a place (site) on the World Wide Web, whence our computer has to fetch the information we want.

> Fetching information, such as a web page, over the Internet is "dynamic" by definition. Even just opening a file on your own computer's disk is "dynamic". The very act of reading a digital file, and/or transmitting it, means copying its bits from one place and showing them in another place 3.

> The Ultimate Static Site, is a file that once written never changes. Thus, once-received we never have to fetch it again (unless we lose it). Reality is of course not so simple. But we will work with the "static means never changing" mental model, because we can go pretty far with just that.


IME, the closest definition is simply a site containing flat files only. No server-side scripting, but client-side JavaScript very much allowed. That doesn't necessarily mean 'manually editing' each page, although some writing probably has to be done at some point, unless you're outsourcing that to an LLM...


What about fully client-rendered templates/sites that require JS for visualization? (ie, no graceful degradation at all).

Technically static, but absolutely of the worst kind in my opinion.


I totally agree — technically static, but an abomination that should be avoided at all costs!


An abominable default, sadly.


This is the first time I've ever heard of somebody being confused about this. If the server is serving dynamically generated documents, then it isn't static. A static website can be perfectly represented as a directory of files being served by python -m http.server. No PHP templates, that should be obvious.


I agree with you; not even SSI.


> There is still not a censuses as to the definition of a static website.

No server side scripting. OK to have client side scripting (e.g. JS). Basically, how things ran back in the 90's for most people who couldn't afford ASP or a paid web host.


Static website serves you everything you need as a one HTML file. You can save the source code and open it offline and there will be no difference.

As such any templating is out of the question if that is done via request from the client.

How I manage my static website is with a build script. I write my content in markdown with a option for custom header and then I have a python script that churns out pure HTML with everything embedded into it which I can then host on github pages.


This, but without the "one HTML file" restriction. Unless I misunderstood you—did you just mean "one HTML file per URL"?


IMO, the pages can be compiled statically on a static website, so the HTML doesn't need to be manually edited for each page. But yeah, I guess there are degrees of staticness. My (brand new) personal website is literally all written from scratch right now, but soon it will probably be pregenerated from Markdown sources. I would still call that static, but to a lesser degree.


Good question, with answers ranging from "a bunch of hand-edited HTML files" to "a set of HTML files generated from a non-HTML syntax such as a markdown derivative or a programming language's object-literal syntax", with the latter (static site generators) being quite different from the former.

And then there's also SGML which has everything HTML, as a last-mile markup language for delivery to browsers, assumed to have available for authors, such as text macros and shared fragments for eg. menus, auto-generating document outlines for page navigation, processing markdown into HTML, filtering into RSS or SERPs, etc., and even moderately complex dynamic site features such as integrating external/syndicated content and screening/validating user comments for malicious or other undesired input such as script, broken comments, external/spam links, and the like.


Surely a static web site is one that could be downloaded with something like wget or curl and would still work by browsing the files directly from the file system without needing an actual web server?


Thats what I expect a static site to be too. Along with preferably as little js as reasonable.


What?

A static website is a website that has no server side generation. That's how simple it is.


I would say a static website is just one that doesn't do any extra work on the client to generate the content. Either SSR or just plain HTML files


A dynamic website is generated by the server in response to client queries. Static websites—pre-existing flat html files served as-is to viewers—came first, then PHP and CGI made dynamic websites possible & popular. SSR is the very definition of a dynamic website. Client-side scripting came after dynamic websites, but it is not technically, in and of itself, "dynamic."


The trouble is defining what "the content" means. Are you saying "no JS" — if so, just say so! Otherwise, how are you distinguishing between "content" and ... "other stuff"?


> There is still not a censuses as to the definition of a static website

Static website can be served by `cat index.html`


> Static website can be served by `cat index.html`

For sure, but that's not a sufficient definition. You need to add some constraints to the contents of the html. Otherwise, you can put a huge javascript program in there that hallucinates a new page each time you render it. This shouldn't count as "static".


It generally does count as static though. In this context static has a technical meaning, not the dictionary definition. It's static from the server side, meaning that you don't need any special logic to serve it.


> This shouldn't count as "static".

Why not? If it doesn't, where do you draw the line, apart from "absolutely no javascript at all"?


That's a good line to draw!

Static = no scripting (either server-side or client-side)


I'd like to reserve the term "no scripting" for that :) I guess if we popularise the term "no backend", the two could co-exist. I want to talk about sites that are just a collection of flat files, with no server-side processing; for me, "static" does that job perfectly.


That is static though. It may not conform to a particular notion of aesthetic purity, but a website is static if and only if you can serve it from a static file server. Client-side scripting is orthogonal to that.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: