How to use AnQi CMS template tags to call the article content under a specific category and perform pagination display?

Calendar 👁️ 69

In website content operation, we often need to display a list of articles under a specific category on a single page, and in order to provide a better user experience and content structure, pagination functions are usually used in conjunction.A strong and easy-to-use template tag provided by AnQi CMS can help us easily achieve this requirement.

The core of article content calling:archiveListTag

To call the article content under a specific category, Anqi CMS providesarchiveListthis core tag. This tag is very flexible and can filter and sort articles based on various conditions.

It is crucial to clearly specify the category to be called. This is achieved throughcategoryIdparameters. For example, if the category ID of your 'Company News' is 10, you can set it like this:categoryId="10"If you need to call articles of multiple categories at once, you can separate the category IDs with English commas, for examplecategoryId="10,12,15"A notable detail is, if omittedcategoryIdThe parameter, the system will try to read the category ID of the current page; if you explicitly do not want it to be read automatically, you can set it tocategoryId="0".

Next, to implement the pagination display of the article list,typeThe parameter must be set to"page". Whentype="page"then,archiveListThe label will intelligently return the article data of the current page and simultaneously generate other information required for pagination, which will be used by subsequent pagination labels.

In addition to these two key parameters,archiveListIt supports other commonly used settings to meet various display needs:

  • limit: Controls the number of articles displayed per page, for examplelimit="10"means 10 articles per page.
  • order: Defines the sorting method of the articles, for example"id desc"Means sorting by article ID in reverse order (i.e., the most recent published),"views desc"The items are sorted by the number of views in descending order.
  • moduleIdIf your website uses a different content model (such as articles, products, etc.), you can specify the model ID through this parameter. The article model is usually set to 1 by default.

InarchiveListWithin the loop of the tag, you can accessitemthe detailed information of each article, including{{item.Title}}(Article Title),{{item.Link}}(article link),{{item.Description}}(Article summary),{{item.Thumb}}(article thumbnail),{{item.CreatedTime}}(Publishing time) and{{item.Views}}(Views) and others, thus enabling flexible construction of the display style for each article.

Improve pagination navigation:paginationTag

paginationTags are witharchiveListTags (whentype="page"Used in conjunction with (time), it is responsible for generating beautiful and functional pagination navigation links at the bottom of the page.

While usingpaginationtags, you can go throughshowparameter to control the number of page numbers displayed in the pagination bar. For example,show="5"It will display 5 page links before and after the current page number, making the pagination bar appear more concise and easy to navigate.

paginationThe tag will provide a name forpagesThe variable, which contains all the data related to pagination, for example{{pages.TotalItems}}(Total number of articles),{{pages.TotalPages}}(Total number of pages),{{pages.CurrentPage}}(Current page) and so on. What's most important is that it provides links and status information for the home page, previous page, next page, last page, and middle page numbers.These pagination links are also a list, you can utilizeforLoop to iterate, and throughpageItem.IsCurrentTo judge the current page, thus highlighting.

Practice exercise: Call specific category articles and implement pagination

Here is a specific code example demonstrating how to implement the calling and pagination display of articles in a specific category of Anqi CMS template. Suppose we want to display it in a template file such asarticle/list.htmlOr you can display all articles under the custom template you set for a specific category, and perform pagination.

`twig {# This is the page content area, used to display the list of articles #}

Related articles

How can AnqiCMS efficiently display the latest published article list on the homepage?

How can Anqi CMS efficiently display the latest published article list on the homepage?In website operation, the homepage as the first stop for user access, the activity of content updates often determines whether users are willing to stay and delve deeper into browsing.Especially for content-driven websites or corporate blogs, the homepage can dynamically display the latest list of published articles, not only presenting fresh content to visitors in the first place but also a key factor in improving user experience and search engine friendliness.So, how do we achieve this goal efficiently in AnQiCMS (AnQiCMS)?

2025-11-09

How can you dynamically obtain and display the current year or other time information in the AnqiCMS template?

In website operation, we often need to dynamically display the current year, date, or time on the page, such as the copyright information in the footer, the publication or update time of articles, etc.This information, if manually updated, is not only time-consuming and labor-intensive, but also prone to errors.Fortunately, AnqiCMS provides a concise and efficient method for you to easily implement the acquisition and display of these dynamic time information in the template.### Dynamically retrieve and display the current year or other time information In the AnqiCMS template, to retrieve and display the current year or any format of the current time, we can use the built-in

2025-11-09

How to display traffic or crawler access data charts on the front end of AnqiCMS's background data statistics function?

Understanding website traffic and user behavior is crucial for operators.AnqiCMS as an efficient enterprise-level content management system provides detailed data statistics and crawling monitoring functions in the background.This data can not only help us analyze the performance of the website and optimize the content strategy, but also has the potential to provide more intuitive information to users or visitors in specific scenarios through the display of charts on the front end.

2025-11-09

How to automatically parse a URL string into a clickable a tag in AnqiCMS template for convenient browsing?

When operating a website, we often add some URLs in articles, product descriptions, or single-page content, which may be recommended external resources or references to other content within the site.But if these URLs are just displayed in plain text, users will have to copy and paste to access them, which is inconvenient and also affects the reading experience.AnqiCMS has fully considered this point and provided us with a very convenient way to automatically convert plain text URLs in the content into clickable links, greatly enhancing the convenience of user browsing and the professionalism of the website.

2025-11-09

In AnQi CMS, how should the article detail page correctly display the article title, content, and related information?

AnQiCMS (AnQiCMS) provides powerful and flexible content management features, especially when building article detail pages, which can help us efficiently present high-quality content.A well-designed article detail page can not only clearly display the core information of the article, but also effectively improve the user's reading experience and the stickiness of the website through the recommendation of related content. ### Article Title and Core Content: The Soul of the Page The core of the article detail page in Anqi CMS is the article title and main content.

2025-11-09

Under multi-site management, how to ensure that the independent content of each site is displayed correctly?

The practice of independent content display for multiple sites of AnQi CMS: Ensuring the unique style of each site In today's ever-changing digital world, many enterprises and content operators may need to manage multiple websites at the same time, whether it is to distinguish brands, sub-divide markets, or meet different business needs.AnQiCMS (AnQiCMS) provides an efficient and convenient solution for such needs with its powerful multi-site management function.

2025-11-09

How to customize the content model in Anqi CMS to achieve personalized product display?

When building a successful website, especially for enterprises that need to display a variety of products, the personalization and precise presentation of content are crucial.Traditional website content management systems often provide fixed or limited content types, which may not be sufficient when facing products with different attributes and display requirements.AnQiCMS (AnQiCMS) understands this pain point, through its powerful customizable content model function, it provides users with flexible and efficient solutions, making personalized product display easily accessible.### AnQi CMS Content Model

2025-11-09

How to implement SEO optimization display of article titles in Anqi CMS and differentiate them from regular titles?

How to implement SEO optimization display of article titles in AnQiCMS, distinguishing from the regular title?In the practice of content operation, we often face a challenge: how to balance the 'readability' of content with 'search engine friendliness'.A captivating title can catch the reader's attention and increase click-through rate;A title containing core keywords can help search engines better understand the content and improve rankings.AnQiCMS fully understands the importance of this requirement and therefore provides a flexible mechanism

2025-11-09