How to completely customize the content display layout of the article detail page?

Calendar 👁️ 87

It is not difficult to create a unique and rich content article detail page in AnQi CMS.This is not just a modification of the style, but also goes deep into every link of content structure, data retrieval, and front-end rendering, achieving true 'complete customization'.AnQi CMS provides us with great flexibility through its flexible content model and powerful template engine to achieve this goal.

Understanding the 'skeleton' of the article detail page: template mechanism

To customize the article detail page, you first need to understand the Anqi CMS template mechanism.In AnQi CMS, all frontend page displays are controlled by template files.These template files are usually stored in/templateUnder the directory, organized by different functions or models. For the article detail page, the core template files are usuallyarchive/detail.html.

The template syntax of Anqi CMS is similar to the Django template engine, using double curly braces{{变量}}to output data, through{% 标签 %}To control logic (such as conditional judgment, loops, etc.). This provides a solid foundation for customizing content.

An important point of customization is that Anqi CMS allows you tospecific articlesorspecific categoriesSpecify an independent template file. This means that if your website has different types of content, such as news articles, product introductions, or case studies, they can have completely different detail page layouts, rather than just sharing the same general template.In the background article or category editing interface, you can enter the custom template file name (for exampleproduct_detail.htmlornews_template.html),Then put this file into/template/{你的模板目录}/archive/And the system will prioritize the use of these specified templates.

Core: Unlimited possibilities of custom content models and fields

The content of the article detail page is not just the title and text. The flexible content model of Anqi CMS is the key to deep customization.It allows you to create or modify content models based on business requirements and add exclusive custom fields for them.

You can enter the admin panel and find the 'Content Model' feature under 'Content Management'.Here, in addition to the default article model and product model of the system, you can also create new models as needed, or modify existing models.For example, if you want to display 'Source of the article', 'Author's introduction', or 'Download link of related materials' on the article detail page, you can add these custom fields to the article model.These fields can be:

  • Single-line text: Suitable for short sentences, such as "source of the article".
  • Number: Such as "reading time", "rating".
  • Multi-line text: Suitable for longer text, such as "author's biography".
  • Single choice, multiple choice, dropdown choiceUsed for preset options, such as "Article Level" (Beginner, Intermediate, Advanced).

These custom fields become part of the article data once defined, and can be accurately retrieved and displayed in the article detail page template.This is the cornerstone for breaking through the standard layout constraints and achieving personalized content display.

Accurate retrieval and display: the magic of template tags.

In the custom article detail page template, we need to use various template tags to retrieve and render data.

  • archiveDetailTagThis is the core tag for retrieving article detail data.
    • You can directly use{{archive.Title}}/{{archive.Content}}/{{archive.Logo}}/{{archive.CreatedTime}}Wait to get the default field of the article.
    • Key point: retrieve the custom field. If you add a custom field in the content model, such as a field namedauthorfield, you can directly pass through.{{archive.author}}Get its value. If your custom field is an image group, for exampleimage_galleryYou can display it in a loop like this:
      
      {% archiveDetail imageList with name="image_gallery" %}
      <ul class="image-gallery">
        {% for img in imageList %}
        <li><img src="{{img}}" alt="图片描述" /></li>
        {% endfor %}
      </ul>
      
  • archiveParamsTag: If you want to loop through all the custom parameters of the article (instead of specifying them individually),archiveParamsit will be very useful.
    
    {% archiveParams params %}
    <div class="article-meta">
        {% for item in params %}
        <p><strong>{{item.Name}}:</strong>{{item.Value}}</p>
        {% endfor %}
    </div>
    {% endarchiveParams %}
    
  • categoryDetailTag: Used to get the details of the current article's category, such as the category name{{categoryDetail with name="Title"}}Or category links{{categoryDetail with name="Link"}}.
  • tagListTagUsed to display tags related to the current article, you can loop through them

Related articles

How to efficiently display the latest list of articles released in Anqi CMS?

In AnQi CMS, effectively displaying the latest list of published articles is the foundation of website content operation, which can help keep your website vibrant and allow visitors to get the latest information first.AnQi CMS provides flexible and powerful template tags, allowing you to easily achieve this goal.Understanding the Core: The Charm of `archiveList` Tag To display the latest published article list, we mainly rely on the `archiveList` template tag built into AnQiCMS.This tag is used to retrieve various documents on the website (such as articles

2025-11-09

How to generate and manage a Sitemap to enhance the visibility of website content in search engines

For any website that hopes to stand out in search engines, Sitemap is an indispensable tool.It is like a detailed map of your website content, indicating all pages that can be crawled and indexed by search engine spiders (crawlers).In AnQi CMS, generating and managing a Sitemap is an efficient and user-friendly task that can significantly enhance the visibility of your website content.What is a Sitemap and why is it important?Sitemap, in short, is a website map.It is an XML file

2025-11-09

How can you use the content collection feature to quickly fill a large amount of content to be displayed?

Running a website, the most annoying thing is filling content.Whether it is a new site going online that needs to quickly accumulate a large amount of basic content, or an existing website that needs to maintain continuous updates to attract and retain users, manually writing or organizing content is a time-consuming and labor-intensive task.Today in content marketing and SEO optimization, how to efficiently and in bulk acquire and manage the content to be displayed has become a challenge for many operators.AnQiCMS (AnQiCMS) understands this pain point and its built-in content collection function is specifically designed to solve this problem.It is not simply copy and paste

2025-11-09

How does AnQiCMS's scheduled publication feature ensure that content is displayed accurately at the specified time?

## Precisely Control Content Release: How AnQiCMS's Scheduled Publishing Function Ensures Accurate Display at Specified Time Points In today's rapidly changing online world, the timeliness and consistency of content are crucial for the success of a website.In order to coordinate with marketing activities, respond to sudden hotspots, or simply to maintain the rhythm of daily updates, manually posting content is often inefficient and prone to errors.At this time, the time scheduling publishing function provided by AnQiCMS is particularly important, as it can act like a precise butler, ensuring that your content is accurately displayed to readers at any preset time point without error

2025-11-09

How to aggregate and display the content list of multiple article categories on a single page?

In Anqi CMS, implementing a feature to aggregate multiple article category content lists on a single page is a very practical requirement. It can help website administrators organize content efficiently and provide visitors with a more convenient browsing experience.This is commonly applied to the homepage, special pages, or aggregate pages of a website, where we can easily achieve the goal by skillfully using AnQiCMS template tags.### Core Concept: Tag Combination and Nested Loops AnQi CMS provides a flexible template tag system

2025-11-09

How to implement multilingual front-end display and switching of website content in AnQiCMS?

When building a website for global users, the display and switching of multilingual content are essential.AnQiCMS (AnQiCMS) understands the importance of this requirement and has integrated powerful multilingual support capabilities into the system design from the beginning, helping websites easily achieve internationalization of content. ### The Basics of Content Multilingual Management: Multi-Site Mode One of the core mechanisms for implementing multilingual display of website content in Anqi CMS is its flexible "Multi-Site Management" function.For a truly multilingual website

2025-11-09

How to configure pseudo-static URL rules to optimize the search engine display of website content?

In today's internet environment, the search engine display effect of website content is directly related to traffic and conversion.A clear and meaningful URL structure not only enhances user experience but is also an indispensable part of search engine optimization (SEO).AnQiCMS (AnQiCMS) understands this and therefore provides a powerful and flexible pseudo-static URL rule configuration function to help website managers easily optimize URL structure.Why configuring pseudo-static URL rules is crucial for the search engine display of website content?Before getting to know how to configure

2025-11-09

How to correctly parse and display Markdown formatted text in article content?

In Anqi CMS, using Markdown format to write articles is an efficient and elegant way of content creation, which makes our content structure clearer and layout more flexible.Especially for technical articles that need to include code, mathematical formulas, and even flowcharts, Markdown editors are an indispensable tool.How can we ensure that these carefully written Markdown texts are correctly parsed and perfectly presented on the website front-end?Let's explore step by step. ### Enable Markdown Editor First

2025-11-09