2 ms·
It all comes down to: 1. If two users access the same page, do they see the same content? 2. How often do you update the content of the website? The rea
by bbx 7y ago
It all comes down to:
1. If two users access the same page, do they see the same content?
2. How often do you update the content of the website?
The reason to ask yourself 1) is to know if the content has to be generated on the fly. If it's a blog post or a hospital "about" page, then the content is the same for everyone. There is definitely no need to fetch it from the database on every page load. Like Eric says, "get it down to static HTML and CSS".
Cases where the content is dynamic are social networks (FB, Twitter), search engines (Google, any ecommerce search feature), and any logged in content (cart, likes, friends…). For the latter, I've seen cases where the logged in content is only fetched via JS after the initial page load. This hybrid solution probably saves a lot of bandwidth.
The reason to ask yourself 2) is to know how long, as a content creator, you are willing to wait between updates. I can imagine that updates to a blog post or a hospital "about" page are allowed to take several minutes. In that case, static websites are favourable.
I guess the waiting time is correlated with the amount of updates: the higher the amount of updates, the shorter the waiting time you would want.
The reason why CMSs like WordPress are still popular is because of their ease of use. I've had several clients ask me specifically for a WP solution. I guess the issue is that it's hard to detach the dynamically-created content from a dynamically-served website. There are cache plugins, but I'm still looking for a custom solution where WP is only used as a non-public CMS, that then, at a push of a button, gets generated into a static website (or even a Gatsby one).
- joppy 7y agoThere is a lot of room between “generate everything from the database on page load” and “fully static site”. We could expect many people editing crucial sites at this time are not so technically literate, under time and other pressure, and do not have the spare time to learn something completely new such as authoring a static site. Given those criteria, I think a better solution to these problems would be some sort of caching layer, either built in to the CMS or perhaps a different server acting as a reverse proxy.