As an experienced website operation expert, I know that every detail can affect the performance of a website in search engines. Today, let's delve into AnQiCMS (AnQiCMS) in detail.categoryListThe list of categories generated by tags, the degree of friendliness of its HTML structure to search engine spiders, and how we can cleverly optimize it to enhance the website's SEO performance.
The Anqi CMS has been favored by operators since its inception for its SEO-friendly design concept.The built-in features such as pseudo-static, 301 redirection, and advanced SEO tools all reflect this point.And the category list as a core element of website content organization and an important part of user navigation, the optimization of its HTML structure plays a crucial role in improving the website's crawling efficiency, content understanding, and ranking.
UnderstandingcategoryListLabel: Data provider rather than HTML generator
In the template system of Anqi CMS,categoryListThe role of the label is that of a data provider rather than a direct HTML structure generator. This means that when you use{% categoryList categories with moduleId="1" parentId="0" %}When such a tag is used, it will retrieve a series of category data (such as category ID, title, link, description, etc.) and assign it tocategoriesThis variable. As for how these data are finally displayed on the page and what kind of HTML structure is generated, it completely depends on the template developer.forHow to write in the loop.
This is actually a very flexible and powerful design.It grants website operators or template developers a great degree of freedom, allowing them to precisely control the HTML output of category lists based on specific SEO strategies and user experience requirements.categoryListThe tag itself, but how we use the data it provides to build more user-friendly HTML structures for search engine crawlers.
The key principles for optimizing the HTML structure of the category list.
To make the category list friendly to search engine crawlers, we need to follow several core principles:
Use of semantically meaningful HTML tags:Search engine spiders will parse the HTML structure to understand the hierarchy and type of content when crawling pages. For list-like content, use semanticized
<ul>(unordered list) or<ol>(Ordered list) cooperation<li>(List item) label, compared to just using<div>Label stacking can make it clearer that this is a group of related list data. In each list item, the category name is usually used as a link, at this time<a>Labels are理所当然的。Clear and descriptive anchor text:Anchor text is the key for search engines to understand the content of the link target.When the category name is used as the anchor text of a link, make sure it accurately and concisely describes the content of the category.For example, the product category is not as specific as 'smartphone' or 'laptop'.
item.TitleVariables can be used directly as anchor text, which naturally ensures its descriptiveness.Optimized URL structure:
categoryListTag throughitem.LinkThe variable provides links for each category. The powerful support of AnQi CMS in pseudo-static rules ensures that these links are usually optimized, easy to understand static URLs (such as:/article/category/seo-optimization.htmlSuch a URL is user-friendly and also convenient for search engines to crawl and understand.Avoid redundant information and content duplication:In the category list, if each category item contains a large amount of redundant text, it may dilute the thematic relevance of the page.At the same time, if there is a lot of duplicate content between the category page and the ordinary article page, it should be used to avoid potential duplicate content problems by utilizing the TDK settings and Canonical tags provided by Anqie CMS.
item.Description(Category summary) Can be used to enhance the descriptiveness of anchor text when necessary, but it is generally not recommended to display too much in the category list.item.Description.Reasonably control the depth of internal links: The category list is an important part of the internal link system of the website.By using multi-level classification nesting, we can guide the crawler to more deeply extract website content, while placing important pages at shallower link levels to enhance their weight.
Actual optimization strategy and code examples
After understanding the basic principles, let's see how to practice specifically in the Anqi CMS template:
First, a basic, semantic classification list structure is usually like this:
<nav aria-label="分类导航">
<ul class="category-list">
{% categoryList categories with moduleId="1" parentId="0" %}
{% for item in categories %}
<li class="category-item">
<a href="{{ item.Link }}" title="查看所有{{ item.Title }}相关的文章">
{{ item.Title }}
</a>
</li>
{% endfor %}
{% endcategoryList %}
</ul>
</nav>
This code has well followed the principles of semantics and anchor text.item.LinkThe URL after AnQiCMS pseudo-static processing is output,item.Titlewhich provides clear anchor text.navandaria-labelIts use also improves accessibility, indirectly beneficial for SEO.
Further optimize: Handle multi-level categories and link depth
If your website has complex category hierarchies, you can use nestingcategoryListTags can be used to implement multi-level navigation, which helps search engines understand the hierarchical structure of a website:
<nav aria-label="主分类导航">
<ul class="main-category-list">
{% categoryList topCategories with moduleId="1" parentId="0" %}
{% for topCat in topCategories %}
<li class="main-category-item {% if topCat.HasChildren %}has-children{% endif %}">
<a href="{{ topCat.Link }}" title="{{ topCat.Title }}">
{{ topCat.Title }}
</a>
{% if topCat.HasChildren %}
<ul class="sub-category-list">
{% categoryList subCategories with parentId=topCat.Id %}
{% for subCat in subCategories %}
<li class="sub-category-item">
<a href="{{ subCat.Link }}" title="{{ subCat.Title }}">
{{ subCat.Title }}
</a>
</li>
{% endfor %}
{% endcategoryList %}
</ul>
{% endif %}
</li>
{% endfor %}
{% endcategoryList %}
</ul>
</nav>
We used heretopCat.HasChildrento determine if there are subcategories and to nest another one below itcategoryListDynamically generate multi-level navigation. This structure clearly displays the information architecture of the website and is very friendly to crawlers.
Enhance user experience and SEO with categorized images.
If your category has a Logo or thumbnail (item.Logooritem.ThumbThey can be appropriately displayed in the list, which can enhance user experience and also provide additional visual information for search engines, enriching the display of search results pages:
<ul class="category-grid">
{% categoryList categories with moduleId="2" parentId="0" limit="10" %}
{% for item in categories %}
<li class="category-card">
<a href="{{ item.Link }}" title="探索{{ item.Title }}">
{% if item.Thumb %}
<img src="{{ item.Thumb }}" alt="{{ item.Title }}分类图片" loading="lazy">
{% endif %}
<h3>{{ item.Title }}</h3>
</a>
</li>
{% endfor %}
{% endcategoryList %}
</ul>
Here, we utilizeditem.Thumband as the image of the category card,