As an experienced website operations expert, I know that efficiently and uniformly managing website content is the foundation of success in an increasingly complex network environment.AnQiCMS (AnQiCMS) leverages the efficient and flexible customization capabilities of the Go language to provide us with many conveniences.Today, let's delve deeply into the two seemingly simple yet extremely powerful tags in Anqi CMS——{% system %}and{% contact %}And how to cleverly combine them to build a unified and easy-to-maintain website global contact information display system.
The value of unified website identification and contact information.
During the operation of any website, information such as the website name, Logo, copyright statement, contact phone number, email, and company address often needs to appear frequently on various pages (such as the header, footer, about us, contact us)If this information is scattered in all corners of 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, reduces brand trust, but may also distract search engines' attention, affecting SEO performance.
Of Security CMS{% system %}and{% contact %}Labels are born to solve this pain point. They allow us to centrally store these core global information in the background and dynamically display the front-end page through simple label calls, thereby greatly improving operation efficiency and the professionalism of the website.
{% system %}Label: The unified outlet of the core information of the website
{% system %}Tags are mainly used to obtain and display the general configuration information of a website, such as website name, Logo, filing number, copyright content, and basic URL.This information constitutes the "identity card" of the website.
Working principle and commonly used fields:
When you need to display the website name, you do not need to enter it manually on each page. Just configure it once in the background "Global Function Settings". 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 obtained, for exampleSiteName(Website name),SiteLogo(Website Logo),SiteIcp(Website record number),SiteCopyright(Copyright content) and so on.{% now "2006" %}This is an auxiliary label used to dynamically obtain the current year, ensuring that the copyright year is always up-to-date without manual updates.
In this way, no matter how many pages you reference the website name or Logo, when these information changes on the backend, the front-end page will be updated in real time to ensure consistency.
{% contact %}Label: A tool for accurately displaying contact information
with{% system %}Tags are similar,{% contact %}The tag focuses on extracting and displaying a website's contact information. Whether it's traditional phone numbers, emails, addresses, or modern social media accounts, it can handle it easily.
Working principle and commonly used fields:
In the Anqi CMS backend "Contact Information Settings", you can manage all contact details统一. For example, your phone number isCellphone, your email isEmail, your company address isAddress. You can call it like this in the template:
<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 the various fields of the contact information, such asUserName(Contact),Cellphone(Contact phone),Address(Contact address),Email(Contact email),Wechat(WeChat ID),QrcodeWeChat QR code and others. Anqi CMS even supports a variety of social media accounts such asWhatsApp/Facebook/TwitterAnd others, making it easy for your website to display multi-channel contact information.
An ingenious combination: Build a unified global contact information area
Combine these tags and you can build a rich, easy-to-maintain global contact information area in the website 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 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.If the phone number or company address in the background changes, or if you need to update the copyright information, you just need to make one modification in the corresponding module of Anqi CMS, and all pages that reference 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 is not just limited to 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 founding year on your website, you can customize new parameters on the "Global Function Settings" or "Contact Information Settings" page. After setting, these customized parameters can also be accessed by{% system with name="你的自定义参数名" %}or{% contact with name="你的自定义参数名" %}Invoke, greatly expands the flexibility of tags.
Multi-site support:For users who operate multiple websites or sub-brands, Anqi CMS'ssiteIdParameters are particularly important. They are specified in the tags.siteIdfor example{% system with name="SiteName" siteId="2" %}), you can easily call configuration information of different sites, even if they run in the same security CMS instance, they can also maintain independent global information.This is undoubtedly a huge boost in management efficiency for agents or companies with multiple business lines.
Implement **practice.
- Principle of centralized management: Always configure global and repetitive information through the AnQi CMS backend and proceed to