As an experienced website operations expert, I am well aware that how to efficiently utilize the built-in tags in a feature-rich content management system like AnQiCMS is the key to improving operational efficiency. Today, let's delve deeper into this topic.moduleDetailTags and theirnameParameters, it helps us accurately obtain the specific fields of the content model, providing strong support for the flexibility and maintainability of the website.

Secure CMSmoduleDetailLabel: The key field and practical strategies for unlocking content models

The reason why AnQiCMS is favored is largely due to its flexible content model design.It allows us to define dedicated data structures for different types of content (such as articles, products, events, etc.), thereby enabling personalized content display and management.Whether it is the system-built article model, product model, or the specific model we customize according to business needs, they all have their own metadata, which is an indispensable foundation for building a dynamic website.

In the template design of AnQiCMS,moduleDetailLabels play a crucial role, helping us dynamically obtain detailed information of any content model. When we want to understand the properties of the current content model on the page, or when we need to display different information based on the model type in some list pages, moduleDetailLabels can really shine. It not only supports specifying specific model details through model ID (id), or URL alias (token), but also allows you to specify specific model details in a multi-site management scenario, even.siteIdParameters for cross-site retrieval of model data. But what truly showcases its strength is that it allows fornamespecific fields that can be retrieved by parameters, which constitute the core metadata of the model.

Next, we will parse one by onenameThe keywords that can be obtained by the parameters:

Get the unique identifier of the model:Id

Each content model in the AnQiCMS system has a unique numeric identifier, that is,Id. When we want to get this unique numeric ID in the template,IdThe field is our preference.This is very practical in scenarios where internal logic judgment or data association is required.For example, you may need to load different JS scripts or styles on the frontend based on the model ID.

{# 默认用法,自动获取当前页面模型ID #}
<div>当前模型ID:{% moduleDetail with name="Id" %}</div>
{# 获取指定ID为1的模型ID #}
<div>文章模型ID:{% moduleDetail pageId with name="Id" id="1" %}{{pageId}}</div>

We can easily obtain the current or specified model in this way【en】Idand use it for dynamic rendering on the frontend【en】

Get the Chinese name of the model:【en】Title

TitleThe field refers to the Chinese name we see on the background management interface of the model, which is also the friendly name displayed to the outside.For example, 'article model' or 'product model'.This field is crucial for displaying user-friendly model names on the frontend page, such as in breadcrumb navigation, titles of model category lists, etc.

{# 默认用法,自动获取当前页面模型的标题 #}
<p>您正在浏览的是:{% moduleDetail with name="Title" %}</p>
{# 获取指定ID为1的模型的标题 #}
<p>系统内置文章模型标题:{% moduleDetail articleTitle with name="Title" id="1" %}{{articleTitle}}</p>

This undoubtedly provides us with great convenience, eliminating the need for hard-coded model names and instead dynamically obtaining them from the system, which enhances the maintainability of the content.

Get the internal name or URL alias of the model:Name

NameThe field usually refers to the unique identifier used by the model internally or at the code level, which is typically lowercase English letters. This name is often used as part of the URL in pseudo-static rules, for example, if the article model'sNameYesarticleThen, the article detail page URL may contain/article/. It complementsTitle(Chinese title) to form a complementary pair, one for display and one for internal identification or URL construction.

{# 获取当前模型在URL中使用的别名 #}
<p>当前模型的URL别名:{% moduleDetail with name="Name" %}</p>

UnderstandNameThe field helps us better understand and customize the URL structure of the website.

Get the SEO keywords of the model:Keywords

When setting SEO strategies for the content model itself, we can define a series of keywords for it.KeywordsThe field is used to obtain these SEO keywords associated with the model. On some model home pages or special topic pages,<meta name="keywords">in the tags, we can use this field to optimize the crawling of search engines.

{# 获取当前模型的SEO关键词 #}
<meta name="keywords" content="{% moduleDetail with name="Keywords" %}">

We can make the website's SEO more flexible and accurate by dynamically obtaining keywords.

Get an overview or description of the model:Description

Similar to keywords,DescriptionThe field provides a more general description of the model, commonly used in metadata or specific display areas. For example, in the AnQiCMS backend, we can set a brief introduction for a content model, which can then be displayed throughDescriptionThe field is called on the front end, as a model page's<meta name="description">content, or displayed in some introduction module.

{# 获取当前模型的简介或描述 #}
<meta name="description" content="{% moduleDetail with name="Description" %}">

This helps to enhance the semantic expression of the model and provides support for SEO.

Get the model access link:Link

Each content model can have an entry link, such as the homepage of an article model, product model homepage, etc.LinkThe field is used to obtain the access link for this model.This is very useful for scenarios such as building navigation menus, model classification list 'View All' links, etc., ensuring that the link always points to the correct model entry.

{# 获取文章模型的首页链接 #}
<a href="{% moduleDetail with name="Link" id="1" %}">进入文章列表</a>

Dynamically fetching links avoids maintenance issues that might be caused by hard-coded URLs.

Get the database table name of the model:TableName

TableNameThe field is directly associated with the database level, displaying the table name corresponding to the content model data in the database.This field may not be commonly used by ordinary operators, but for technical personnel who need to carry out secondary development, data analysis, or troubleshooting, it provides direct database information and is an important reference for understanding the data storage structure.

{# 获取当前模型在数据库中的表名 #}
<p>当前模型对应的数据库表名为:{% moduleDetail with name="TableName" %}</p>

Understanding this field helps to deeply understand the data storage mechanism of AnQiCMS.


PassmoduleDetailTags, AnQiCMS provides a powerful and flexible mechanism to access and utilize the metadata of content models in a dynamic and on-demand manner.This not only greatly improves the reusability and maintainability of the template, but also provides a solid foundation for us to build more intelligent and adaptable websites.As website operators, mastering the usage of these tags undoubtedly enables us to be more skillful in content strategy and website optimization.

Common Questions (FAQ)

1.moduleDetailCan the tag get custom fields in the model? For example, have I added a 'production date' field in the product model?

moduleDetailThe tag itself is mainly used to get the content model.Metadata, which describes the attributes of the model itself, such as model ID, title, alias, link, etc.cannot be accessed directlyPassnameParameters get the content entry (such as specific products, articles) you define in the model.Custom fields(For example, "Production Date"). To get the values of these custom fields, you need to usearchiveDetailtags (for a single document) orarchiveListaccess in a loopitem.自定义字段名, or usearchiveParamsGet all custom parameters of the document by label.

How to ensure in a multi-site environment?moduleDetailThe correct site's model information is obtained?

AnQiCMS supports multi-site management,moduleDetailTags also consider this point. If you need to get the information in the templateother sitesabout the content model, you can use thesiteIdparameter to specify the site ID explicitly. For example: `