How to implement the automatic display of content collected on the website front end?

Calendar 👁️ 85

After content collection is completed, how to automatically display the obtained content on the website front-end is a problem that many content operators are very concerned about.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides a complete solution from content entry to front-end display.It passes through a powerful content model, flexible template tags, and a friendly SEO mechanism, making this process simple and efficient.

Next, we will explore how to use the various functions of AnQiCMS, so that the valuable content you collect can be automatically and beautifully displayed on the front end of the website.

One, build the "skeleton" for content: content model and classification planning

Before collecting content, or before planning to display the collected content on the front end, the first step, and also the most critical step, is to build an appropriate 'home' for the content that will be stored—the content model.The 'Flexible Content Model' feature of AnQi CMS allows you to customize the content structure according to your business needs.

Imagine that you are collecting industry information, and you may need fields such as title, source, publication time, abstract, and full text;If you collect product information, you may also need prices, inventory, parameter lists, multiple product images, and so on.By defining these content model fields in the background, you can ensure that the collected data is stored in a standardized manner.For example, you can create an 'Information' model or a 'Product' model, and add custom fields as needed, such as 'Article Source', 'Author', and so on.These custom fields not only facilitate background management, but also allow the use of template tags on the front end to achieve richer content display.

At the same time, it is also crucial to have a reasonable planning for document classification and document tags.You can pre-create categories related to the theme of the collected content, such as "Industry News", "Technical Sharing", or "Product Update", and tag the content accordingly, such as "AnQi CMS", "Go Language", "SEO Optimization", and so on.These categories and tags are the foundation of content organization and front-end navigation, helping users quickly locate the information they are interested in.

Two, let the content "enter the door": content collection and storage

The AnQi CMS is built-in with the "Content Collection and Bulk Import" feature, which greatly simplifies the process of quickly importing external content into your website.Configure collection rules, and the system can automatically collect content from specified sources and import it in batches according to the content model and classification you preset.This not only saves a lot of tedious manual copy and paste work, but also ensures the quick update of content, especially suitable for websites that need to frequently update industry information and materials.

When adding content, you can also take advantage of functions such as 'Automatic Article Content Paraphrasing' and 'Automatic Keyword Expansion' (depending on the AnQiCMS version and module), to preliminarily process the collected content, making it better adapt to the positioning and SEO strategy of your website.In addition, the 'Time Factor - Scheduled Publishing Feature' also allows you to flexibly control the content's online time, avoiding the release of too much content at once, and realizing the 'trickling water' of content operation.

Three, let the content "appear": flexible application of front-end templates

Once the content is successfully stored, the next step is to make them beautifully displayed on the website front end.Anqi CMS uses a syntax similar to the Django template engine, allowing you to highly customize the display of content.Template files are usually named with.htmlwith suffix, stored in/templateunder the directory, and data is called through rich template tags.

  1. content displayed on the list pageFor example, you would like to display the latest collected article list on the home page or some category page, you can usearchiveListThe tag can retrieve content based on specified conditions (such as model ID, category ID, display quantity, sorting method, etc).

    {% archiveList archives with moduleId="1" categoryId="10" type="list" limit="10" order="id desc" %}
        {% for item in archives %}
        <div class="news-item">
            <a href="{{item.Link}}">
                <img src="{{item.Thumb}}" alt="{{item.Title}}" />
                <h3>{{item.Title}}</h3>
                <p>{{item.Description|truncatechars:120}}</p>
            </a>
            <span class="pub-date">{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
        </div>
        {% endfor %}
    {% endarchiveList %}
    

    In the above example:

    • moduleId="1"The content model specified is the article model.
    • categoryId="10"Limit to display articles with category ID 10 only.
    • type="list"Indicates to get a regular list instead of a paged list.
    • limit="10"Control to display 10 items.
    • order="id desc"Arrange the latest published content at the top.
    • {{item.Link}}/{{item.Title}}/{{item.Thumb}}/{{item.Description}}Called the link, title, thumbnail, and description of the article.
    • |truncatechars:120Is a filter used to truncate the description text to ensure it is displayed at a moderate length.
    • stampToDate(item.CreatedTime, "2006-01-02")Is a time formatting function that converts timestamps into a readable date format.
  2. Detail page display contentWhen a user clicks on an article in the list, detailed content needs to be displayed. In the detail page template (such asarticle/detail.html), the system will automatically recognize the current article, and you can use it directly.archiveor objectarchiveDetailTags to call various fields of the article.

    <h1>{% archiveDetail with name="Title" %}</h1>
    <div class="meta-info">
        <span>分类:<a href="{% categoryDetail with name='Link' %}">{% categoryDetail with name='Title' %}</a></span>
        <span>发布日期:{{stampToDate(archive.CreatedTime, "2006-01-02 15:04")}}</span>
        <span>浏览量:{{archive.Views}}</span>
        {% tagList tags with itemId=archive.Id limit="5" %}
        {% if tags %}
        <span>标签:{% for tag in tags %}<a href="{{tag.Link}}">{{tag.Title}}</a> {% endfor %}</span>
        {% endif %}
        {% endtagList %}
    </div>
    <div class="article-content">
        {{archive.Content|safe}}
    </div>
    

    It should be noted here.{{archive.Content|safe}}. As the collected article content may contain HTML tags (such as images, tables, formatted text, etc.), use|safeThe filter is crucial. It informs the template engine that this content is safe, does not require HTML entity encoding, and ensures that the HTML code within the content is correctly parsed and rendered by the browser.

  3. Categorization and tag navigationTo make it easier for users to find the content they are interested in, the display of categories and tags is also indispensable.

    • Category list:UsecategoryListTags can conveniently build navigation menus or category blocks.
      
      {% categoryList categories with moduleId="1" parentId="0" %}
      <ul>
          {% for cat in categories %}
          <li><a href="{{cat.Link}}">{{cat.Title}}</a></li>
          {% endfor %}
      </ul>
      {% endcategoryList %}
      
      * **

Related articles

How to add special styles to specific items when displaying in a list, based on the count in a for loop?

In website content display, we often need to highlight specific items in the list visually, whether it is to attract the attention of users or to enhance the hierarchy of the content.For example, you may want to add a "pin" mark to the latest few articles published, or make the odd and even rows of the list display different background colors to enhance readability.AnQiCMS (AnQiCMS) flexible template engine, which provides powerful support for these refined controls.AnQiCMS's template system borrows the syntax of the Django template engine

2025-11-09

How to use filters in a template to format displayed numbers and strings (such as decimal places, case conversion)?

In website content presentation, the aesthetics and readability of the data are as important as the quality of the content itself.AnQiCMS (AnQiCMS) provides powerful filter (Filters) functions at the template level, allowing us to easily format numbers and strings displayed on the page, thereby enhancing user experience and the professionalism of page information. ### Filter: A process in data processing We can imagine a filter as a series of processes that handle data.Raw data is like unprocessed raw materials, after the processing of the filter, it can be shaped into what we need

2025-11-09

How to correctly display HTML rich text content in article content using the `safe` filter?

In website content operation, rich text content plays a vital role.It allows us to enrich the expression of the article with various formats such as images, links, bold, italic, and more, enhancing the reading experience.AnQiCMS (AnQiCMS) provides a powerful backend editor, making it easy for us to create various wonderful content.However, when this rich text content is finally displayed on a website page, sometimes you may find that the original beautiful formatting and links have become raw HTML code strings. Why is that?

2025-11-09

How to display both subcategories and the list of articles under the category on a category page?

When operating the AnQiCMS website, we often encounter such a need: on a category page, we not only want to display the list of articles under the category but also clearly list all its subcategories to facilitate users in making more detailed navigation.The Anqi CMS, with its flexible template engine and rich built-in tags, can fully help us easily achieve this goal. ### Understanding AnQi CMS Category Page and Template Mechanism In AnQi CMS, each category (whether it is an article category or a product category) can be associated with an independent template file. Generally speaking

2025-11-09

How to prevent HTML tags from being automatically escaped when content is displayed?

When using Anqi CMS to manage website content, you may encounter a seemingly small but annoying problem: the formatted HTML code entered in the background editor is displayed as plain text on the front page, even presented directly in the form of angle brackets, losing the original style and layout.This not only affects the appearance of the page, but also discounts the carefully arranged content.Why is that, and how should we solve it?###

2025-11-09

How can you reference and overwrite the base master template (extends) in a template to unify the display style?

In the world of AnQiCMS, building a website with a unified appearance, easy to manage, and efficient to update is a common pursuit of each content operator and developer.Imagine if each page of the website needed to be designed individually for the header, footer, and sidebar, then the amount of work required to modify the logo, navigation menu, or copyright information would be enormous.Luckyly, AnQiCMS cleverly utilizes the template inheritance mechanism, allowing us to easily achieve a unified display style while maintaining flexible content updates

2025-11-09

How to define macro functions in templates to reuse commonly used content display code snippets?

In the development of website content management system templates, we often encounter situations where we need to repeatedly write the same or similar code snippets to display specific types of content.For example, each article card in the blog article list, each product feature item on the product detail page, although their content is different, their structure and style are highly similar.If you copy and paste this code manually every time, not only is it inefficient, but you also have to repeat the laborious work in multiple places when you need to make modifications, which is very prone to errors.AnQiCMS (AnQiCMS) is an efficient content management system, its template engine supports similar

2025-11-09

How to customize new parameters in the AnQiCMS backend settings and display them in the front-end template?

In Anqi CMS, to meet the personalized and flexible content display needs of the website, you can easily customize new parameters and call these parameters to display in the front-end template.This greatly enhances the website's customization capabilities, whether it is to display specific contact information, additional attributes of articles, or special configuration of single pages, it can do so with ease. AnQi CMS provides two main ways of custom parameters: **global parameters at the system/contacts level** and **custom fields at the content model level**. Understand these two methods and their applicable scenarios

2025-11-09