AnQiCMS (AnQiCMS) provides great convenience to website operators with its flexibility and powerful content management capabilities. When we carefully create an article or product page and hope to display its colorful content accurately to visitors,archiveDetailThe label is an indispensable tool in our hands. It is like a treasure trove of information, allowing us to easily call up all relevant data of the current content on the article detail page.
In the article detail page template, often it can be directly called{{archive.字段名}}in the form to call various properties of the current document. Of course, it can also be called in a more explicit{% archiveDetail with name='字段名' %}Labels to obtain, especially when information about a specific document ID is needed. Next, we will delve deeper intoarchiveDetailThe label is a commonly used call field in the article detail page, which helps you better understand and apply it.
Content core and SEO optimization
Firstly, let's take a look at the key information that constitutes the basic framework of the content.IdRepresents the unique identifier ID of the document.TitleThis is the core title of the article or product, which are the most intuitive and important elements on the page. Closely related to the title isSeoTitle/KeywordsandDescriptionThey are used to optimize the page title, keywords, and description displayed in search engine results, which is crucial for enhancing the visibility of the website in search.
In addition,LinkThe field provides a complete access link to the current document,CanonicalUrlIt plays an important role in SEO, indicating which version of the content is the canonical one, avoiding duplicate content issues. If you want to point the document to an external resource,OriginUrlCan be used to store the original link.
Main content and visual presentation
ContentThe field is undoubtedly the most important part of the article detail page, carrying all the main content of the article. Anqi CMS provides additional conveniences here, such as supporting image lazy loading of content, just by adding it when callinglazy="data-src"The properties can be adapted to mainstream lazy loading plugins. What's more impressive is that when you enable the Markdown editor in the background,ContentContent will be automatically rendered into HTML, greatly facilitating content creation. If more detailed control is needed, it can be achieved byrender=true|falsemanually deciding whether to render Markdown.
For long articles,ContentTitlesThe field is very useful, it can return an array containing all levels of headings in the article.Developers can easily generate the table of contents (TOC) for articles using this feature, enhancing the reading experience of users.
in terms of visual content,Logousually refers to the first or main image of the document,Thumbwhich is a thumbnail processed by the system. When the document contains multiple illustrations,ImagesThe field returns an array of image addresses, convenient for you to display a beautiful album or gallery through a loop.
Content ownership belongs to interactive data
The attribution and associated information of the content are all included.CategoryIdDisplay the ID of the category to which the document belongsCategoryThe field is more powerful, it is a complete category object, from which you can obtain the title, link, description, and more detailed information of the category, even including the Logo or thumbnail of the category, helping to build a clear navigation structure.
ModuleIdThis indicates the content model of the document (e.g., article model, product model), which is very useful when handling different types of content.ParentIdUsed to handle the parent-child relationship of documents, such as the superior and subordinate articles in a series.
Data related to user interaction is also very important.ViewsRecorded the number of times the document has been viewed, which is an important indicator of the popularity of the content.CommentCountThen it can display the number of comments the article has received, which is convenient for users to understand the interaction heat.FlagThe field is used to identify the recommended attributes of the document, such as "Top NewsUserIdIt displays the document's publisher ID.
Timestamp and custom extension
CreatedTimeandUpdatedTimeRecorded the creation and update time of the document. These fields return timestamps and need to be配合 in the template.stampToDateLabels must be formatted to be presented in a human-readable date format, such as{{stampToDate(archive.CreatedTime, "2006-01-02 15:04")}}.
For product content,PriceandStockfields are used to display price and inventory information.ReadLevelIt can be used to set the document's reading permission level.
In addition to these built-in fields, the content model of Anqi CMS supports custom fields. This means that if you add additional fields such as "author", "source", etc. in the background for a specific model, these fields can also bearchive.自定义字段名or{% archiveDetail with name="自定义字段名" %}The way to call it easily, greatly extending the flexibility of content display. When multiple custom fields need to be retrieved, it can be traversed and displayed through{% archiveParams params %}tags.
In short,archiveDetailLabels and their rich field lists provide highly customized and refined content display capabilities for Safe CMS users.Whether it is basic text information, complex text and image mix, or product parameters and user interaction data, they can be perfectly presented on your website detail page with simple tags.
Common Questions (FAQ)
why do I use it directly
{{archive.Content}}Is the displayed content HTML-tagged code, rather than formatted content?This is because the security CMS template engine, for security reasons, defaults to escaping the output HTML content to prevent XSS attacks. If you are sureContentThe HTML code in the field is safe, and it is expected that the browser can parse and display its effects normally. You need to add it when calling it.|safeFilter, for example{{archive.Content|safe}}.I call it on the detail page
CreatedTimeorUpdatedTimeWhy is it showing a series of numbers instead of a date format?CreatedTimeandUpdatedTimeReturns a UNIX timestamp (a series of numbers), not a direct date and time string. You need to use the built-instampToDatetags to convert it