How to customize the layout and content of the document detail page in AnQi CMS?

Calendar 👁️ 53

In Anqi CMS, the customized display layout and content of the document detail page is the key to realizing website personalization and meeting specific business needs.The final form of website content, detail pages not only carry core information but also directly affect user experience and search engine optimization effects.AnQi CMS provides a highly flexible template mechanism and rich data tags, allowing users to easily create unique document detail pages according to their own creativity.

Understanding the basic structure of the document detail page of AnQiCMS

The Anqi CMS template system uses a syntax similar to the Django template engine, files are located in.htmlsuffix and stored in/templatethe directory. For document detail pages, the system defaults to finding{模型table}/detail.htmlfiles to render the content. Among them{模型table}Represents the table name of the content model to which the document belongs, for example, the article model may bearticle, the product model could beproduct.

This default mechanism provides basic versatility, but the strength of AnQi CMS lies in its support for more refined customization:

  • Customization at the document ID level:If you want a specific document to have a completely different layout, you can create a template file named{模型table}/detail-{文档ID}.htmlFor example, the detail page template for an article with ID 100 can bearticle/detail-100.html. The system will prioritize using this more specific template.
  • Content model customization: You can set custom fields for a content model (such as articles, products) in the background management interface. These fields will directly affect the data types displayed on the detail page.
  • Template language:You will mainly use double curly braces{{变量}}to output data, as well as single curly braces and percent signs{% 标签 %}to control the logical flow (such as conditional judgment, loops).

Core data call: how to display document content

The core of the document detail page is to display the data of the document itself. Anqi CMS providesarchiveDetailtags, which are the universal keys to obtain detailed data of a single document.

  • Basic information display:ByarchiveDetailLabel, you can easily get the title, description, publication time, and views of the document. For example, to display the document title, you can use{% archiveDetail with name="Title" %}. For time information, combinestampToDateFilter (such as{{stampToDate(archive.CreatedTime, "2006-01-02")}})can be formatted into a readable date.
  • Document content presentation:The document text is the most important part of the detail page. Use{% archiveDetail archiveContent with name="Content" %}You can obtain the document content. It is noteworthy that if the document content is generated by a rich text editor HTML, it is necessary to add|safeFilter, that is{{archiveContent|safe}}To avoid HTML code from being escaped and displayed directly. If the Markdown editor is enabled, you can also userender=trueThe parameter allows the system to automatically convert Markdown format to HTML, for example{% archiveDetail archiveContent with name="Content" render=true %}.
  • Images and media:
    • Cover image and thumbnail: LogoandThumbThe fields correspond to the cover image and thumbnail of the document, the calling method is similar{% archiveDetail with name="Logo" %}.
    • Group image display:If the document contains multiple images (such as product albums),ImagesThe field will return an array of image URLs. You need to combineforloop tags to iterate over and display these images, for example:
      
      {% archiveDetail archiveImages with name="Images" %}
      <ul>
      {% for img in archiveImages %}
          <li><img src="{{img}}" alt="文档图片"></li>
      {% endfor %}
      </ul>
      
    • Image lazy loading:To optimize the page loading speed, the images in the document content can be processed byarchiveDetailthe tag withlazy="data-src"parameter, so that the system can automatically process the imagessrcattribute is replaced withdata-srcand implement image lazy loading in need with the help of front-end lazy loading libraries.

Deep customization: Use content models to customize fields

The content model feature of AnQi CMS is an important embodiment of its high flexibility.You can define unique fields for different content models (such as articles, products) to store more rich and targeted data.

  • Define custom fields:In the background "Content Management" "Content Model", you can add custom fields such as "author", "product parameters", "download link", and so on for article models or product models.These fields can be single-line text, numbers, multi-line text, single selection, multiple selection, or dropdown choices.
  • Display all custom fields:If you want to display all custom fields of the document in a list, you can usearchiveParamsTags:
    
    {% archiveParams params %}
    <div>
        {% for item in params %}
        <div>
            <span>{{item.Name}}:</span>
            <span>{{item.Value}}</span>
        </div>
        {% endfor %}
    </div>
    {% endarchiveParams %}
    
  • Directly call a specific custom field:Know the name of the custom field (for example, the call field defined in the background is namedauthor) You can directly get its value like calling a built-in field:{% archiveDetail with name="author" %}This is very useful for situations where it is necessary to place specific custom fields at fixed positions.

Rich display: associated information and dynamic logic

A great detail page is not just about displaying the main content, but also providing rich associated information and dynamic interaction.

  • Associated category information:UsecategoryDetailTags can retrieve the name, link, and description of the current document category, etc. For example, display the category name and link:
    
    <a href="{% categoryDetail with name='Link' %}">{% categoryDetail with name='Title' %}</a>
    
  • Show related tags:BytagListTags, you can list all tags related to the current document and generate links for each tag to facilitate users in exploring more related content:
    
    {% tagList tags %}
    {% for item in tags %}
        <a href="{{item.Link}}">{{item.Title}}</a>
    {% endfor %}
    {% endtagList %}
    
  • Navigation and recommendations: prevArchiveandnextArchiveTags can conveniently add links to the previous and next documents at the bottom of the document, guiding users to continue browsing.archiveListLabel combinationtype="related"Parameters, can display other documents related to the current document content, further enriching the recommended content.
  • Dynamic logic control:
    • Conditional judgment: {% if 条件 %}The label is used to display or hide content based on specific conditions, such as checking if a field has a value before displaying the corresponding module.
    • Loop traversal: {% for item in 列表 %}Tags are indispensable when dealing with multi-image, multi-label list data.
    • Variable assignment: {% set 变量 = 值 %}or{% with 变量 = 值 %}You can create temporary variables to make template code cleaner and more readable.
  • Advanced SEO elements:To improve search engine friendliness, you should set the page title in the detail page's<head>area.tdktags(Title) and keywords(Keywords) and description(Description) as well. If there is a need for a standard link,tdkTags can also provideCanonicalUrlEnsure that the search engine correctly identifies the authority of the page.

Optimize user experience: image processing and interaction

In addition to the accurate presentation of content, the user experience of the document detail page is also crucial.

  • Background content settings:In the AnQi CMS backend under 'System Settings' and 'Content Settings', you can configure the image processing strategy

Related articles

How to call and display the latest article list in AnQi CMS?

As a feature-rich and easy-to-use content management system, AnQi CMS provides great flexibility in content display.When you need to show your visitors the latest articles on the website, such as on the homepage, sidebar, or specific topic pages, Anqi CMS can help you easily achieve this.To implement the "Display the latest article list in Anqi CMS", the core lies in flexibly using its powerful template tag system, especially the `archiveList` tag.

2025-11-08

How can I obtain and display the links and titles of the previous/next document on the document detail page?

In website content operation, adding "Previous" and "Next" navigation to the document detail page is a common strategy to improve user experience, guide users to deeply browse, and optimize the internal links of the website.AnQiCMS is a content management system that fully considers these needs and provides intuitive and simple template tags, allowing you to easily achieve this function.### The advantage of AnQiCMS implementing the "Previous/Next" navigation AnQiCMS's template system is designed ingeniously, adopting syntax similar to the Django template engine, by

2025-11-08

How to implement sorting display of content in a document list by the latest, the hottest, and other methods?

When managing website content, how to effectively organize and display a list of documents so that it meets user habits and highlights the key points is a very critical link.AnQiCMS (AnQiCMS) provides flexible and powerful features that allow you to easily implement various sorting and filtering of document content, whether it is by the latest release, most popular, or other customized methods.In AnqiCMS, the flexible display of the document list is mainly realized through the powerful `archiveList` template tag.

2025-11-08

How to customize the prompt information page displayed to users when the website is closed?

When a website needs to be maintained, upgraded, or temporarily suspended, displaying a friendly prompt page to visitors instead of a cold error message is crucial for improving user experience and maintaining brand image.AnQiCMS (AnQiCMS) is well-versed in this, providing a flexible and convenient way for you to easily customize the prompt information page when the website is closed. ### The shutdown handling mechanism of AnQi CMS AnQi CMS is built with website status management functions, allowing you to control the visibility of your website to the outside world with one click.In the background "Global Function Settings"

2025-11-08

How to use AnQi CMS template tags to get the document list under a specific category?

AnQiCMS (AnQiCMS) provides a solid foundation for flexible display of website content with its powerful template features.In website operation, we often encounter the need to display a list of documents under specific categories, such as news updates, product introductions, blog articles, and so on.Mastering how to utilize template tags to achieve this function will greatly enhance the organization efficiency and user experience of the website content.### Core Tag: The Usefulness of `archiveList` In AnQi CMS, you need to get the document list under a specific category

2025-11-08

How to implement lazy loading display effect of images in AnQi CMS article content?

In website operation, the speed of image loading is crucial for user experience and Search Engine Optimization (SEO).Especially when an article contains a large number of images, loading all images at once will significantly increase page loading time, consume user traffic, and may cause users to leave prematurely.At this moment, the Lazy Load (Lazy Load) image technology can fully show its prowess.The core idea of lazy loading is to only start loading images when they are about to enter the user's visible area, rather than loading all of them at the initial page load.

2025-11-08

How to set and display the navigation menu (top/bottom) of the AnQi CMS website?

The website navigation is the key path for users to explore the website content, and it is also an important reference for search engines to understand the website structure.In AnQiCMS (AnQiCMS), you can flexibly set and manage the top and bottom navigation menus of the website to meet different design and functional requirements.This article will introduce how to configure the navigation menu in Anqi CMS backend, as well as how to display it in the website frontend template.## Part One: Back-end Configuration of Navigation Menu The navigation menu settings in AnQi CMS are concentrated in the "Back-end Settings" area of the back-end.

2025-11-08

How to configure and display SEO TDK information on the homepage of AnQi CMS?

In website operation, Search Engine Optimization (SEO) is the key to improving website visibility and attracting natural traffic.And TDK (Title, Description, Keywords) information, as the "business card" of website content on the search engine results page (SERP), its configuration rationality directly affects the user click-through rate and the search engine ranking performance.For users using AnQiCMS (AnQi CMS), the system is built with intuitive and powerful TDK configuration features, making homepage SEO optimization simple and efficient.###

2025-11-08