In website operation, keeping information updated is an important part of maintaining a professional image, and the copyright year at the bottom of the website is often overlooked. Manually updating it every year is not only cumbersome but also prone to omissions. 幸运的是,using Anqi CMS, we can easily implement the dynamic display of copyright information, so that the information at the bottom of the website is always up-to-date.
Why is dynamic copyright information so important?
Imagine visiting a website where the bottom prominently displays the copyright year from several years ago.This may make the website look outdated and may leave a bad impression of unprofessionalism.For content operators, every modification means extra workload.Dynamic display of copyright year and information, the benefits are self-evident:
- Maintain professionalism and timeliness:Automated updates ensure that the website always presents the latest information, maintaining the professional image of the company or brand.
- Relieve operational burden:Say goodbye to the hassle of manually modifying the copyright every year, and focus your energy on more valuable content creation and marketing activities.
- Improve user experience:Visitors will feel the vitality and maintenance of the website, enhancing trust.
- Slight SEO benefit:Although trivial, continuously updated page content is also a positive signal of website activity to search engines.
AnQi CMS is a modern content management system developed based on the Go language, which provides strong support for content operations with its high efficiency, customizability, and easy scalability.It has a flexible template engine and rich built-in tags, which is the core tool for us to implement dynamic copyright information.
Implement step by step dynamic copyright year and information display
Next, we will go through several simple steps, using the template tag function of Anqí CMS, to dynamically display copyright information and the current year at the bottom of the website or other areas.
Step 1: Locate the template file
The template files of AnQi CMS are usually stored in/templateUnder the directory. To achieve a unified display of copyright information throughout the website, we usually modify the public footer file of the website. This file is usuallybash.html(Used to define common inherited parts such as headers and footers), or find a file named in your template theme directoryfooter.htmlor a file with a similar name, which contains the website footer code.
If you are not sure which file it is, you can find and open the HTML file most likely to contain footer code in the "Template Design" area of the background management interface through the online editing feature.
Step two: Insert the current year label
Anqi CMS provides a very practicalnowLabel, you can directly output the current time. To display the current year, you just need to specify the format.
In the footer template file you find, replace the position where the year needs to be displayed with the following code:
{% now "2006" %}
Here2006It is a specific time format string used in Go language to represent the year. This tag automatically retrieves and outputs the current year.
Step 3: Display custom copyright information
In addition to the year, we usually need to display the copyright statement of the website, the website name, and other information.The Anqi CMS provides the "Global Function Settings" in the background, which includes the "Website Name" and "Copyright Content" fields for easy unified management.We can go throughsystemLabel to retrieve this information.
In the footer template, you can use the following tags to get the website name and the copyright content set in the background:
{% system with name="SiteName" %}
This will display the website name set in the background.
{% system with name="SiteCopyright" %}
This will display the copyright content you entered in the background "Global Feature Settings".
If your copyright content may contain HTML tags (for example, to bold or add links), to ensure that these HTML tags are parsed correctly by the browser rather than displayed as plain text, please outputSiteCopyrightUsed at|safefilter.
{% system siteCopyrightText with name="SiteCopyright" %}{{ siteCopyrightText|safe }}
Here we will assign the copyright content tositeCopyrightTextthe variable, then through|safeFilter output.
Fourth step: integrate and improve the bottom area
Now, we combine the year label and the copyright information label to build a complete bottom copyright area.A common copyright format is “© [current year] [website name]. All Rights Reserved. [custom copyright content]”.
You can integrate it like this in your footer template file:
<div class="footer-copyright">
© {% now "2006" %} {% system with name="SiteName" %}. All Rights Reserved.
{% system siteCopyrightContent with name="SiteCopyright" %}{{ siteCopyrightContent|safe }}
</div>
This code snippet will dynamically display the current year, followed by the website name set in your background, then the common 'All Rights Reserved.', and finally the copyright supplement information customized in your background.
Step 5: Save and Preview
After the modification is completed, please save your template file. If you are editing online in the background, usually clicking save will take effect.If you modify the file via FTP or other methods, you may need to clear the AnQi CMS system cache (in the "Cache Update" function of the background management interface), then refresh the website frontend page, and you will see that the copyright information at the bottom has been dynamically updated.
Tip: Personalize your copyright information
Go to the Anqi CMS backend,Backend Settings -> Global Function SettingsYou will see the "Website Name" and "Copyright Content" fields.Here, you can modify the website name according to your actual needs and flexibly edit the copyright content.For example, you can add the company name, record information link, and even some brief promotional language. Through|safeFilter, you can even use HTML tags directly in the "Copyright Content" field to achieve richer styles and links.
Summary
By using the simple and powerful template tag system of AnQi CMS, it becomes extremely simple to dynamically display copyright information and the year at the bottom of the website.This not only greatly improves the maintenance efficiency of the website, but also keeps your website always professional and up-to-date.Encourage you to explore more flexible features of Anqi CMS, making website operation more skillful.
Frequently Asked Questions (FAQ)
Why does my website's footer year not update immediately after modification?
A1: This is usually due to website caching. In the Anqi CMS backend, try clicking the 'Update Cache' button to clear the system cache, then refresh your website page.If there is still no update, please check whether the template file you have modified is the correct common footer file, and confirm that the modification has been saved successfully.
Can I add links or images in the 'Copyright Content'?
A2: Yes, the 'Global Function Settings' in Anqi CMS backend supports entering HTML code, including links (<a>tags) and images (<img>Label). To ensure that this HTML code is correctly parsed on the front-end page, please make sure to output it in the template.SiteCopyrightUsed at|safeFilter, for example{{ siteCopyrightContent|safe }}.
Q3: If I use Anqi CMS to manage multiple sites, do I need to set the copyright information separately for each site?
A3: Yes, Anqi CMS supports multi-site management, each site is independently configured.You need to log in to the backend of each site, then in the "Global Function Settings" of each site, set its "Site Name" and "Copyright Content" separately to achieve personalized management.