How to use the "offset,limit" mode in the `limit` parameter supported by `categoryList`, and what scenarios are applicable?

Calendar 👁️ 82

Exquisite control of classification list: AnQiCMScategoryListinoffset,limitPractical application of patterns

As an experienced website operations expert, I know how important it is to have flexible data display capabilities when building and optimizing website content. AnQiCMS, with its concise and efficient features, provides us with many powerful template tags, among whichcategoryListTags are the core tools for managing the classification content of a website. Today, let's delve deeper into it.categoryListin the taglimitAn advanced usage of a parameter——the "start position, number" pattern, see how it helps us achieve more refined and dynamic content layout.

Mastering the data stream: understandinglimitParameter's 'start position, number' pattern

We all know,categoryListlabel'slimitThe parameter can be used to control the number of categories we want to retrieve, such aslimit="10"It will fetch the first 10 categories. However, AnQiCMS provides a more operational mode on this basis:limit="起始位置,数量".

This pattern allows us to precisely extract the part we want from the classified data stream, just like 'slicing'. Specifically:

  • Starting position (Offset)It refers to the starting point of the category list you want to retrieve. Please note that in the AnQiCMS mode,The starting position is based on index 1.For example, if you want to start from the second category, the starting position is2.
  • Quantity (Limit)It indicates starting from the specified position and getting a total of how many category data items you want.

For example,limit="3,5"It means that AnQiCMS will find the 3rd category from your category data, then start counting from it, and extract a total of 5 categories (i.e., the 3rd, 4th, 5th, 6th, and 7th categories).This fine control ability provides us with infinite possibilities for creating diverse content displays.

Practical scenario: Make your website content layout more outstanding.

Mastered起始位置,数量Pattern, we can make full use of its great value in various operational scenarios:

1. Homepage modular layout: Create a personalized content display area

Imagine your website's homepage, it might need a prominent 'Hot Categories' section to display the top 3 categories; followed by a 'Recommended Categories' section below, showcasing the next 5 categories; and further down, a 'Latest Categories' section to display the newest categories.

  • Popular category area (first 3):
    
    {% categoryList hotCategories with moduleId="1" parentId="0" limit="3" %}
        {# 渲染前3个热门分类 #}
    {% endcategoryList %}
    
  • Recommended category area (4th to 8th):
    
    {% categoryList featuredCategories with moduleId="1" parentId="0" limit="4,5" %}
        {# 渲染第4到第8个推荐分类 #}
    {% endcategoryList %}
    
    In this way, you can easily split the category list into multiple visually independent blocks, each block displaying different categories, thereby making the home page content richer and the layout more flexible, avoiding the boredom of a single list.

2. Pagination and "Load More" optimization: improving user experience

Although AnQiCMS provides a comprehensivetype="page"CombinepaginationTags implement traditional pagination, but in some cases, we may need a more flexible "load more" mechanism, or load specific batches of content on demand without displaying a complete pagination navigation.

  • Loaded initially (first 10):
    
    {% categoryList initialLoad with moduleId="1" parentId="0" limit="10" %}
        {# 首次加载页面时显示前10个分类 #}
    {% endcategoryList %}
    
  • Click 'Load More' for the next 10 (11th to 20th):(This usually requires dynamic modification with JavaScript)offsetValue)
    
    {% categoryList nextLoad with moduleId="1" parentId="0" limit="11,10" %}
        {# 再次点击加载更多时,从第11个分类开始显示10个 #}
    {% endcategoryList %}
    
    This pattern makes the "load more" feature logic clearer, and can accurately obtain the next batch of data from the server based on user actions such as scrolling and clicking, providing a smooth browsing experience.

3. Flexible display of sidebars or widgets: precise control of local content

The sidebar, footer, or various widgets on a website often need to display simplified categories

Related articles

How to get the category details information of a specified ID through the `categoryList` tag instead of the current page?

As an experienced website operations expert, I know how important it is to flexibly obtain and display data when managing content.Especially when building the AnQiCMS website, we often encounter situations where we need to obtain specific category information rather than the context of the current page.Today, let's delve deeply into how to cleverly use AnQiCMS template tags to accurately obtain the category details you want.How to accurately locate: How to get the category details of a specified ID instead of the current page?In AnQiCMS template development, `categoryList` and

2025-11-06

How `categoryList` and `archiveList` work together to display the latest few documents under each category?

As an experienced website operations expert, I am well aware of the powerful aspects of a content management system (CMS), not only in terms of its backend functionality, but also in the flexibility of its frontend content display.AnQiCMS (AnQi CMS) is exactly such an outstanding tool, based on the high-performance architecture of the Go language,配合 its concise and efficient template tag system, it allows us to easily handle various complex content display needs. Today

2025-11-06

Can the `categoryList` tag return the `item.Description` field for SEO description on the category page?

In website operation, the SEO description (Meta Description) of the category page is one of the key elements to improve search engine ranking and click-through rate.A well-written description that not only accurately summarizes the page content but also attracts users to click.For website administrators and content operators using AnQiCMS, how to efficiently and accurately utilize the system functions to manage these descriptions is a common issue.Today, let's delve deeply into a specific issue: `categoryList` tag returns the `item'

2025-11-06

How to highlight the category link being accessed according to the `item.IsCurrent` field?

As an experienced website operations expert, I know that user experience is the foundation of website success.How to help visitors quickly locate their current position on a content-rich website and clearly understand the navigation structure is the key to improving user satisfaction.Today, let's delve deeply into a very practical and elegant feature of Anqi CMS - how to cleverly highlight the current category link accessed using the `item.IsCurrent` field, thereby significantly optimizing the navigation experience of the website.

2025-11-06

In multi-site management, how do you call the category data under other sites using `categoryList`?

As an experienced website operations expert, I am well aware that how to efficiently manage content and achieve data interconnectivity in a complex website ecosystem is the key to improving operational efficiency.AnQiCMS (AnQiCMS) with its powerful multi-site management capabilities, provides us with such possibilities.Today, let's delve into a very practical scenario in multi-site operations: how to elegantly call the classification data under other sites using the `categoryList` tag.### AnQi CMS Multi-Site Management: `categoryList`

2025-11-06

If the category has not set Logo or Thumb, what path will `categoryList` return, and how to set the default image?

In the daily operation of AnQiCMS, fine-grained content display is a key factor in improving user experience and the professionalism of the website.The importance of images as visual elements is self-evident.However, many operators may encounter the situation that the Logo or Thumb image of the category is not set when calling the category information using tags like `categoryList`, which may cause blank or broken images to be displayed on the front end.Today, let's delve deep into this issue and provide an elegant solution.

2025-11-06

Does the `categoryList` tag support custom sorting rules to display the category list? (The document does not directly mention it, but it can be explored)

As an experienced website operations expert, I know that how to flexibly display and organize content in a content management system is the key to improving user experience and SEO effectiveness.AnQiCMS (AnQiCMS) provides a solid foundation for content operation with its efficient and customizable features.Today, let's delve deeply into a core issue about the `categoryList` tag: does it support custom sorting rules to display the category list?### Category List Label in AnQi CMS: `categoryList` Overview In AnQi CMS

2025-11-06

How to avoid `categoryList` automatically reading the current page category ID and force it to only display top-level categories?

In the flexible content management world of Anqi CMS, template tags are the bridge between us and data interaction.Among them, the `categoryList` tag is undoubtedly one of the core tools for building website navigation and content lists.However, senior operators often encounter a scene: when the website is on a specific category page, the `categoryList` tag will 'intelligently' read the current category ID and use it as the context for data display.This is extremely convenient in many cases, such as displaying the subcategories or peer categories of the current category.

2025-11-06