How to display the complete content and all fields of a single page?

Calendar 👁️ 75

In Anqi CMS, a single page is the basis for building static content pages such as 'About Us', 'Contact Information', and so on.Effectively displaying the complete content and all field information of these pages is crucial for website customization and user experience.AnQi CMS provides intuitive and powerful template tags, allowing you to easily display the single-page data configured on the backend on the website front end.

To display the complete content of a single page and all related fields, we mainly usepageDetailThis is the core template tag. This tag helps us to get detailed data of a specified single page and display it flexibly in the template.

UnderstandingpageDetailBasic usage of tags

pageDetailThere are two main ways to use tags. You can choose to get the value of a specific field on a single page, or you can assign the entire single page object to a variable and then access its various fields through this variable.

If your page is already a single-page detail page and you want to display the information of the current page, usually no additional ID needs to be specified,pageDetailThe tag automatically identifies the context of the current page. Of course, if you need to display single-page information with a specified ID or URL alias on a page, you can also addidortokenCall a parameter to achieve accurate invocation.

For example, to directly display the title of the current single page, you can write as follows:{% pageDetail with name="Title" %}. If you want to get the entire single page object and assign it to a variable namedcurrentPageThe variable can be operated in this way:{% pageDetail currentPage %}Next, you can access the various data of this single page bycurrentPage.Title/currentPage.Contentand so on to access the various data of this single page.

Display the core content and basic information of the single page.

A single page usually contains elements such as title, description, content, and other basic constituent elements. Anqi CMS provides clear calling methods for these core fields.

  • Page Title (Title)This is the main title of a single page, usually displayed at the top of the page or in the browser tab. You can use{% pageDetail with name="Title" %}Get it.
  • Page Content (Content)This is the main content of a single page, which often contains rich text, images, videos and other rich media information. When using{% pageDetail with name="Content" %}Be sure to use it in conjunction with the call.|safeThe filter is used to ensure that HTML content can be correctly parsed by the browser rather than being escaped as plain text. If your content is written in Markdown format, you can add it additionallyrender=trueparameters such as{% pageDetail with name="Content" render=true %}to ensure it is correctly converted to HTML.
  • Page Description (Description)This is usually a brief summary of the page, which is helpful for SEO optimization. It can be accessed through{% pageDetail with name="Description" %}Retrieve.
  • Page Link (Link)Get the complete URL of a single page, convenient for creating jump links in templates. The calling method is{% pageDetail with name="Link" %}.

In addition to these, you can also display the unique identifier of a single pageId({% pageDetail with name="Id" %}), as well as for customizing static URLs自定义URL (token).

Handle image and multimedia fields

A single page may also include images, such as banners at the top of the page or as thumbnails.

  • Page Thumbnail (Thumb / Logo)If the single page is set to thumbnail, you can access it through{% pageDetail with name="Thumb" %}or{% pageDetail with name="Logo" %}Get the image address. These fields are usually used for list display or as representative images on the page.
  • Page slideshow (Images): Some single pages may need to display a set of images as a carousel or gallery.Imagesfield will return an array of image addresses. You need to combineforloop tags to iterate and display these images.
    
    {% pageDetail pageImages with name="Images" %}
    {% for item in pageImages %}
        <img src="{{ item }}" alt="图片描述" />
    {% endfor %}
    
    If you only want to get the first picture from it, you can use array indexing to achieve this:{% set firstImage = pageImages[0] %}.

Custom template and SEO related fields

The AnQi CMS allows for independent templates to be set for single pages, as well as for detailed SEO optimization.

  • Single page template: An independent template file is specified for a specific single page in the background (for exampledownload.htmlAfter that, the system will prioritize using this template. This means you cantemplate/page/Create in the directorydownload.htmla file and write unique layout and style for the single page.

  • SEO Title (SeoTitle)/KeywordsThese fields are used to optimize search engine crawling and ranking. AlthoughpageDetailtags can obtain this information separately, but it is more recommended to usetdkLabels to manage and output pages uniformlytitle/keywordsanddescriptionbecausetdkLabels will intelligently combine and display this information according to the current page type (including single pages), and can also attach the website name and so on.

    For example, in yourbase.htmltemplate file<head>The area, you may have already set a similar TDK tag, which will intelligently obtain and display relevant information according to the type of the current page:

    <title>{% tdk with name="Title" siteName=true %}</title>
    <meta name="keywords" content="{% tdk with name="Keywords" %}">
    <meta name="description" content="{% tdk with name="Description" %}">
    

Summary

BypageDetailLabel, you can easily access and display all the information of the AnQi CMS single page, whether it is basic content, images, or SEO-related metadata.In actual operation, the key is to selectively call these fields according to your design requirements, and combine them with the loop, conditional judgment, and filter of the template engine to build a single page that is both beautiful and practical.Flexible use of these tools will make your website content management and display more efficient.


Frequently Asked Questions (FAQ)

1. Why does my single-page content (Content) display a bunch of HTML code instead of formatted text?This is usually because you are directly outputting in the template.Contentfield is used without|safeFilter. By default, Anqi CMS escapes the output HTML content to prevent XSS attacks.In order for the HTML content to be correctly parsed and displayed as formatted text, you need to outputContentwhen adding the field|safefor example:{{ currentPage.Content|safe }}. If the content is in Markdown format, make sure Markdown rendering is enabled and userender=trueParameter.

How to set a unique layout for a specific "About Us" page that is different from other single pages?You can edit the 'About Us' single page in the Anqi CMS backend, find the 'Single Page Template' setting item in 'Other Parameters'. Here you can enter the custom template filename, for exampleabout.html. Then, in your theme template folder (usually/template/您的主题名/page/create under the directoryabout.htmlThis file, and write its content according to your design requirements. In this way, only this specific single page will use the one you specifiedabout.htmltemplate, other single pages will continue to use the default onepage/detail.htmlTemplate.

3. How can I ensure that images in my single-page content display correctly and support lazy loading?Images in single-page content are usually inserted through a content editor, and by default, they are stored as part of the HTML.ContentIn the field. The first step to ensure that these images are displayed correctly is as mentioned in question 1, using it correctly|safeFilter. If you need lazy loading functionality, you may need to include a JavaScript library that supports lazy loading in your template. When callingContentyou can try addinglazy="data-src"such parameters as{% pageDetail with name="Content" lazy="data-src" %}This will notify the Anqic CMS to render the content.srcattribute is replaced withdata-src(Or any other attribute required by the lazy loading library you specify), thus coordinating with the front-end lazy loading script to achieve the effect.

Related articles

How to retrieve custom fields of a category on the category detail page?

When managing website content in AnQi CMS, we often need to make the category page not just a simple aggregation of document lists, but also able to carry more exclusive information to better guide users or display the characteristics of the category.It is particularly important to add and obtain custom fields for categorization at this time.By using these custom fields, you can make each category page unique, whether it's displaying a specific banner image, contact information, or the unique properties of the category.

2025-11-08

How to implement multi-level category nesting display in Anqi CMS?

The organization of website content is crucial for user experience and information retrieval efficiency.A clear and logical classification system can help visitors quickly find the information they need, and also lay a good foundation for the website's SEO.In Anqi CMS, implementing nested display of multi-level categories is the key to building this efficient content architecture.It is not just to list categories simply, but also to modularize and organize the content through hierarchical relationships, whether it is product display, article archive, or service introduction, it can be presented to users in a more intuitive way.

2025-11-08

How to get all category lists under a specified model in AnQi CMS?

AnQi CMS with its flexible content model design makes content management efficient and elastic.Whether it is an enterprise official website, a marketing website, or a personal blog, there may be a need to display the corresponding category list according to different content models (such as articles, products, or custom models).Understanding how to accurately retrieve these categories in the template is a key step in fully utilizing the powerful functions of AnQi CMS.In AnQi CMS, the content model is the foundation of organizing content.

2025-11-08

How to get and display category thumbnails or Banner carousel?

The attractiveness of visual content is crucial in website operation.A well-designed category thumbnail and an eye-catching banner carousel not only beautifies the website interface but also effectively guides users to browse, enhancing the overall professionalism and user experience of the website.AnQiCMS (AnQiCMS) offers powerful and flexible features that allow you to easily manage and display these important visual elements.This article will provide a detailed introduction on how to obtain and display category thumbnails or Banner carousel in Anqi CMS.

2025-11-08

How to retrieve and display all single page lists in AnQi CMS?

Managing and displaying single pages in Anqi CMS is one of the basic functions for website content construction.A single page is usually used to create pages with relatively fixed structures and independent content, such as 'About Us', 'Contact Information', or 'Service Introduction', etc.If you wish to display a list of single pages in a specific area of the website, such as the footer navigation or sidebar, AnQi CMS provides a very intuitive and flexible way to achieve this.

2025-11-08

How to display the document list under the specified Tag label and implement pagination?

In AnQi CMS, the Tag (tag) function is an important tool for organizing and associating content, enhancing user experience and website SEO performance.When your website content becomes richer, how to effectively display the document list under a specified Tag and provide clear pagination navigation is crucial for the discoverability of content and the continuous browsing of users.This article will give you a detailed explanation of how to easily implement this feature by using several key template tags in AnqiCMS.

2025-11-08

How to get and display detailed information of a single Tag label (Title, Description, Logo)?

In AnQi CMS, tags (Tag) are an important way to organize and associate content.Sometimes, we need not only list the tags but also hope to display detailed information about a single tag on an independent page or in a specific area, such as its title, description, and even a representative logo.The AnQi CMS provides a concise and efficient method to meet this requirement. ### Understanding Tag Information Source In the Anqi CMS backend, you can configure the details for each tag.

2025-11-08

How to display the website name, Logo, filing number, and copyright information in Anqi CMS?

When operating a website, the website name, logo, filing number, and copyright information are core elements that constitute the brand image, establish user trust, and meet legal compliance requirements.For users of AnQiCMS, the system provides an intuitive and flexible way to manage and display this information, making your website not only rich in content but also professional and perfect in detail. ### One, centralized management: Configure these key information in the background One of the design philosophies of AnQi CMS is to make website management simple and efficient.

2025-11-08