How to set up an independent display layout and elements for the single page of AnQiCMS, such as the 'About Us' page?

Calendar 👁️ 69

In AnQiCMS, setting independent display layouts and elements for single pages like "About Us" can make the website content more distinctive and professional.AnQiCMS with its flexible template engine and modular design makes this process intuitive and efficient.

Why do you need to customize a dedicated layout for the single page?

When using AnQiCMS to build websites, we often encounter such needs: some specific pages, such as "About Us

  1. Improve user experience:A unique layout can better guide users to focus on core information, provide a clearer reading path, and avoid information overload.
  2. Strengthen brand image:Exclusive design can better convey corporate culture and brand characteristics, making the "About Us" page more than just a pile of text and becoming a vivid carrier of the brand story.
  3. Optimize SEO performance:By customizing the content structure and element arrangement, it can better highlight the key keywords on the page, improving the search engine's crawling and understanding efficiency.
  4. To implement specific functions:For example, integrating maps and forms on the "Contact Us" page; displaying team member photo walls and company development timeline on the "About Us" page, all of which require specific layout support.

How to implement a single-page custom layout in AnQiCMS?

AnQiCMS is developed based on Go language, but the front-end template uses syntax similar to Django's template engine, files are usually stored with.htmlsuffixes stored in/templateUnder the directory. This design makes template development intuitive and efficient.

The core lies inCustom template filesandBackground association.

First, we need to create a file named specifically for the "About Us" page under the current template directory.page/about.htmlThisabout.htmlIt is the exclusive layout file for the "About Us" page.

AnQiCMS is very flexible in template design, and it supports several single-page template naming conventions by default:

  • page/detail.htmlThis is the universal default template for all single pages.
  • page/detail-{单页ID}.htmlIf you want to customize according to the page ID, you can use this format.
  • page/{自定义URL别名}.htmlThis is the most flexible way, you can specify a recognizable name for the page, for example, create a "About Us" pagepage/about.html.

Next, log in to the AnQiCMS backend, navigate to 'Page Resources' under 'Page Management'. Find or create your 'About Us' single page, and enter the name of the template file you just created in the 'Single Page Template' field on the editing page.about.htmlAfter saving, when you visit the "About Us" page, the system will automatically loadpage/about.htmlfile as its layout.

Add page elements in the custom layout

Once you have a dedicated one,page/about.htmlTemplate file, we can use various template tags (tags) provided by AnQiCMS to fill in content and dynamic elements.

  1. Get the core content of a single page:Inabout.htmlIn Chinese, you can pass throughpageDetailEasily get the title, text, description, thumbnail, etc. of the “About Us” page with tags.

    • Get page title:{% pageDetail with name="Title" %}
    • Get page content:{% pageDetail pageContent with name="Content" %}{{ pageContent|safe }}(Note that you need to|safeFilter to ensure that HTML content renders correctly
    • Get page description:{% pageDetail with name="Description" %}
    • Get uploaded Banner image or group image:{% pageDetail pageImages with name="Images" %}(usually usedpageImages[0]Get the first image as a Banner)
  2. Display the general information of the website: systemLabels can help you call the website name, Logo, filing number, and other settings from the global settings.

    • Website Name:{% system with name="SiteName" %}
    • Website Logo:<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
  3. Display contact information: contactThe label can conveniently display the information in the background "Contact Information Settings", which is very suitable for the part that contains contact information on the "About Us" page.

    • Contact Phone:{% contact with name="Cellphone" %}
    • Contact Email:{% contact with name="Email" %}
    • Company Address:{% contact with name="Address" %}
  4. SEO Optimization Elements: tdkThe tag is used to set the page's Title, Keywords, Description, and Canonical URL, which is crucial for search engine optimization.

    • Page Title:<title>{% tdk with name="Title" siteName=true %}</title>(siteName=trueCan automatically append website name)
    • Page Keywords:<meta name="keywords" content="{% tdk with name="Keywords" %}">
    • Page Description:<meta name="description" content="{% tdk with name="Description" %}">
    • Standard Link:{%- tdk canonical with name="CanonicalUrl" %}{%- if canonical %}<link rel="canonical" href="{{canonical}}" />{%- endif %}
  5. Integrate other content (such as the latest article list):Although it is a single page, you might want to display some related content on the "About Us" page, such as company news.archiveListTags can achieve this.

    • Display the latest 3 articles:
      
      {% archiveList latestArticles with type="list" moduleId="1" limit="3" %}
          {% for article in latestArticles %}
              <p><a href="{{ article.Link }}">{{ article.Title }}</a></p>
          {% endfor %}
      {% endarchiveList %}
      
      HeremoduleId="1"Assuming the article model ID is 1, you can adjust according to the actual situation.

Build a layout example for the "About Us" page.

Combine the above tags, a basicpage/about.htmlmight look something like this:

`html {% extends "base.html" %} {# Assume your website has a unified base layout file base.html #}

{% block title %}

{# 调用TDK标签,设置页面标题、关键词

Related articles

How to flexibly call and display the value of the 'Content Model Custom Field' in the AnQiCMS frontend page?

AnQi CMS excels in content management, especially its flexible content model and custom field features, which greatly facilitates the construction of personalized websites for us.The content of a website is often not just the title and text, but we may also need various additional information such as the author of the article, the source of publication, product specifications, event location, and floor area.These custom fields are like a 'personal filing cabinet' for content, allowing us to tailor the required attributes for each content type according to business needs.

2025-11-09

How to correctly display the filing number and copyright information at the bottom of the AnQiCMS website and ensure automatic year update?

Information at the bottom of the website, such as filing numbers and copyright statements, may seem trivial, but it is an important manifestation of the website's professionalism, legal compliance, and brand trust.For operators, correctly displaying this information and ensuring that the year can be automatically updated is not only convenient but also avoids the trouble of manual modification every year.In AnQiCMS, achieving this goal is very direct and flexible.

2025-11-09

How does AnQiCMS handle and display the lazy loading (lazyload) feature of images in article content?

In website operation, the loading speed of image content is crucial for user experience and search engine optimization (SEO).Especially when an article contains a large number of images, if all the images are loaded all at once when the page loads, it may cause the page to respond slowly and even affect the user's patience.This problem solved, the image lazy loading (Lazyload) technology emerged.

2025-11-09

How to use the AnQiCMS recommendation attribute (flag) to filter and display specific content, such as "headline" or "slideshow"?

AnQiCMS provides a flexible recommendation attribute (flag) mechanism that allows website operators to easily filter and highlight specific content, whether it is the "top news" on the website homepage, the "slideshow" in the carousel, or other "recommended" content that needs special attention.This feature greatly enhances the efficiency of content operation and the richness of website content.### Understanding Recommended Attributes: Tag content with "Exclusive Tags" Imagine that you have published many excellent articles and product information, but some are currently the most important, most popular, or need to be displayed in specific locations

2025-11-09

How does AnQiCMS ensure that the HTML content output through the `safe` filter is secure and correctly parsed and displayed on the front end?

In website operation, we often need to display user input or HTML content generated by a rich text editor.How to ensure that these dynamic contents are displayed correctly and avoid potential security risks is a challenge that every content management system must face.AnQiCMS as a Go language CMS that focuses on security has a mature mechanism in this aspect, especially the `safe` filter it provides, which plays a key role in ensuring the security and correct parsing of front-end content. ### Default security considerations: Why escape automatically?

2025-11-09

How to correctly display user comments and their review status in the AnQiCMS comment list?

In AnQiCMS, managing and displaying user comments, especially their review status, is a very practical feature in content operation.It not only helps us maintain community order, but also allows flexible control over the presentation of website content, ensuring the quality and compliance of published content.Next, let's take a detailed look at how to correctly display user comments and their review status in your website comment list. ### Core Function: Comment List Invocation To display user comments on the website, we need to rely on the powerful template tag system of AnQiCMS.

2025-11-09

Does AnQiCMS provide a convenient tag to display the website logo and name, and support multi-site calls?

In the process of managing and operating a website, the brand image of the website - Logo and website name - is undoubtedly the core identification.They not only represent the identity of the website, but also directly affect users' perception of the brand.For a system like AnQiCMS that is committed to providing an efficient content management solution, how conveniently to display this key information, and to support flexible calls under a multi-site environment, is an important standard to measure its usability and powerful features.AnQiCMS' design concept in this aspect is centered around 'convenience' and 'flexibility'

2025-11-09

How to accurately format the display of the article's publication and update timestamps in AnQiCMS templates?

In website content operation, clearly displaying the publishing and update time of articles is crucial for improving user experience, providing timeliness information of content, and optimizing search engine indexing.AnQiCMS provides a powerful and flexible timestamp formatting function in the template, allowing us to convert the original timestamp data into user-friendly date and time display according to specific needs.

2025-11-09