Feature preview

Feature Introduction

How to design custom fields for the content model so that you don't have to change the table halfway through.

The design of the content model's custom fields is not appropriate, and the common consequence is that you have to change the table halfway. This article proposes a three-step method: first, list the answer fields that need to be referenced separately, then define the field type and whether it is required, and finally confirm whether these fields can be read by the batch import and public interface. And explain the three most common points that are most likely to require a redo - frequent changes in field names, embedding display logic in fields, and ignoring the readability of interfaces.

Modeling Content Management

Feature Introduction

How to design custom fields of the content model without having to change the table, the answer is not in the field itself, but in the design sequence. Re-work often occurs when 'fields are built first, then found to be unreadable after import, interfaces cannot be retrieved, and filtering cannot be used', and then the table structure is changed back. To avoid this, three questions should be answered clearly before building fields.

Division of labor between content model and classification

First, distinguish between two layers: Categorization manages how content is grouped and appears in navigation; Content model manages what a category of content looks like - what fields it has and what type each field is. Custom content models solve the problem of 'one backend supporting multiple content structures', such as articles, products, and cases needing different field sets. Categorization is not enough often because the 'structural differences' are mistakenly placed in 'categorization differences'.

What are the three questions to answer in field design?

Is this field going to be referenced separately in the future? Being able to be referenced separately means that it needs to be an independent field rather than embedded in a paragraph of text. Information that needs to appear on the list page, in filter conditions, and in interface returns is considered 'to be referenced separately'.

The second question: Have the field type and required fields been determined? Text, numbers, dates, enums, and images each have their own storage and validation methods. If the type is set incorrectly, you will need to fill in historical data each time it is changed; if the required fields are set incorrectly, there will be large areas of key fields left blank. Enumerated values should be used preferentially over free text.

The third question: Can it be read from the batch import and public interface? This step is most likely to be skipped and is also most likely to be exposed when 'half done'.

What are the most likely return-to-work points?

The field name frequently changes. When the name changes, the template references, import mappings, and interface fields all follow suit. Field names should be determined according to 'meaning' rather than 'current page copy', and display copy and field names should be separated.

The second type involves embedding display logic into fields. For example, storing the styled result of 'Original Price + Strike-through' as a field is equivalent to embedding rendering into the data. A different display would require changing the data itself. Fields should only store factual values, and styles are handed over to the template.

The third type is to ignore the readability of the interface. The field is built in the model, but it is not returned in the public interface, so the front end and third parties cannot access it, making the field as good as non-existent. It should be confirmed in the design phase that it can be read in the interface documentation.

Can the interface and import read these fields?

These are the two trial stones for judging whether the design is right or not. AnQiCMS supports custom content models and flexible content structures, and the配套 batch import supports ZIP compressed packages and Excel tables—this means that new fields must have corresponding columns in the import template, otherwise historical content cannot be supplemented into the new structure. On the other side is the public interface, document content, categories and tags, and custom fields such high-frequency capabilities need to be called and read in the interface; the interface document determines whether the front-end and external tools can stably obtain these fields.

The sequence is therefore clear: first determine which fields need to be referenced → define the type and required fields → confirm that the import columns and interface fields can support → then go live with the model. In this way, the fields are established with a complete data path, rather than going back to fill in the table after it is completed.

Common questions

Question: Should we build a few fields first and add more later?Answer: Adding fields is safer than deleting fields, but each time you add, you need to fill in historical data, supplement import columns, and update interfaces. It's better to build a full set of commonly used fields that you can think of once, to avoid frequent table modifications.

Question: Should all information be made into custom fields?Answer: No. Only information that needs to be individually referenced, filtered, or read through an interface should be made into fields, the rest can stay in the text. Too many fields will slow down import and query.

Question: How can I correct a wrong field type?Answer: Create a new field of the correct type, migrate data, switch templates and interface references, and then abandon the old field. Back up before migration and check values one by one to ensure they are correctly converted.

Related functions

Preview

Is preventing data collection interference and rejecting scraping two separate things, and where do they each stand?

Preventing scraping interference code and rejecting crawling are not the same thing; they block at different levels. Rejecting crawling acts on request admission: depends on protocol declaration and server frequency limiting to decide whether to allow crawling. Interference code acts on the content layer: making the copied text not directly available. This article clarifies the differences in the objects covered by both, the scenarios where they fail, and the configuration cooperation between robots, interference code, and content review within the site.

Preview

Multiple sites share a single backend, which configurations and data should be isolated between sites?

Multiple sites share a common backend, the natural isolation is content and classification, which must be manually confirmed are domain and redirection, template and site parameters, and interface and high-risk operation permissions. This article decomposes the isolation boundaries into four layers: content layer is divided by site database tables or classification dimensions, display layer is bound by domain template, redirection layer avoids cross-domain redirection to cover each other, and permission layer tightens the whole site operations to explicit enable, and provides a configuration checklist for multi-brand and multi-language site scenarios.

Preview

Should the site description file for large models indicate the content validity, and how should it be coordinated with scheduled publishing?

Whether or not to mark the timeliness of content item by item in the site description file depends on whether it serves as navigation or conclusion. It is more like a directory for the model, where entries only need to clarify what is in this section and when it is worth taking. What really determines when content becomes visible to the outside world is the timing release and time factor within the site. This article introduces three ways to position timeliness information, as well as the refresh order between the description file and the timing release and site map.