3 ms·
> If "dynamic" means "the content comes from a database", as in Drupal or Wordpress "Dynamic" simply means that you aren't serving a static file from your serv
by n4bz0r 5y ago
> If "dynamic" means "the content comes from a database", as in Drupal or Wordpress
"Dynamic" simply means that you aren't serving a static file from your server, but - in case with Wordpress and Drupal - pulling all the requests through a script that processes them, and returns generated plaintext data (HTML/XML/whatever) every time.
If you move the response-generating script/software from your public web server, and only upload plain HTML files there, you get what's called a "static" site.
If you don't get why people add an additional "build" step to turn their "dynamic" sites into "static" ones, here are a couple of common selling points:
- You get to maintain less moving parts on your "production" server and reduce the load
- You can get rid of your public server altogether, and host your "static" site on GitHub pages or a similar 3rd party service. In this scenario, content management and build process would take place on some other (remote or local, doesn't matter), "dynamic" server
with the interpreter installed
Hope that clears things up a bit.
Edit: I failed to mention that most static site generators (I heard of) build the entire site at once. A snapshot of the site (an artifact) is being built, thus the "build step" naming.
Edit2: Removed some things that are besides the point.
- denton-scratch 5y agoThanks for the clear explanation. I understand why one would render the entire database to HTML; that's what we used to do on our servlet-based CMS. What I was unclear about was the static/dynamic terminology. Now it's clear.
- amatecha 5y agostatic: HTML, CSS, images, JS, all served from the server's filesystem to the site visitor over the network. no server-side code execution to generate the page content. dynamic: non-HTML server-side code (PHP, Perl, Ruby etc.) is evaluated/executed to generate site content which is then sent over the network to the site visitor. this may involve hitting databases to get content for the requested page, or even make network queries for integrations with other services (social media feeds, payment processor sessions, etc.). the server then returns the generated HTML to the visitor. I just realized these two Wikipedia articles summarize the two different approaches quite well: https://en.wikipedia.org/wiki/Static_web_page https://en.wikipedia.org/wiki/Static_web_page https://en.wikipedia.org/wiki/Dynamic_web_page https://en.wikipedia.org/wiki/Dynamic_web_page