How to get and display website name, Logo, filing number and other system information in AnQi CMS template?

As an experienced security CMS website operator, I am well aware of the importance of efficiently obtaining and displaying website system information in templates.This concerns not only the user experience of the website, but also the foundation of SEO optimization and brand image building.AnQiCMS provides a simple and powerful template tag system, allowing developers and operators to easily present the core information of the website on the front page.

Get and display website system information in AnQi CMS template

In Anqi CMS, obtain and display core system information such as website name, Logo, filing number, etc., mainly through built-in{% system %}The tag is implemented. This tag is designed to unify the management and output of various site-level information configured in the background "Global Function Settings", ensuring data consistency and the convenience of template calls.

Get Website Name (SiteName)

The website name is a标志性 information of the website, commonly used in the suffix of page title, header or footer, etc. To obtain the website name, you can use it in the template.{% system %}tags, and specifynameparameters for"SiteName".

For example, the code to directly output the website name is as follows:

<title>{% tdk with name="Title" siteName=true %} | {% system with name="SiteName" %}</title>

In the above example, it is usually used in conjunction with the page TDK tags to build the complete page title. If you need to assign the website name to a variable for multiple references in the template, you can do it like this:

{% system siteName with name="SiteName" %}
<header>
    <h1>欢迎来到 {{ siteName }}</h1>
</header>

Get Website Logo (SiteLogo)

The website logo is the visual identity of the website, usually displayed in the header or footer in the form of an image. To obtain the URL of the website logo, the same method is used{% system %}tags, and specifynameparameters for"SiteLogo".

The following is how to use<img>An example of a website logo displayed in the tag:

<a href="/">
    <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}">
</a>

To enhance SEO friendliness, it is recommended toaltFill in the website name in the attribute so that even if the image cannot be loaded, users and search engines can understand the meaning of the image.

Obtain the website record number (SiteIcp)

For websites operating in mainland China, displaying the filing number is a legal requirement, which is usually located at the footer of the website and linked to the Ministry of Industry and Information Technology filing query website. To obtain the filing number, please use{% system %}tags, and specifynameparameters for"SiteIcp".

The following is an example of how to display the filing number and add a link to it:

<footer>
    <p>
        <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a>
        &copy; {{ now "2006" }} {% system with name="SiteName" %}. All Rights Reserved.
    </p>
</footer>

In this example, we also combined{% now "2006" %}tags to dynamically display the current year, which is a common practice in copyright information.

Get copyright information (SiteCopyright)

The copyright information of the website is usually included in the footer, stating the ownership of the content. Through{% system %}label'snamethe parameter to"SiteCopyright"To get the copyright content configured by the backend.

If the copyright content may contain HTML tags, it needs to be used to render correctly.|safefilter.

<footer>
    <div>{% system siteCopyright with name="SiteCopyright" %}{{ siteCopyright|safe }}</div>
</footer>

To get other system information and custom parameters.

In addition to the above common information,{% system %}tags can also get other global configurations, such as:

  • Website Home Page Address (BaseUrl):{% system with name="BaseUrl" %}is often used to construct absolute links.
  • Website Mobile URL (MobileUrl):{% system with name="MobileUrl" %}Used in PC + mobile independent template mode.
  • Template Static File URL (TemplateUrl):{% system with name="TemplateUrl" %}Used to refer to the CSS, JS, and other static resources under the template directory.
<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
<a href="{% system with name="BaseUrl" %}">返回首页</a>

AnQiCMS also supports adding custom parameters in the background "Global Function Settings". These custom parameter names (Parameter Name) can be used directly asnameCall the value of the parameter. For example, if you add a custom parameter namedHelpUrlin the background, you can access it in the template like this:

{% system helpPageUrl with name="HelpUrl" %}
<a href="{{ helpPageUrl }}">帮助中心</a>

By these tags, operations personnel and template developers can flexibly and efficiently integrate the core information of the website into various template pages, maintaining the consistency and maintainability of the website information.


Frequently Asked Questions (FAQ)

1. Why did I use the tag in the template{% system %}but the content did not display on the website?

First, make sure you have filled in the corresponding information in the "Background Settings" -> "Global Feature Settings" on the Anqi CMS backend.For example, if you want to display the website logo, you need to upload the logo image on the backend first.{% system %}in the tag usednameIs the parameter spelled correctly, for exampleSiteName/SiteLogoThese parameters are case sensitive. If the problem persists, try clearing the system cache.

2. My website is a multi-site management mode, how to obtain the system information of a specified site?

Under the multi-site management mode of Anqi CMS,{% system %}The tag will default to obtaining the system information of the current visited site. If you need to specify obtaining the system information of a particular site, you can add{% system %}the tag withsiteIdparameters, for example{% system with name="SiteName" siteId="1" %}. Among them,"1"Replace with the actual ID of the target site. This is very useful when building cross-site links or displaying information.

3. I added custom parameters in the background "Global Feature Settings", how do I call them in the template?

Add custom parameters in the background "Global Feature Settings" where the "parameter name" can be used directly as{% system %}label'snameto call the parameter value. For example, if your custom parameter name isHotlineIt can be used in the template.{% system with name="Hotline" %}To get its value. Please note that the case of the parameter name should be consistent with the backend settings.