In AnQiCMS, the content model feature is one of its core highlights, which endows the website with great flexibility, allowing you to break free from the constraints of traditional CMS fixed content types and customize exclusive content structures according to your own business needs.Imagine if your website is not just for publishing articles or products, but also needs to display real estate information, job openings, event details, and even recipes. If you use a fixed "article" type, it will be difficult to organize and manage these pieces of information.The content model is a powerful tool to solve this pain point.

Understand the content model: the 'skeleton' of website content

In simple terms, the content model is the blueprint for the content on your website.It defines which fields each content type should include, what types these fields are, whether they are required, and how they should be displayed.For example, an "articleAnQiCMS built-in "article model" and "product model", which provides the foundation for most websites.But its real power lies in the fact that you can create brand new, fully customizable content models for any type of business.

Why is it important to customize the content model? It can help you:

  • Precisely capture information:Ensure that every piece of content collects all the necessary specific data.
  • Optimize content management:The content editor interface should be clear and intuitive when publishing different types of content, to avoid missing key information.
  • Achieve personalized display:The website front-end can be more precise and beautiful in layout and presentation according to different content structures.
  • Improve SEO benefits:The organized structured data is more conducive to search engine crawling and understanding your content, improving website ranking.

Customize your exclusive content type: Create a custom content model

To start customizing your content model, you first need to log in to the AnQiCMS backend.In the left menu, find the "Content Management" under the "Content Model" option.Here, you will see the two built-in models of the system, as well as the 'Add New Model' button.

Click 'Add New Model', you will enter the model creation interface. There are several key settings items that you need to fill in carefully:

  1. Model name:This is the Chinese name displayed on the background management interface of the model, which is convenient for you and your team members to identify, such as 'Real Estate Information', 'Job Positions', 'Event Arrangement'.
  2. Model Table Name:This is a very important field, it determines the table name in which your custom content field is stored in the database. Be sure to usein English lowercase lettersFor example, "house
  3. URL Alias:Used to generate the identifier in pseudo-static URLs, it is also recommended to usein English lowercase lettersThis will make your URL more semantically meaningful, for example/house/list.
  4. Title Name:This setting is very thoughtful, it will serve as the prompt text for the title field when content is published.For example, if your model is “Real Estate Information”, you can set the title name to “Property Title”, so that the editor can know what to fill in at a glance.

After completing the basic settings, the most core part is the 'Custom fields of content model'.Here you can add unique data fields for the current model.

  • Single-line text:Applicable to short text input, such as “Property address”, “Contact phone number”.
  • Numbers:Specifically used for numeric input, such as “Property area”, “Price”.
  • Multi-line text:Suitable for long text descriptions, such as "House introduction" and "Activity rules".
  • Single choice (Radio):When you need users to select one from several preset options, such as 'Apartment type: one-bedroom, two-bedroom, three-bedroom'.
  • Multiple Selection (Checkbox):Allow users to select zero or more from multiple predefined options, such as 'Facilities: Air conditioning, washing machine, refrigerator'.
  • Dropdown selection (Select):Similar to single choice, but presented in a dropdown menu format, suitable for situations with many options, such as “Location: Haidian District, Chaoyang District, Xicheng District”.

When adding each custom field, you also need to configure:

  • Parameter name:The Chinese display name of the field, such as "House Area".
  • Field call:This is the English identifier used when calling this field in the template, for example, 'area'.
  • Mandatory:Determine whether this field is required to be filled in when the content is published.
  • Default value:Provide options for single-choice, multiple-choice, and dropdown fields, one per line. For other field types, preset values can be set here.

For example, to create a 'Real Estate Information' model, you can add the following custom fields:

  • Parameter name:Layout,Field call: layout,Field Type:Single selection,Default value:One bedroom one living room\nTwo bedrooms one living room\nThree bedrooms two living rooms.
  • Parameter name:Area (square meters),Field call: size,Field Type:Number.
  • Parameter name:Rent (RMB/month),Field call: rent,Field Type:Number.
  • Parameter name:Location,Field call: district,Field Type:Dropdown selection,Default value:English
  • Parameter name:EnglishField call: house_desc,Field Type:English

After configuration, click "OK" to save your new content model.

Content filling and display: the application of custom models

The custom content model not only simplifies backend management, but more importantly, it can be flexibly displayed on the front-end website.

  1. Content entry is more convenient:一旦你创建了自定义内容模型并在分类中关联了它(在“文档分类”管理中,编辑分类时选择对应的模型),当你在该分类下发布新文档时,原有的“文档标题”、“文档内容”等基础字段下方,就会出现你刚刚定义的那些自定义字段。The editor can easily fill in exclusive information such as "type", "area", "rent", etc. according to the prompts, which greatly reduces the threshold and error rate of content entry.

  2. Front-end page personalized display:How to call and display these custom data on the front-end of the website? AnQiCMS template tags provide strong support.

    • Display custom fields of a single document:In the document detail page, you can directly accessarchive.调用字段名to get the data, or usearchiveDetailtags. For example, to display the multi-line description of the property,