How to get the complete content, SEO information, and associated images of a single page?

In daily website operations, independent pages such as "About Us", "Contact Information", etc., bear the important responsibility of conveying core information and shaping the brand image.As content operators, we often need to gain a deep understanding of the structure of these pages, including their main content, SEO information, and all related image resources, in order to carry out fine management, optimization iteration, or flexible page layout.AnQiCMS provides a straightforward and powerful template tag system, making it easy to retrieve these page data.

Basic understanding of standalone pages in Anqi CMS

In the Anqi CMS backend, independent pages are usually created and maintained under 'Page Resources' in 'Page Management'.Different from articles, products, and other types that need to follow specific content models, independent pages are more focused on displaying unique, static, or relatively fixed information.To obtain detailed data for these independent pages, we mainly use the Anqi CMS template engine providedpageDetailThe tag is the core entry point to obtain all relevant information of an independent page. We can obtain the various components of the page by specifying parameters.

In-depth acquisition of the core content of an independent page

The core of an independent page lies in its main content, usually a combination of carefully written text, images, and multimedia. In the Anqi CMS template, we can usepageDetailtags, and specifyname="Content"Parameter.

For example, in your template file, you might see the following code:

{% pageDetail pageContent with name="Content" %}
{{ pageContent|safe }}

This line of code first goes throughpageDetailThe tag to get the main content of the current independent page and assign it to a variable namedpageContentThe variable is followed by.{{ pageContent|safe }}This content will be output.|safeThe filter plays an important role here, it tells the template engine,pageContentThe content within the variable is carefully designed and verified HTML code that can be directly parsed and displayed on the page without escaping, which is crucial for displaying rich text editor edited content.

If you need to get the content of an independent page with a specific ID or URL alias, rather than the page you are currently visiting, just inpageDetailthe tag withidortokenthe parameter, such as:{% pageDetail pageContent with name="Content" id="10" %}This will retrieve the content of the independent page with ID 10.

Mining SEO information of the independent page.

For any page that hopes to perform well in search engines, SEO information is indispensable. Anqi CMS provides a comprehensive SEO field setting for independent pages, and we can easily obtain them through template tags:

  1. Page Title (Title)This is one of the most important elements in the search engine results page (SERP). You can usetdktags to get the page title:{% tdk with name="Title" %}. This tag can intelligently organize the title according to the type of the current page (including standalone pages) and optionally add a website name suffix, such as{% tdk with name="Title" siteName=true %}. If you only need the title set on the independent page itself, you can also use{% pageDetail with name="Title" %}.

  2. Page Keywords (Keywords)However, keywords are still an important hint for the page theme in modern SEO, despite their decreased weight.{% tdk with name="Keywords" %}You can get the keywords for the independent page settings by doing so.

  3. Page Description (Description)This is a brief text that usually appears as a summary of the page content in search engine results, and is a key factor in attracting users to click. You can use{% tdk with name="Description" %}or{% pageDetail with name="Description" %}to obtain the description information of the page.

  4. Standard Link (Canonical URL)When there are multiple URL access paths for content, setting a standard link can prevent search engines from treating it as duplicate content.tdkTags also support retrieval:

    {%- tdk canonical with name="CanonicalUrl" %}
    {%- if canonical %}
    <link rel="canonical" href="{{canonical}}" />
    {%- endif %}
    

    This code will first try to obtain the specification link, if it exists, then it will output it as<link rel="canonical">the tag to the page<head>Section.

and properly place these SEO-related information on the page<head>An area that can significantly improve the performance of an independent page in search engines.

Capture visual elements: processing associated images.

The image on the page is an important element that attracts users and enhances the readability of the content. Anqi CMS allows us to configure multiple types of images for independent pages and provides flexible access methods:

  1. Page thumbnail or LogoEach independent page can specify a representative image as its thumbnail or Logo. You can{% pageDetail with name="Logo" %}or{% pageDetail with name="Thumb" %}to get the URLs of these images.

  2. Slideshow or galleryWhen an independent page needs to display a set of images (for example, "corporate album" or "product carousel"),pageDetaillabel'sname="Images"The parameter comes into play. It returns an array containing all image URLs, and you can use loop tags to display them one by one: “`twig {% pageDetail pageImages with name=“Images” %} {% for imgUrl in pageImages %}Independent page image{% endfor %}