In website operations, single-page content such as "About Us" and "Contact Us" is indispensable. It carries important functions such as displaying corporate images, providing contact information, or stating terms of service.For friends using AnQiCMS, it is actually a very direct and flexible thing to beautifully display these single-page contents on the website front-end.
Single-page content management overview
First, we need to create and manage these single pages in the AnQiCMS backend system.In the left navigation bar of the background, you can find the 'Page Resources' menu, click to enter 'Page Management'.This is the 'home base' for all single pages, where you can add new single pages, edit existing content, or delete them.
When adding or editing a single page, you will see some key fields to fill in. The first one isPage NameThis is the title displayed on the front page of the single page. Next isSingle page contentHere you can use the powerful rich text editor of AnQiCMS, flexibly arrange text, insert images, videos, and even if your website has enabled the Markdown editor, you can directly use Markdown syntax to write content, which provides great convenience for content creation. In addition, we can also set up single pages.SEO title/KeywordsandSingle page introductionThese are crucial for search engine optimization.
It is particularly noteworthy thatCustom URLandSingle page templateThese options. Custom URLs can help us create more friendly and memorable link addresses for single pages, such as setting the URL for the "About Us" page to/about-us. 'Single-page template' is the key to determining the front-end display style of this page.
Flexible selection and customization of single-page templates.
AnQiCMS provides a default display template for single pages, usuallypage/detail.htmlThis means that if you do not specify otherwise, all single pages will use this common template to display.
However, most of the time we want different single pages to have unique layouts or styles.For example, the "About Us" page may need to display team photos and corporate culture, while the "Contact Us" page requires embedded maps and comment forms.At this point, the custom template can come in handy.
You can find your template design package (usually located in/templateIn the directory, create a dedicated template file in the folder you are using as a template, for example, create one for the "About Us" pagepage/about.htmlThe file. After creating the template file, simply edit the "About Us" single page in the background, and fill in the "Single Page Template" field.about.htmlIt can do that. AnQiCMS will intelligently find and apply this custom template.
There is a little agreement, AnQiCMS supports two default custom template naming formats: one ispage/{单页面id}.html, and the other ispage/{自定义URL别名}.htmlHowever, by explicitly specifying the template name in the background, we can manage these custom templates more intuitively.
Display single-page content on the front end.
When the single-page content and template are ready, the next step is to turn them on at the front end of the website.AnQiCMS provides special tags that allow us to easily call and display single-page data.
To display the detailed content of a single page, for example, the main content of the "About Us" page, we mainly usepageDetailLabel. This label can be used to retrieve specific single-page data based on the page ID or URL alias.
For example, in yourpage/about.htmlIn the template file, to display the "About Us" text content, you can write it like this:
{# 显示单页面标题 #}
<h1>{% pageDetail with name="Title" %}</h1>
{# 显示单页面内容 #}
<div class="page-content">
{% pageDetail pageContent with name="Content" %}
{{ pageContent|safe }}
</div>
{# 如果页面有缩略图,也可以这样调用 #}
{% pageDetail pageThumb with name="Thumb" %}
{% if pageThumb %}
<img src="{{ pageThumb }}" alt="{% pageDetail with name="Title" %}" />
{% endif %}
Please note,pageDetaillabel'snameParameters allow us to obtain different fields on a single page, such as:Title(Title),Description(Description),Content(Content),Logo(Large Image) andThumb(Thumbnail) and others. The content field usually needs to be added|safeFilter to ensure that HTML tags can be parsed normally by the browser.
If you need to display a list of links to all or part of the single-page pages in the footer navigation or sidebar positions,pageListThe tag is very convenient. It retrieves all the single pages created and then you can loop through them to display their titles and links.
A simplepageListHere is an example of how to call it:
<div class="footer-links">
<h3>重要页面</h3>
<ul>
{% pageList pages %}
{% for item in pages %}
<li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
{% endfor %}
{% endpageList %}
</ul>
</div>
This way, your website visitors can easily click through the navigation and access these important single-page contents.
Conclusion
By using the AnQiCMS backend page management features and flexible template tags, you can create, manage, and display various single-page content on your website very efficiently and conveniently.Whether it is a simple plain text page or a complex page containing rich text, images, maps, or forms, AnQiCMS can provide strong support to make your website content management more convenient.
Frequently Asked Questions (FAQ)
1. I created a custom single-page template, but it still displays the default template or the page reports an error when accessed on the front end. What could be the reason for this?This is usually because the custom template file you specified has not been placed correctly in the template design package, or the filename does not match the name filled in the background exactly (including case sensitivity). Please ensure that your custom template file, for example,about.html, located/template/您的模板文件夹名称/page/in the directory. Also, check that the "Single Page Template" field is filled in the backgroundabout.htmlinstead ofpage/about.html, the system will automatically recognizepage/Directory.
2. How to add single page content to the website's navigation menu?In AnQiCMS backend, go to the 'Backend Settings' under 'Website Navigation Settings'.You can manage different navigation categories (such as top navigation, footer navigation).Click the "Add navigation link", select "Category page link" under "Link Type", and then select the single page you want to add.This, the single page will be displayed in the navigation menu you specified.
3. What other rich content can I add to a single page? Such as videos, forms, or maps?Of course you can. The AnQiCMS rich text editor supports inserting videos (via URL or upload), tables, code blocks, and various other media and elements.For the message form, AnQiCMS has built-in "Website Message Management" function, you can customize the form fields, and then throughguestbookThe label displays it on a single page. As for the map, it is usually implemented by embedding the HTML code provided by a third-party map service.These greatly enrich the presentation form of a single page.