How should static site generators and dynamic CMS be分工?What items should a corporate website look at?
Which one should be used for the corporate website, a static site generator or a dynamic CMS? It can be determined by dividing the frequency of content updates and the people who make changes: if the changes are only made by developers and the update rhythm is low, it is cost-effective to use a generator; if the columns will increase and content will be added every day, and non-developer colleagues need to do it themselves, it is cost-effective to use a dynamic system. Most of the problems with the corporate website are not performance, but rather that it takes a round of build and release to update the content once, and in the end, no one dares to make changes. Below are the comparisons of four capabilities and the division of labor when mixed.
The fundamental difference: when does content become a page
The generator route calculates all content into page files when published, and the server sends out the ready-made files directly during access, without participating in content assembly. Taking Hugo as an example, the official documentation provides a workflow of executing the build command in the project directory, outputting the products to the public directory, which contains the generated page files.
The dynamic system route calculates on the fly during access: after the request comes in, the page is assembled according to the column, template, and data and then returned. The cost is an additional calculation, but the benefit is that changes in content take effect immediately, and different content can be returned according to the visitor's status.
Summarizing: The generator places the cost at the time of release, while the dynamic system distributes the cost over each access. Content changed ten times a day is cheaper when distributed over access; changed once a month, it is more convenient to concentrate on release.
The cost saved by the generator and the additional cost
The savings are very real: there is no need for the database to participate in rendering, no need for a resident application process, a large piece of dynamic entry point on the attacked surface is less, the page itself is a file, and the delivery layer almost does not require optimization.
The cost of adding new features is often overlooked: each change requires rebuilding and deployment, and the build time increases with the number of pages; forms, search, and comments require external services to complement these dynamic capabilities; non-developer roles need to submit and trigger a build for a single line of text change; when the content structure is complex, maintaining the relationship between data files and templates is almost as difficult as maintaining code.
The four capabilities that need to be considered in a dynamic system
Can the content structure be customized? Categories, product parameters, case information, etc., if they can only be written in the main text, it will not be possible to filter and list on the later pages. Support for custom content models and custom fields can clearly define content types in the background without having to change the code every time the structure is changed.
The second item is whether non-development colleagues can make changes themselves. Daily actions such as background publishing, scheduled publishing, draft preview, and trash recovery should be completed in the interface, and it should not be necessary for people to find files.
The third item is resources and carrying capacity. The cost of dynamic rendering depends on the implementation, the system implemented in Go language usually consumes less memory than common scripting systems, the official figure is that the memory is reduced by about 80% compared to PHP-like systems, and the single machine can carry about 5 million PV——note that these two numbers are approximate, used to see the magnitude rather than for accounting. It has practical significance when running databases and other services on the same machine.
Is the address and delivery rule maintainable on the backend? If the configuration such as pseudo-static rules, redirect table, and site map generation can only be changed in server files, the cost of modification will be very high. The deployment side also needs to consider the scope of support: whether mirror deployment and panel deployment are both feasible, and how to coordinate the default listening port and reverse proxy.
A judgment table
| Judgment conditions | A generator | A dynamic system |
|---|---|---|
| Content update frequency | Within a month | Multiple times a week or every day |
| Person responsible for changes | Development | Operations and marketing |
| Total number of pages | Build time acceptable within thousands | Continuously growing, build time is uncontrollable |
| Dynamic capability | Forms and search can be externally connected | Membership, order, and comment required |
| Applicable scenarios | Document site, activity page, foreign trade landing page group | Enterprise website, marketing website, portal |
When should both be used together
Common division is: hand over the stable and unchanging marketing landing pages, document center to the generator route, the main station and content updates to the dynamic system, both sides share a set of domain names and navigation. When mixed, the address rules should be unified on one side, and the jump table and site map should be output by the dynamic system on this side, otherwise the two lists will conflict. AnQiCMS supports various deployment methods such as Docker images and Baota panel, and when mixed deployment, it can take on the role of the side responsible for content and rules, and the generated products are placed in the static delivery layer.
Common questions
Will the generator site be safer? It has fewer dynamic execution entries, and the vulnerable surface is relatively narrow, but it still depends on the configuration and permission control of the delivery layer and the construction process, and cannot be equated to automatic security.
What will happen if the content volume increases? The construction time will increase with the number of pages, and when you need to rebuild the entire site after making a change, the release rhythm will be held up by the construction, which is the most common reason to shift to a dynamic system.
Is it difficult to shift to a dynamic system after choosing a generator? The content itself is in the files, and the migration mainly involves rebuilding the field structure into a content model, and completing the address rules and jump table, which is cheaper than reverse migration.