As an experienced website operations expert, I know that efficiently and uniformly managing website content is the cornerstone of success in an increasingly complex network environment.AnQiCMS leverages the efficient and flexible customization capabilities of the Go language, providing us with many conveniences.{% system %}and{% contact %}and how to skillfully combine them to build a unified and easy-to-maintain system for displaying global contact information across the website.
The value of a unified website identifier and contact information
During the operation of any website, information such as website name, Logo, copyright statement, contact phone number, email, company address, etc., often needs to be frequently displayed on various pages (such as headers, footers, about us, contact us).If this information is scattered throughout the template, every modification means a huge amount of work and potential risk of errors.It is more important that inconsistent information not only affects user experience and reduces brand trust, but may also distract search engines and impact SEO performance.
Anqi CMS's{% system %}and{% contact %}
{% system %}Label: Unified outlet of core information of the website
{% system %}Tags are mainly used to obtain and display the general configuration information of the website, such as website name, Logo, filing number, copyright content, and basic URL.This information constitutes the 'business card' of the website.
Working principle and commonly used fields:
When you need to display the website name, you do not have to enter it manually on each page. Just configure it once in the 'Global Function Settings' in the backend. In the template, you can call it like this:
<title>{% system with name="SiteName" %} - 您的页面标题</title>
<h1><img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" /></h1>
<p>© {% now "2006" %} {% system with name="SiteName" %}. {% system with name="SiteCopyright" %}</p>
Here,nameThe parameter specifies the field name of the system setting item to be retrieved, for exampleSiteName[Website Name],SiteLogo[Website Logo],SiteIcp[Website Record Number],SiteCopyright(Copyright content), etc.{% now "2006" %}It is an auxiliary tag used to dynamically obtain the current year, ensuring that the copyright year is always up-to-date without manual updates.
Through this method, no matter how many pages you reference the website name or Logo, when these information on the backend changes, the front-end page will be updated in real time to ensure consistency.
{% contact %}Label: A powerful tool for precise display of contact information
With{% system %}Similar to labels,{% contact %}Tags focus on extracting and displaying a website's contact information. Whether it's traditional phone numbers, emails, addresses, or modern social media accounts, it handles it effortlessly.
Working principle and commonly used fields:
In the 'Contact Information Settings' of Anqi CMS backend, you can manage all contact details uniformly. For example, your phone number isCellphone, your email isEmail, and the company address isAddressIn the template, you can call it as follows:
<p>联系电话:<a href="tel:{% contact with name="Cellphone" %}">{% contact with name="Cellphone" %}</a></p>
<p>电子邮件:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></p>
<p>公司地址:{% contact with name="Address" %}</p>
nameThe parameters here correspond to each field of the contact information, such asUserName(Contact person),Cellphone(Contact phone number),Address(Contact address),Email(Contact Email),Wechat(WeChat ID),Qrcode(WeChat QR Code) and more. The AnQi CMS even supports a variety of social media accounts such asWhatsApp/Facebook/Twitter[en] Allow your website to easily implement multi-channel contact display.
[en] Smart combination: Build a unified global contact information area.
Combine these tags, and we can build a rich and easy-to-maintain global contact information area in the website's header, footer, or a dedicated 'Contact Us' page.
Imagine, at the bottom of your website, you want to display the website name, copyright information, contact phone number, and company address. Your template code might look something like this:
<footer class="site-footer">
<div class="container">
<div class="row">
<div class="col-md-6 copyright-info">
<p>© {% now "2006" %} {% system with name="SiteName" %}. {% system with name="SiteCopyright" %}</p>
<p>备案号:<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p>
</div>
<div class="col-md-6 contact-info">
<p>联系电话:<a href="tel:{% contact with name="Cellphone" %}">{% contact with name="Cellphone" %}</a></p>
<p>电子邮件:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></p>
<p>公司地址:{% contact with name="Address" %}</p>
<!-- 还可以添加自定义联系方式,例如WhatsApp -->
{% contact whatsapp with name="WhatsApp" %}
{% if whatsapp %}
<p>WhatsApp: <a href="https://wa.me/{{ whatsapp }}" target="_blank">{{ whatsapp }}</a></p>
{% endif %}
</div>
</div>
</div>
</footer>
In this example, we elegantly integrate the brand information and contact details of the website.Once the phone number or company address of the backend changes, or if the copyright information needs to be updated, you only need to make one change in the corresponding module of the Anqi CMS backend, and all pages that refer to these tags will be automatically updated without touching a single line of template code.
Advanced Application: Custom Parameters and Multi-Site Support
The strength of Anqi CMS goes beyond this.
Custom Parameters:If you find that the built-in fields do not meet all your needs, for example, if you want to display a special 'Customer Service WeChat Official Account' or 'Company Establishment Year' on your website, you can customize new parameters on the 'Global Feature Settings' or 'Contact Information Settings' page. After setting, these customized parameters can also be accessed through{% system with name="你的自定义参数名" %}or{% contact with name="你的自定义参数名" %}Invoke, greatly expanding the flexibility of tags.
Multi-site support:For users who operate multiple websites or sub-brands, the Anqi CMS is:siteIdParameters become particularly important. By specifying in the tagssiteId[for example]{% system with name="SiteName" siteId="2" %}You can easily call configuration information from different sites, even if they are running in the same security CMS instance, they can maintain their own independent global information.This is undoubtedly a huge boost in management efficiency for agents or companies with multiple business lines.
Implementing**practice
- Principle of centralized management:Always configure globally and frequently repeated information through the Security CMS backend and in