In website operation, set clear and targeted SEO titles for content (seo_title), keywords (keywords) and descriptions (descriptionIt is a key step to improve search engine ranking.AnQiCMS (AnQiCMS) provides a convenient way to manage and obtain these important SEO metadata.Whether you need to dynamically set this information for a single page or process a large amount of content in bulk, it can be easily achieved through the provided API interface.

Get SEO information for a single document

When you need to obtain the SEO title, keywords, and description of a specific document, you can use the document detail interface of Anqi CMS.This interface can return a complete document data, which includes these SEO-related fields.

In particular, you can send a GET request to the following address to retrieve document details:

{域名地址}/api/archive/detail

When making a request, you need to provide the unique identifier of the document. Typically, this can be the document ID (id) or the URL alias (filenameFor example, if you know the document ID is 1, then your request parameters may beid=1.

The data returned by the interface will bedataThe object contains the following fields, which are exactly the SEO information you are looking for:

  • seo_title(string type): This field stores the SEO title specifically set for this document.It is usually more concise than the title of the document itself, or contains more keywords, intended to attract search engine users to click.
  • keywords(string type): This field contains keywords highly related to the document content, usually separated by commas.These keywords help search engines understand the document theme and display it when users search.
  • description(string type): This field is a brief overview of the document content, used to display in search engine results pages (SERP).A good description can effectively attract users and improve click-through rate.

By parsing the return data of this interface, you can easily apply these key SEO information to your frontend page, thereby optimizing the single-page search engine performance.

Bulk retrieval of document SEO information

In some cases, such as generating lists for category pages or tag pages, or building in-site search results, you may need to batch retrieve SEO information for multiple documents.At this time, the document list interface of Anqi CMS can come into play.

You can retrieve the document list by sending a GET request to the following address:

{域名地址}/api/archive/list

This interface supports various filtering and sorting parameters, such as you can limit the range of returned documents based on model ID (moduleId), classification ID (categoryId) as well, and you can also limit throughlimitandpageThe parameters are for pagination. For example, you can specifymoduleId=1andtype=pageto get the list of all documents under the article model (pagination mode).

in the interface returneddataIn the array, each element represents a document and also containsseo_title/keywordsanddescriptionThese three important fields. This means you do not need to call the detail interface one by one, but can obtain the SEO metadata of multiple documents at one time, greatly improving the efficiency of data acquisition.

For example, you can use this feature to dynamically generate category pages.meta title/meta keywordsandmeta descriptionOr display a concise description below each article item on the website, increasing the information density of user browsing.

Optimize practice

After obtaining this SEO information, the next task is how to effectively use it.The website's SEO performance not only depends on high-quality content, but also cannot do without precise metadata settings.<head>Tags within are the basis for good search engine optimization.In addition, regularly check the filling of this metadata to ensure its relevance to the content, and adjust according to the changes in search engine algorithms, which will help your website stand out in a competitive online environment.

Frequently Asked Questions (FAQ)

  1. If the document'sseo_title/keywordsordescriptionWhat if the return is empty?If these fields return empty, it usually means that the SEO-related metadata has not been manually filled in when editing documents in the Anqi CMS backend. In this case, you can consider several ways: one is to return an empty value, allowing search engines to decide on the content to display; two is to use the document'stitleasseo_titleExtract an abstract from the content asdescriptionAnd generate based on document tags or categorieskeywordsAs a supplement. Of course, the most recommended approach is to perfect this information in the background management to achieve more accurate SEO effects.
  2. ObtainedkeywordsHow to parse a string into multiple keywords for use?As described in the API documentation,keywordsA field is a string type. In practice, Anqi CMS usually separates multiple keywords with a comma (,) separated in this string. Therefore, you can use the string splitting feature of programming languages (such as JavaScript'ssplit(','),Python insplit(','))Parse it into a keyword array and then display or further process it accordingly.
  3. How to obtain SEO information for other content types (such as categories, single pages) except for documents?AnQi CMS took into account the SEO needs of different content types during design. In addition to the document detail interface, the category detail interface (/api/category/detail) and the single page detail interface (/api/page/detail) It also provides similar SEO fields. You just need to call the corresponding interface, pass in the category ID or single page ID (or URL alias), and you can find it in the returneddataobject.seo_title/keywordsanddescriptionThe retrieval and usage method is similar to the document details interface.