How to retrieve and display the global configuration and SEO information of the website using `system`, `contact`, and `tdk` tags?

Calendar 👁️ 65

In the daily operation of AnQiCMS (AnQiCMS), accurately displaying global configuration information, contact information, and carefully optimized SEO elements on the website front-end is the key to improving user experience and search engine visibility.Luckily, AnQiCMS provides several intuitive and powerful template tags that allow users to easily access these important data.This article will delve intosystem/contactandtdkThese three core tags help you seamlessly integrate the background configuration into various pages of the website.

Get the global configuration of the website:systemThe application of tags

When you need to display global information such as the brand name, Logo, filing number, or core address of the website,systemThe tag is your helpful assistant. This tag can directly read the preset values from the "Global Function Settings" of AnQiCMS backend and display them on the website front end.

To usesystemLabel, you usually specify the name of the configuration item you want to retrieve. For example, to display the name of the website, you can use it like this:

<div>网站名称:{% system with name="SiteName" %}</div>

If you want to display the website's logo image, make sure it links to the homepage, and has good SEO practices (alt attribute), you can write it like this:

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

Here we have simultaneously calledSiteLogoto obtain the address of the Logo image,SiteNameobtain the website name as the alt text of the image, as well asBaseUrlobtain the address of the website's homepage.

In addition, like the record number,SiteIcp), copyright information (SiteCopyright)、Template Static Files Address(TemplateUrlused to load CSS or JS files), even parameters customized in the background, can be retrieved in a similar way. For example, if you customize a parameter named "HelpUrl" to store the link to the help page, you can call it in this way:

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

By this means, you can ensure that all pages use the latest global configuration information uniformly, without modifying the template code, which greatly improves the maintainability of the website.

Display the company's contact information:contactUsage of tags

Clear and convenient contact information is the bridge to establish trust and communication with users. AnQiCMS'scontactThe label is used to retrieve and display all the information in the "Contact Settings" of the backend. Whether it's phone, email, address, or various social media links, it can easily handle it.

Assuming you want to display the company's contact phone number and email on the footer of the website or the 'Contact Us' page, you can call it like this:

<div>
    <p>联系电话:{% contact with name="Cellphone" %}</p>
    <p>联系邮箱:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></p>
</div>

If you have set up a WeChat QR code in the backgroundQrcodeAnd hope to display on the front end so that users can scan and add, it can be implemented in this way:

<div>
    <img src="{% contact with name="Qrcode" %}" alt="微信二维码" />
    <p>微信号:{% contact with name="Wechat" %}</p>
</div>

For social media platforms such as Facebook or LinkedIn, if the backend is configured, you can also access it byname="Facebook"orname="Linkedin"in such a way. Similarly,contactTags also support calling the contact information parameters customized in the background, which provides great flexibility to meet specific display requirements.

Optimize page SEO:tdkThe essence of the tag

TDK (Title, Description, Keywords) is the foundation of website SEO, directly affecting the display effect and ranking of the page in search engine results. AnQiCMS'stdkTags are born for this, they can intelligently obtain the SEO title, keywords, description, and canonical URL of the current page.

On each page's<head>area, you will usually see such TDK settings:

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

tdkThe strength of the tag lies in its intelligence. It automatically retrieves the corresponding TDK information based on the type of the current page (home page, article detail page, category list page, etc.).For example, on the article detail page, it will display the unique SEO title, keywords, and description of the article;On the category list page, it displays the TDK of the category.

For page titlesTitle,tdkThe tag also provides several practical attributes to further control its display style:

  • siteName=trueThe website name will be automatically appended to the page title. For example, if the page title is "About Us", and the website name is "AnQi CMS", the final displayed title may be "About Us - AnQi CMS".
  • sep="_"Allow you to customize the separator between the page title and the website name, the default is a hyphen-.
  • showParent=trueIn category or article pages, if the content has a parent category, this attribute can determine whether the title of the parent category is displayed in the title. For websites with a deep hierarchy, this helps to improve the descriptiveness of the title.

For example, a title that displays the parent category title and uses an underscore as a separator:

<title>{% tdk with name="Title" siteName=true sep="_" showParent=true %}</title>

Furthermore,tdkThe tag can also obtain the page's canonical URL, which is crucial for avoiding duplicate content and concentrating page authority:

{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}

Ensure that a conditional judgment is made only when the standard link exists and output is produced<link rel="canonical">Tag, this is a robust practice

Summary

system/contactandtdkThese tags are the foundation of AnQiCMS template development, they tightly connect the global configuration, contact information, and SEO metadata of the website with the front-end display.By flexibly using these tags, you can build a highly consistent, easy-to-manage, and search engine-friendly website, thus better serving your users and achieving operational goals.Understanding and mastering them will make your AnQiCMS website operation twice as efficient.

Frequently Asked Questions (FAQ)

1. If a certain setting is not set on the back-endsystemorcontactWhat is the value of the field, which will be displayed when the front-end is called?Answer: If the backend has not set up for somesystemorcontactField setting value, when the front-end calls this label, it usually returns an empty string.This means that no content will be displayed at this location on your website, so you can judge these null values as needed when designing the template, or set default placeholder text.

2.tdkThe TDK information obtained by the tag is for the entire website or for the current page?Answer:tdkThe intelligence of the tag lies in the fact that it iscontext-awareThis means that it will automatically obtain and display the corresponding TDK information based on the type of page being accessed (such as the homepage, article detail page, category list page, single page, etc.).For example, it will display the content you configured in the "Home Page TDK Settings" in the background on the homepage;On the article detail page, it will display the TDK independently set for the article.This design greatly simplifies SEO management, ensuring that each page has its own unique optimization information.

3. Can I call information from different sites (multi-site functionality) in the same template file?systemorcontact?Answer: Yes. The multi-site function of AnQiCMS is very powerful, in order to support cross-site data calls,system/contactandtdktags support onesiteIdparameter. You can usesiteId="X"(Where X is the ID of the target site) to specify which site's configuration information to retrieve.This is very useful for building a multistorey network that shares some global information, such as unified copyright information or the contact details of the headquarters.

Related articles

How to format a timestamp with the `stampToDate` tag to display the date and time in a user-friendly manner?

In the daily content operation of Anqi CMS, we often need to present the original timestamp data such as publish time and update time in a way that is more accustomed to and easier to read for users.The original timestamp, such as `1609470335` such a pure number sequence, has no meaning to ordinary users.To solve this problem, AnQi CMS provides a very practical template tag——`stampToDate`, which can help us convert these numeric timestamps into a clear and user-friendly date and time display.###

2025-11-08

How to implement conditional display and loop display of dynamic content in AnQiCMS template using `if` and `for` tags?

In the Anqi CMS template world, `if` and `for` tags are the foundation for building dynamic and flexible pages.They give the template the ability to display content based on different data conditions, as well as the ability to efficiently loop through data sets, making your website content生动地呈现给visitors vividly.AnQi CMS adopts a template engine syntax similar to Django, making it easy for you, who is familiar with web development, to get started quickly, obtaining data through double curly braces `{{variable}}`, and using `{% tags %}` syntax for conditional judgment and loop control.### Use `if`

2025-11-08

How to generate and control the pagination display effect of the `pagination` tag?

In website operation, when the amount of content is large, how to efficiently and beautifully display these contents while ensuring that users can browse conveniently is the key to improving user experience.If you dump all the content on the same page, not only will it load slowly, but it will also deter visitors.At this moment, content pagination becomes particularly important. It breaks massive information into several pieces, which not only reduces the burden of page loading but also allows users to explore the content they are interested in step by step at their own pace.AnQiCMS provides a powerful and flexible `pagination` tag

2025-11-08

How to implement content aggregation and thematic display based on `tagList` and `tagDetail` tags?

In content management and website operations, how to efficiently organize and display content is the key to improving user experience and SEO performance.AnQiCMS provides powerful tag features, with the `tagList` and `tagDetail` template tags, it is easy to implement content aggregation based on tags and thematic display, bringing more flexible classification and richer navigation experience to the website.### The role of tags in content aggregation Tags are an important way to organize content in a content management system

2025-11-08

How to build and display the navigation path of the current page in the website using the `breadcrumb` tag?

In website construction and operation, user experience (UX) is always at the core.When visitors delve deeper into your website, a clear navigation path can effectively prevent them from getting lost and quickly understand their current location.This is the value of the 'Breadcrumb Navigation'.It not only enhances user experience, but is also an important part of Search Engine Optimization (SEO), helping search engines understand the hierarchy of your website structure.AnQi CMS knows this and therefore provides a convenient and easy-to-use `breadcrumb` tag

2025-11-08

How does AnQiCMS support Markdown content editing and correctly render mathematical formulas and flowcharts on the front end?

AnQiCMS understands the desire of content creators for efficient and flexible editing tools.The new version introduces Markdown editor, greatly enhancing the convenience of content publishing.It is even more surprising that AnQiCMS not only supports basic Markdown syntax but also allows complex mathematical formulas and flowcharts to be elegantly presented on your website front-end through simple configuration.This is undoubtedly a powerful boost for websites that need to display professional knowledge, technical documentation, or educational content.### Enable Markdown Editing Feature First

2025-11-08

In AnQiCMS content settings, how to finely control the display of images (such as WebP, automatic compression, thumbnails)?

In website operation, images are important elements to attract users and convey information.However, unoptimized images may also be the culprit behind slow website loading, which can then affect user experience and search engine rankings.AnQi CMS knows the importance of image optimization and therefore provides a variety of fine-grained image control features to help you achieve a perfect balance between website performance and visual effects.### One, WebP: The intelligent choice for lightweight and fast image acceleration WebP, as a modern image format, typically has a file size 25-34% smaller than JPEG at the same visual quality

2025-11-08

How does AnQiCMS handle the display of external links in documents, does it automatically add the `nofollow` attribute?

In website operation, the management of external links is an important task, which not only relates to user experience, but also has a direct impact on search engine optimization (SEO).The use of the `nofollow` attribute can help website managers control the transmission of link weight more accurately, avoiding unnecessary risks.For users of AnQiCMS, understanding how the system handles external links in documents and whether it automatically adds the `nofollow` attribute is crucial for efficient website operation.AnQiCMS provides a clear and flexible strategy for handling external links

2025-11-08