Feature preview

Feature Introduction

The static site generator only produces pages, where should the edited content be changed?

The static site generator itself does not come with an editing entry, content modifications are made in the text files of the code repository, after modification, it must be regenerated and pushed to count as going live. Changes requiring engineering intervention are usually of three types: field structure adjustment, template modification, and batch replacement. A content management system with a backend incorporates these three steps into the interface, custom fields determine which level of editing can be modified, visual template editing and batch import reduce dependency on code, and a draft preview can be used before publication.

Content Editing Static site

Feature Introduction

The static site generator only produces pages, where should the edited content be changed? The answer is in the generation process: The content is stored as text files in the code repository, the editing actions occur in the repository files or the accompanying editing interface, and the generator compiles them into static pages and then publishes the output.That is to say, it's not online yet after modifying the file; you must regenerate and push the product, and the version that users see is the new one. The project description reviewed that day clearly wrote the characteristics of this path: Hugo is a static site generator written in Go language, designed for speed and flexibility, and the output is a set of static pages.

Three-step process of static generation

The first step is content storage, usually a set of text files with metadata, fields written in key-value form at the top of the file. The second step is construction, the generator reads the template and content, and outputs the complete site directory. The third step is publishing, pushing the output to the hosting environment, and can use a content delivery network to be directly accessible to the outside.

The advantage of this chain is that the product is simple and there is almost no runtime overhead on the access side; the cost is that even changing a word also requires going through the build and release process, and successful build does not mean the content is correct, if it is broken, you need to roll back to the historical version.

What does the actual editing involve?

Depending on the type of change, the objects edited touch are not the same:

Type of change What needs to be changed on the static site Who will do it Common pitfalls
Correct the text and title Text file body and header fields What the editor can do Field name typo causes build failure
Add a new field Define the content structure and all related templates Engineering intervention is required The template is not adapted, the page displays blank
Change the style or layout Template file and static resources Engineering intervention is required Need to understand template syntax and build configuration
Batch replace wording Search and replace in the entire repository after re-building Engineering and editing collaboration Easily change the address and code snippet
Withdraw a piece of content Submit deletion and republish What the editor can do Old products are still being accessed in the cache

The content model is a boundary here: the field structure is defined by the program, the editor only fills in the content within the established structure, and the operation can be completed by itself; if the structure itself needs to change, it must return to the repository.

Three types of changes require engineering intervention

The first type is structural adjustment. Deleting or adding custom fields will affect the template values and list filtering, and you need to check all site references each time you make a change. The second type is template-level changes, including page structure, components, and interactions, and these changes also need to be verified to ensure that the generated page meets expectations. The third type is batch replacement and batch import: when making changes to dozens of articles at one time, the correct practice for a static site is to first run a trial build on a small branch, confirm the output before merging, and this step often requires engineering assistance to configure.

Before publishing, there is no intermediate state that can be rolled back, which is also a feature of static sites. To 'see the effect first', you have to rely on preview branches or local builds, and operations usually do not have access to these commands.

Which steps have been changed by the content management system with the backend?

After the editing entry is brought into the interface, the link will be shorter, and AnQiCMS (AnQi CMS) 's approach can be used as a reference sample:

  • The content structure is defined according to the content model in the background, fields can be configured, and editing is filled in the form, without needing to move the repository files.
  • The template modification may not change the code: Visual template editing and AI editing templates allow style adjustments to be completed in the background, reducing engineering queuing.
  • There is a special entry for batch content, batch import supports ZIP compressed packages and Excel spreadsheets in two ways, and dozens of articles can be imported at one time.
  • There is an intermediate state before going live: The document status is divided into draft, to be published, and official, the draft has preview parameters that can be used to preview the effect first, and the deleted items are in the recycle bin instead of being physically deleted.
  • The page is rendered at runtime, the build steps are skipped, changes take effect immediately, but the corresponding runtime environment usage and security protection need to be taken care of by yourself.

Two methods are not alternatives. Static sites are suitable for scenarios where content and access are controlled on the engineering side; there is a way with a backend that is suitable for sites with a fast operation rhythm, frequent changes, and many participants. The judgment point is very practical: is the content of the site changed every day, and will the person who makes the change use the command line?

Common questions

Can the editor not find the development to make changes by himself?It is possible to correct the text, title, and existing fields within the established content model; to add new fields or change the layout, engineering intervention is still required.

Generally, which layer is it when the changes do not take effect?Check in order whether the construction is successful, the product is published, and the cache is cleared, the most common in static sites are the last two layers.

Have you already used a static site, can you still configure an independent editing end?Yes, it can be achieved through the combination of a headless content repository and interface calls, the cost being that you need to maintain two chains of generation and publishing at the same time.

Related functions

Preview

The custom content model has added a new field, will the text of old articles not be readable

The custom content model adds a new field, which only affects the field level, the text of the old articles will not be unreadable: the new field is empty in the existing documents, the template reads an empty value instead of reporting an error. The real problem is that the template treats empty values as required items, and when importing in bulk, the column names are not aligned with the new fields. Backup before changing, migrate in batches by category, and you can still go back if there is an error.

Preview

Found the word violation after the manuscript was sent out, where did the content review intercept?

After the manuscript was sent out, it was found that the wording was违规, the problem lies in placing all the compliance checks after publication. The sensitive word filter takes effect when written, content review takes effect before publication, keyword replacement and full-site replacement are used to batch change existing expressions. The three defenses are each set at different steps, in conjunction with the status transition of draft, to be published, recycling station, to ensure that illegal words do not go online, and if they do, they can also be taken back.

Preview

Sixty percent of the submissions on unattended forms come from robots, should we add a hidden field first or put up a captcha first?

The form without protection has more than 60% of submissions coming from robots, the order to prevent spam is to add hidden fields first and then consider the captcha: hidden fields do not disturb real people, can block a large number of basic robots filling out templates, but cannot block manual replacement services; the captcha improves the interception limit but also increases the probability of real people being mistakenly rejected. Decide whether to add a second layer based on the number of complaints and the ratio of escapees.