As an experienced CMS website operation personnel of an enterprise security company, I fully understand the importance of efficient content management in a multi-site environment, especially the need to batch import a large amount of content into a specific site.The multi-site feature of AnQi CMS provides powerful flexibility for content operation, and the batch import capability further improves work efficiency.
Here is a detailed guide on how to batch import content into a specific site of AnQiCMS multi-site.
How to batch import content into a specific site in AnQiCMS multi-site?
The multi-site management feature of AnQiCMS allows users to manage multiple independent websites in a single system.When you need to fill a large amount of content for a specific site manually one by one, it is obviously inefficient.Fortunately, AnQiCMS provides a content import API interface, making it possible to import batch content into a specified site.
Preparation
Before you embark on the bulk content import, there are several key preparation steps that need to be completed to ensure the smooth process and the accuracy of the data.
First, make sure that your AnQiCMS multi-site environment is properly set up and running.This means that you have already created the target site you want to import content into in the AnQiCMS backend through the "Multi-site Management" feature, and the site can be accessed and managed normally.If you have not set up multisite, you can refer todocker-bt-proxy.mdorinstall.mdThe tutorial is completed in.
Next, you need to have a clear understanding of AnQiCMS's content model. AnQiCMS supports a flexible content model (help-content-module.md), including the default "article model" and "product model", as well as models that you can customize according to your business needs.Understanding the field structure of these models is the key to correctly mapping the data you are about to import.
The third point, and the most critical one, is to obtain the unique identifier of your target site.siteId. ThissiteIdIs AnQiCMS the key to distinguishing different sites when handling multi-site data.You can find the ID of each site in the "Multi-site Management" list on the AnQiCMS backend.In subsequent API requests, you will need to explicitly specify thissiteIdTo guide the content into the correct site.
Finally, prepare the content data you want to import. This data is usually organized in structured file formats (such as CSV or JSON) to facilitate programmatic reading and processing.Ensure that your data fields correspond to the AnQiCMS content model fields for accurate import later.
Core strategy: Utilize the content import API interface.
One of the advantages of AnQiCMS is its powerful extensibility, which includes the ability tov2.1.0newly added 'article, product import API interface' in versionchangelog.mdThis is the most effective and flexible way to implement content batch import, especially for specific sites.Through the API, you can write scripts to programmatically push a large amount of structured content accurately to the AnQiCMS site you specify.
To make use of this feature, you first need to access the "Function Management" menu on the AnQiCMS backend and find the "Content Import Interface Management" (help-index.md). It usually provides detailed instructions or necessary parameters on how to configure and use the import API.
When importing content through the API,siteIdParameters play a crucial role. Many template tags of AnQiCMS, such astag-/anqiapi-archive/142.htmlandtag-/anqiapi-archive/141.html, are explicitly mentioned.siteIdThe parameter is used to call data from a specific site in a multi-site environment. This indicates that when performing content import, you must explicitly include the target site in the API request.siteIdTo ensure that the content is routed correctly to the specific site instead of the default site or other sites.
Detailed import steps
We will divide the process by using the API interface,