How to create and manage custom content models in AnQiCMS and add specific fields to them?

Calendar 👁️ 65

In daily website operations, we often encounter the need to publish various types of content.In addition to common articles and product displays, you may also need a dedicated 'event list' to post the latest activities, or a 'team members' page to showcase the core team of the company, and even a 'successful case' module to share project experience.AnQiCMS (AnQiCMS) has fully considered this flexibility in its design, providing powerful custom content model functions, allowing us to flexibly create and manage different types of content structures according to our actual business needs.

How can you create and manage these custom content models in Anqi CMS, and add dedicated fields for them? It's actually simpler than you might think.

Build your content skeleton: Understand and create custom content models

The content model can be understood as the 'skeleton' or 'blueprint' of different types of content.It defines what basic information each content should contain, such as an event model may need "event title", "start time", "location", "registration link", and so on.The Anqi CMS provides the basic skeletons of 'Article Model' and 'Product Model' by default, which meet most common needs.When your content needs become more diverse, the value of a customized content model becomes evident.

To start creating, we first need to enter the Anqi CMS backend management interface.In the navigation menu on the left, find the "Content Management" module and then click to enter the "Content Model" option.Here, you will see the list of built-in models in the system, as well as a 'Add New Model' button.

Click 'Add new model' and you will face several key settings:

  • Model name:This is a user-friendly display name, such as 'Activity Model' or 'Team Member'. It will appear in various content management entry points in the background, making it easy to identify and operate.
  • Model table name:This is the table name where the system stores the model data in the database. Please note that it must useEnglish lowercase lettersThis is to ensure the standardization and stability of the database. Once set, it is usually not recommended to change it arbitrarily, as it is directly associated with your data storage.
  • URL alias:This field also needs to be used.English lowercase lettersIt is mainly used as a model layer identifier when generating pseudo-static URLs.A clear and concise URL alias helps improve SEO effect and user experience.For example, setting "activity" as the URL alias for the "activity model" means that the URLs of related pages may contain/activity/.
  • Title Name:This setting is very considerate. It defines the prompt text for the main content field when you create content under the model.For example, in the "event model", you can set it to "event topic", so when publishing an event, the main title input box will display the hint "event topic", making the operation more intuitive.

After completing these basic settings, your content model skeleton is set up.But to truly 'come alive' this skeleton, we need to add specific 'flesh' - that is, dedicated fields.

Detail injection: Add specific fields to the custom model

The strength of the model lies in its ability to flexibly define various data fields to meet the storage needs of different content types.When creating or editing a content model, you will find the 'Content Model Custom Fields' area at the bottom of the page.Here, you can add, edit, or delete the exclusive fields of the model.

Click 'Add field' to open a new form that allows you to define this field in detail

  • Parameter name:This is the display name of this field, such as 'Event Location', 'Registration Deadline', or 'Member Position'.It will be displayed on the background content editing page, making it convenient for editors to understand and fill in.
  • Call field:This is the variable name used when calling this field in the front-end template, and it also corresponds to the actual field name in the database. It is recommended to useEnglish lowercase lettersFor example, 'location', 'deadline', or 'position'. In the template, you can pass through{{archive.location}}This way to obtain and display data.
  • Field type:AnQi CMS provides various field types to adapt to different data formats:
    • Single-line text:Suitable for short text inputs, such as titles, names, etc.
    • Number:Only allows input of numbers, suitable for prices, quantities, etc.
    • Multi-line text:Fields that require input of a lot of content are applicable, such as event introductions, member profiles, etc.
    • Single choice:Allow editors to select one from the predefined multiple options.
    • Multiple selection:Allow the editor to select multiple options from the predefined set.
    • Dropdown selection:Similar to single selection, but displayed in a dropdown menu to save page space.
    • For the 'Single choice', 'Multiple choice', and 'Dropdown selection' types, you also need to enter an option on each line in the 'Default value' field to define the available options.
  • Mandatory?:If checked, this field must be filled in when publishing content; otherwise, it cannot be submitted. This helps ensure the completeness of the content.
  • Default:If this field usually has a fixed value, or options are defined in a selection type field, they can be preset here. Leaving it blank indicates no default value.

By following these steps, you can add any number and type of fields to each custom content model, precisely matching your content needs.

Actual application of content models

After you have set up your custom content model and fields, their value will be fully reflected in content operations.

Firstly, when creating new content, you need to select a "category", and each category is associated with a content model.Once you have selected the corresponding category, the content editing interface will automatically load all the custom fields defined under the content model.This way, editors can accurately fill in the information based on field prompts, ensuring that all content is organized according to the preset structure.

Secondly, when designing front-end templates, you can make use of the powerful template tag system of Anq CMS (for examplearchiveDetailandarchiveParamsLabels), easily call these custom field data and display them on the website. Whether it's showing a location of an event or a position of a team member, it can be done flexibly.

By using a custom content model, Anqi CMS not only helps us achieve personalized content display, but also greatly improves the website's adaptability to various business needs, making content management more efficient and orderly.


Frequently Asked Questions (FAQ)

1. What is the difference between a custom content model and the built-in "article/product model"? Which should I choose?

The custom content model provides high flexibility, allowing you to design exclusive content structures and fields according to specific business scenarios (such as events, team members, cases, etc.)And the built-in "article model" and "product model" are preset general structures, suitable for most blog articles and product displays.If the content type is significantly different from the article or product, or if specific information needs to be captured, creating a custom model would be a better choice, as it can make your data structure clearer, more convenient to manage, and more targeted when displayed on the front end.If your content overlaps with the article or product, you can directly use the built-in model, and you can skip the custom steps.

2. How should I call the custom field I created in the front-end template?

The custom field is usually very intuitive when called in the front-end template. If you create the field in the background, its "call field" is set toauthor_nameThen in the article detail page template, you can directly go through{{archive.author_name}}To get the value of the field. If you want to traverse all the names and values of custom fields in a document, you can use{% archiveParams params %}...{% endarchiveParams %}Tag to get. The specific usage suggestions refer to the Anqi CMS template development document aboutarchiveDetailandarchiveParamsDetailed explanation of the tag, with very clear examples.

What are the risks of modifying the "model table name" or "URL alias" of the content model?

There is a certain risk in modifying the "model table name" or "URL alias", especially when the website has been launched and there is a large amount of data.

  • Model table name:It is the actual table name where data is stored in the database. Modifying it may cause the system to be unable to find the original data, resulting in data loss or page errors.Therefore, once set, it is strongly recommended not to change it.
  • URL alias:It is used to generate the page URL identifier. Changing it will cause the URL of all the content under the model to change.This will affect the website's SEO (search engine optimization) because search engines will consider these pages to be new or missing, which may lead to a decrease in traffic.If indeed a modification is needed, it is imperative to use the 301 redirect feature to permanently redirect the old URL to the new one, in order to minimize SEO impact.

Related articles

How to perform content filtering, batch replacement, and recycle bin operations in the document management feature of the AnQiCMS backend?

The content management system is the core of website operation, especially for sites that update content frequently, efficient document management functions are crucial.AnQiCMS as a powerful content management system, provides a rich and practical background document management tool, helping operators easily handle daily content maintenance work.This article will delve into the functionality of AnQiCMS backend in content filtering, batch replacement, and recycle bin operations, helping you manage website content more efficiently.### Efficient Filtering: Quickly Locate Target Content Quickly locate the required information in the vast amount of website content

2025-11-07

How to create a dynamic breadcrumb navigation using the `breadcrumb` tag and customize the home page name and title display?

In website operation, a clear navigation path is crucial for user experience and search engine optimization (SEO).Breadcrumb Navigation is like a small map of a website, allowing visitors to always know their location and easily return to the previous page.Today, let's delve deeper into how to use the powerful `breadcrumb` tag in Anqi CMS to create dynamic breadcrumb navigation and customize the home page name and title display according to our needs.

2025-11-07

How to construct a website navigation with multi-level submenus and associated content using the `navList` tag?

When building a website, a clear and easy-to-use navigation system is crucial, as it directly affects whether users can quickly find the information they need and also influences how search engines understand the structure of the website.AnQiCMS provides a powerful `navList` tag, allowing us to flexibly build a navigation system with multi-level submenus and closely associate navigation items with website content.Next, we will delve into how to use the `navList` tag to create a set of multi-level navigation that is both beautiful and practical for your website.### Website Navigation Basics

2025-11-07

How to dynamically generate page title, keywords, and description with the `tdk` tag and flexibly control whether to include the website name?

In website operation, the page title (Title), keywords (Keywords), and description (Description), which we commonly refer to as TDK, are the foundation of search engine optimization.They can not only help search engines understand the page content, but are also key factors to attract users to click.AnQiCMS (AnQiCMS) fully understands the importance of TDK, and through its powerful template tag system, especially the versatile `tdk` tag, makes dynamic generation and flexible control of page TDK easy and efficient.

2025-11-07

How to implement the image classification, batch transfer, and quick replacement operations of the image resource management function?

## Make image management no longer a hassle: Anqi CMS classification, batch transfer, and quick replacement feature details In this visually content-driven era, images on websites are not only auxiliary to content but also key elements that attract users, enhance experience, and even affect search engine rankings.However, as the content of the website becomes richer, the number of images also increases, and if these images are just scattered together, it will be extremely difficult to search and manage, and even slow down the efficiency of content updates.AanQi CMS understands the importance of image management for website operation

2025-11-07

How does the newly added Markdown editor of AnQiCMS support the correct display of mathematical formulas and flow charts?

## Make Content More Vivid: How AnQiCMS Markdown Editor Elegantly Presents Mathematical Formulas and Flowcharts The recent upgrade of AnQiCMS has brought an integrated Markdown editor, which undoubtedly brings great convenience to content creation.For operators who need to write technical documents, tutorials, reports, or any content that includes complex logic display, it is undoubtedly a blessing to be able to directly insert mathematical formulas and flowcharts into the article and have them displayed correctly.This article will discuss in detail how to implement this feature in AnQiCMS

2025-11-07

How to configure Baidu and Bing API interfaces for link push function to improve page inclusion efficiency?

In content operation, it is a key link to improve website traffic and visibility by allowing search engines to quickly discover and index our pages.Manually submitting links is inefficient and prone to omission.Fortunately, AnQiCMS provides a convenient link push function that can help us automatically submit new or updated pages to major search engines like Baidu and Bing, thereby significantly improving the page inclusion efficiency.Why link promotion is crucial for SEO

2025-11-07

How to design and apply custom rewrite rules to generate SEO-friendly URLs using `filename` or `catname`?

The structure of website links plays a crucial role in Search Engine Optimization (SEO).A clear, meaningful URL with keywords not only helps search engines better understand the page content, but also improves the user experience.AnQiCMS (AnQiCMS) provides powerful pseudo-static functionality, allowing us to flexibly design and apply SEO-friendly URL rules, where巧妙利用`filename`和`catname`variables are the key to achieving this goal.Why URL structure is important for SEO

2025-11-07