r/learnprogramming • u/BigEmu9286 • Oct 30 '22
ELI5: What is a "static website"?
When looking at hosting services they say, "host a static site".
When I use create-react-app to make a site, is that a static site? Does that have anything to do with the public folder? Static images and such?
I've googled and read a thousand things but don't understand it in practice can someone eli5?
9
Upvotes
2
u/tiki854 Oct 30 '22
Simplest explanation: a static website does not take in any user input that would change the site.
For example, if you can click a button and that makes something rendered in the site change permanently, it's not static.
1
u/[deleted] Oct 31 '22
Ok, open a text editor, Notepad, if you're on Windows. Paste the following text into Notepad, and save the file as something like "page.html", somewhere you'll find it again.
Now double click the file and see your browser (the program you're viewing this reddit page in) display the title and the header-two element. That's a static site. It gets more complicated, of course. There's ways to change the colors, there's ways to make things animated. Last but not least, there's ways to make the page send data to a server, usually via https request. IF it does that, it's not a static page, but if it doesn't do that, it's a static page. Static, as in non-moving, from the perspective of the rest of the network.
These files are less expensive to work with, probably a fraction of a dynamic system, and all one's gotta do to host them is stick the file in a apache or nginx controlled server, voila, if the server is reachable, and your network doesn't block it, you can reach the page.
A page that isn't static is dynamic, it accepts input (for example in the form of http requests) and can vary its response to the input, for example if it looks up data and writes to databases.
Here's the text for your page.html
1
u/Logical_Strike_1520 Oct 30 '22
My understanding is that static pages don’t need any more information from the server once the page is loaded.
-2
u/tadcan Oct 30 '22
A static website was originally one built with just html and css, and displayed the content in a way that didn't change. A shopping website is not static since you can update the quality of the item you want to buy, which changes what the webpage is displaying to you.
0
u/[deleted] Oct 30 '22
[deleted] — view deleted comment