When we explore the mysteries of AnQi CMS, we often need to obtain detailed information about the documents.archiveDetailThe interface provides us with rich document data, and there is nested in it.categoryAn object, then, is a often overlooked yet extremely important repository of information.It is not just a simple classification ID, but a complete entity containing all the metadata of the classification, which provides great convenience for us to deeply understand the context of the document and to carry out refined content display.
This nested one.categoryAn object, like the ' household register ' of a document, records all the details of the document's classification. It first clearly tells us the unique identifier of this classification.idand its direct superior category of,parent_id.By these two fields, we can clearly outline the hierarchical structure of categories, for example, a document may belong to the category of "front-end development", and "front-end development" may belong to the higher-level category of "technical tutorials".title(i.e., the category name) andurl_token(Used to build the category page URL alias) is also core information, they are the foundation for displaying category names and link jumps on the front-end page.
In addition to this,categoryThe object also provides critical data for the website's search engine optimization (SEO).seo_title/keywordsanddescriptionThese fields directly correspond to the SEO title, keywords, and description of the category page. This means that when we are displaying document details, if we need to refer to the SEO information of the category it belongs to, we can directly fromcategoryObtained from the object without additional queries. This is very helpful for improving the overall SEO performance of the website, as well as generating more accurate summaries when sharing on social media.
In terms of content presentation,categorythe object also provides rich visual and text information without sparing any effort. If the category itself has specific introductory content, thencontentThe field will contain this text detail. In addition,images/logoandthumbThey represent the category banner image, main logo, and thumbnail.These image resources make the classification more visually identifiable, bringing a more intuitive experience to users in scenarios such as category navigation and related recommendation modules.
Finally, we can also obtain some important technical and management properties fromcategorythe object.module_idIt specifies the content model that the category belongs to (such as article model, product model, etc.),typeThe field distinguishes the nature of the category, whether it is a common category list (value 1) or an independent single page (value 3).sortThe field is used to control the display order of the categories, andcreated_time/updated_timeandstatusWaiting for timestamp and status information makes it convenient for us to manage, filter, and display content.
In short,archiveDetailNested in the interfacecategoryAn object is a comprehensive data package that tightly associates documents with their categories, providing a one-stop solution for obtaining classification information.This greatly simplifies the work of developers in building complex page logic and allows content operators to present content to users in a richer and more precise way, thereby enhancing the professionalism and user experience of the website.
Frequently Asked Questions (FAQ)
1. Why am IarchiveListIn the document data obtained from the interfacecategoryObjects are sometimes empty, but inarchiveDetailthey are complete?
archiveListThe interface is mainly used to get a list overview of documents, for performance considerations, it usually only returns the core information of the documents, such ascategory_idIt will not load all the detailed data of the category. Therefore,archiveListofcategoryObjects are usuallynullor contain very little information. Only when you callarchiveDetailWhen the complete information of a single document is obtained through the interface, only then will the security CMS encapsulate all the detailed information of the category to which the document belongs intocategoryReturn within the object to ensure the most comprehensive context is provided.
2.categoryWithin the objecttypeField, the difference between “1 Category, 3 Single Page” is what?
typeField used to identify the category attribute. WhentypeThe value is1When, it indicates that this is a common category, it usually contains a series of documents (such as an article list), used for aggregating and displaying related content. WhiletypeThe value is3It indicates that this is a "single-page", which means that the category itself is an independent page with its own content, it may not contain a list of sub-documents, but instead directly displayscontentDetailed content of the field, such as "About Us
3. If I only need the name of the category (title) and the link (throughurl_token generated), use it directly.archiveDetailWould the interface fetching cause data redundancy? Is there a lighter-weight way?
Yes, if your needs are very simple, just to display the category name and link, and it has already passedarchiveDetailThe interface obtained the document data, then extract directly from the nestedcategoryobjecttitleandurl_tokenIt is a very convenient and efficient approach without causing additional performance burden. But if you need detailed information of a category rather than as a subordinate category of a document, or if you want to get a list of all categories, it is recommended to use a special one.categoryDetailInterface (Get detailed category information by category ID or alias) orcategoryListInterface (Get multiple category lists), these interfaces will provide more accurate and lightweight data according to your specific needs.