In the daily operation of websites, independent pages such as 'About Us' and 'Contact Information' play a crucial role in conveying core information and shaping the brand image.As content operators, we often need to have a deep understanding of the composition of these pages, including their main content, SEO information, and all associated 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 obtain 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."Independent pages differ from types that need to follow specific content models such as articles and products, as they are more focused on displaying unique, static, or relatively fixed information.pageDetailThis tag is the core entry point to obtain all relevant information of an independent page. We can obtain various components of the page by specifying parameters.
Deeply extract 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 templates, we can use to access this part of the content.pageDetailTag, 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 firstpageDetailLabel retrieves the main content of the current independent page and assigns it to a variable namedpageContent. Then,{{ pageContent|safe }}outputs this content.|safeThe filter plays an important role here, it tells the template engine,pageContentThe content in the variable is carefully designed and verified HTML code, which can be directly parsed and displayed on the page without escaping, which is crucial for displaying the content edited by a rich text editor.
If you need to get the content of a specific ID or URL alias page independently, rather than the current page you are visiting, you just need to specify the parameter, for example: pageDetailtag.idortokenthe parameter, for example: {% pageDetail pageContent with name="Content" id="10" %}This will fetch the content of the standalone page with ID 10.
Mine the SEO information of standalone pages
For any page that wants to perform well in search engines, SEO information is indispensable. Anqi CMS provides comprehensive SEO field settings for independent pages, and we can easily access them through template tags:
Page Title (Title)This is one of the most important elements in the Search Engine Results Page (SERP). You can use
tdktags to get the page title:{% tdk with name="Title" %}This tag's advantage lies in its ability to intelligently organize the title based on the current page type (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 for the standalone page itself, you can also use{% pageDetail with name="Title" %}.page keywords (Keywords): Although the weight of keywords in modern SEO has decreased, they are still an important clue for page theme. Through
{% tdk with name="Keywords" %}you can get the keywords for independent page settings.Page Description (Description))This brief text 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 page description information.Canonical URL (Standard URL)When there are multiple URL access paths to the content, setting a canonical URL 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 retrieve the standard link, if it exists, then use it as:
<link rel="canonical">Tags output to the page:<head>Part.
Place these SEO-related information appropriately on the page.<head>The area, where these are placed, can significantly enhance the performance of an individual page in search engines.
Capture visual elements: the handling of associated images
The images on the page are important elements that attract users and enhance the readability of the content. Anqi CMS allows us to configure multiple types of images for independent pages and provides flexible access methods:
Thumbnail or Logo of the page: Each independent page can specify a representative image as its thumbnail or Logo. You can get the URL of these images by
{% pageDetail with name="Logo" %}or{% pageDetail with name="Thumb" %}to obtain these image URLs.Slide show or albumWhen an independent page needs to display a set of images (for example, "Company album" or "Product carousel"),
pageDetailTagsname="Images"The parameter comes into play. It returns an array containing all image URLs, and you can use a loop tag to display them one by one: “`twig {% pageDetail pageImages with name=“Images” %} {% for imgUrl in pageImages %}{% endfor %}