When using AnQi CMS for website development or content integration, it is often necessary to obtain documents and their related information. One common question is whether it is possible to obtain detailed information about the category to which the document belongs, especially likecategory.contentSuch a field? According to the document provided by Anqi CMS, we can clearly find the answer.
To put it directly,Yes, the document detail interface of Anqi CMS (/api/archive/detailIndeed, it provides detailed content of the document category, namelycategory.contentfield.
When we request data for a specific document through the document detail interface, the returneddataobject will contain a field namedcategoryThe child object. ThiscategoryThe object not only contains basic information about the category, such as category ID (id), category name (title), URL alias (url_token) and descriptions (description)etc., what is more important, it also directly provides the "content details" of this category(content)
This means that as a user, you no longer need to initiate additional API requests to obtain the detailed content of the category individually. All key information related to the document and its directly associated categories can be obtained in onearchiveDetailThe interface retrieves this. This design greatly simplifies the development process, reduces the number of requests to the server, thereby improving the data loading efficiency and user experience.
For example, if you are building an article detail page, you not only need to display the title, content, author, and other information of the article itself, but you may also need to display some introductory text about the category of the article in the page sidebar or footer. At this point, byarchiveDetailThe interface returnsdata.category.contentField, you can directly retrieve and render the detailed content of these categories without an additional callcategoryDetailInterface. This is a very practical feature for building efficient and responsive front-end applications.
Generally speaking,category.contentThe field will contain rich text content for categories, such as detailed descriptions formatted with HTML tags, specific page descriptions, etc. This depends on the backend management system of the category.内容详情How it is filled. Therefore, when displayed on the front-end, it may be necessary to parse or render this part of the content appropriately.
Frequently Asked Questions (FAQ)
1. Which API should I use if I only need to retrieve the detailed content of a category and not any document information?
If you only need to retrieve the detailed information of a specific category, including itscontentfield, without needing to associate any specific document, then it is more recommended to use the "Get Category Details Interface" provided by Anqi CMS (/api/category/detailThis interface is specifically designed to retrieve complete data for a single category, making it more direct and efficient.
2.category.contentIs the format of the content fixed? For example, is it always HTML?
category.contentThe format of the field content depends on the editor used by the Anqi CMS backend when editing categories and the actual input of the administrator.This is usually rich text content containing HTML tags.It is recommended to perform safe HTML rendering based on actual content when displaying on the front end to avoid potential XSS risks.
3.archiveDetailThe interface returnscategoryDoes the object information contain all fields? Does it include all fields of the category?
archiveDetailThe interface returnscategoryThe object contains most of the core fields of the category, such asid,title,description,contentThis is sufficient for most daily use scenarios. If you need all the fields for classification (including some less commonly used fields), you can consider combining them.archiveDetailInterface retrievalcategory_idThen callcategoryDetailRetrieve the complete detailed information of this category.