In website operations, single-page contents like "About Us" and "Contact Us" are indispensable. They carry important functions such as displaying corporate images, providing contact information, or stating service terms.For friends using AnQiCMS, it's actually a very direct and flexible thing to beautifully display these single-page contents on the website front-end.
Overview of Single-Page Content Management
Firstly, we need to create and manage these single-page applications in the AnQiCMS backend system.In the navigation bar on the left side of the background, you can find the "Page ResourcesThis 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, some key fields will be displayed. The first one isPage NameThis is the title of the single page displayed on the front page. Next isSingle page content,here you can use the powerful rich text editor of AnQiCMS, flexibly format 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 for single pageSEO title/KeywordsandSingle page introductionThese are all crucial for search engine optimization.
It is especially worth mentioning.Custom URLandSingle Page TemplateThese options. Custom URLs can help us generate more user-friendly and memorable link addresses for single pages, such as setting the URL for "About Us" to/about-us. And the 'Single Page Template' is the key to determining the frontend display style of this page.
Flexible selection and customization of single page templates
AnQiCMS provides a default display template for a single page, usuallypage/detail.htmlThis means that if you do not specify it particularly, all single pages will use this common template to display.
However, many times we hope that different single-page applications have unique layouts or styles.For example, the "About UsThis is when custom templates come in handy.
You can find your template design package (usually located in/templateIn the directory where you are using the template folder, create a special template file, for example, create a template file for the "About Us" page.page/about.htmlThe file. After creating the template file, simply edit the 'About Us' single page in the background, and enter it in the 'Single Page Template' field.about.htmlEnglish
这里有一个小小的约定,AnQiCMS支持两种默认的自定义模板命名格式:一种是Englishpage/{单页面id}.html, and the other is:page/{自定义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 frontend.
When the single-page content and template are ready, the next step is to 'light them up' on the website front-end.AnQiCMS provides dedicated tags that allow us to easily call and display single-page data.
To display the detailed content of a single page, such as the main text of the "About Us" page, we mainly usepageDetailLabel. This label can be retrieved to obtain specific single page data according to the page ID or URL alias.
For example, in yourpage/about.htmlTemplate file, to display the main content of "About Us", 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,pageDetailTagsnameParameters allow us to obtain different fields on a single page, such asTitle(Title),Description(description),Content(Content) ofLogo(Large Image) andThumbThumbnail and so on. The content field usually needs to be added|safeFilter to ensure that HTML tags can be normally parsed by the browser.
If you need to display a list of links to all or part of a single page in the footer navigation or sidebar of a website,pageListIt is very convenient to label. It will retrieve all single pages that have been created, and then you can iterate through them to display their titles and links.
A simplepageListThe following is an example of the call:
<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>
So, your website visitors can easily click through the navigation and access these important single-page contents.
Concluding remarks
Through the management functions and flexible template tags of AnQiCMS backend page, you can create, manage and display various single-page content on the website 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 powerful support to make your website content operation more convenient.
Common 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 is the cause of this?This is usually because the custom template file you specified is not properly placed in the template design package, or the file name does not match the name filled in the background exactly (including case). Please make sure that your custom template file, such asabout.html, located in/template/您的模板文件夹名称/page/directory. Also, check if the "Single Page Template" field in the background is filled withabout.htmlInsteadpage/about.html, the system will automatically identifypage/directory.
2. How to add single page content to the navigation menu of the website?In AnQiCMS backend, go to 'Website Navigation Settings' under 'Backend Settings'.Here you can manage different navigation categories (such as top navigation, footer navigation).Click "Add navigation linkSo, the single page will be displayed in the navigation menu you specified.
3. Besides text and images, what else can I add to a single page for richer content? For example, video, form, or map?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.guestbookLabel it to display on a single page.As for the map, it is usually implemented by embedding HTML code provided by a third-party map service.These greatly enrich the expression of a single page.