Why are static pages kept in a database for CMSes like Drupal or WordPress?

A bunch of work is done for static pages that will not contain dynamic data, such as, contact, about us, home, etc. that can be updated fairly easily if the designer/developer has access to a site. Why is it a better practice to keep that information in a database that must construct the data on the regular?

Related posts

Leave a Reply

3 comments

  1. If one thinks in terms of templates and a website administrator who is a lay person, then the database format in Content Management System makes more sense, because all the person has to do, for example, in order to change contact details on the Contact page, or change some updates on the Homepage, is to go into the CMS. It will be set-up in a Form type of look, that only needs filling in and submitting. The initial cost for a small static website with a CMS setup will be higher of course. However, if your homepage needs regular updates, it might be worth having a CMS. If there are very little changes throughout the year, one may opt to hire designer/developer services.

    Rather than best practices, I would see it as cost and demand.

  2. Because putting the content in the database and dynamic generation a the pages for each requests solve a lot of other issues. Cache invalidation is a hard problem. A static site where every page is build with different pieces of content from multiple sources (in Drupal: blocks, users, nodes, taxonomy terms, etc.) is like a gigantic cache.

    But if you don’t need the flexibility and the features of the CMS (like letting nearly non-technical users edit pieces of content), then don’t go with CMS.

  3. “A bunch of work is done for static pages that will not contain dynamic data, such as, contact, about us, home, etc. that can be updated fairly easily if the designer/developer has access to a site. Why is it a better practice to keep that information in a database that must construct the data on the regular?”

    There are probably 3-4 key points to consider here.

    First, why do people use WordPress? In many cases it’s because they aren’t web developers themselves and they don’t want to have to hire one every time their board of directors (say) changes. I have several clients in this category. By putting the content in the database and rendering it in a template, non-technical users can manage their own pages as well.

    Second, consider how easy it is for someone like you to create several static pages and simply use WordPress to power the blog. There are no shortage of startups and small businesses (especially in the tech space) that do that. Use something like Wappaylzer to see what folks are using.

    Third, it’s not a best practice to keep static information in the database. That’s why page caches exist (along with static asset and opcode caches… no one recommends recomputing things unnecessarily as a performance best practice)

    Fourth, consider the implication of removing the ability to edit pages from users. Or requiring them to know HTML. And if we start dealing with revision management as well, they might also need to learn Git. I for one hate having to help clients solve problems that they really should be able to solve themselves. I’m much happier if they can manage the simple things on their own. They tend to be happier with their websites, and I tend to get more interesting projects… good all the way around.

    In sum, it’s not a best practice for some people. Which is why some people don’t do it that way. It’s not a best practice to return to the database for static assets either, which is why folks who are reasonably aware of caching don’t do it that way. But it is a good practice, at least, to let folks have greater control over their websites. It comes at a cost, and it’s not right for everyone. But it certainly is right for a lot of people…. and maybe a lot more than simply “right.” I think you could go so far as to say it’s empowering, and one of the best things about WordPress in general