In website operation, keeping information up to date is an important part of maintaining a professional image, and the copyright year at the bottom of the website is often ignored. Manually modifying it every year is not only cumbersome but also prone to omissions.It is fortunate that with the use of AnQi CMS, we can easily implement dynamic display of copyright information, ensuring that the information at the bottom of the website is always up-to-date.
Why is dynamic copyright information so important?
Imagine, a user visits a website, and at the bottom, it boldly displays the copyright year from a few years ago.This may make the website look outdated and might give people an impression of unprofessionalism.For content operators, every modification means additional workload.
- Maintain professionalism and timeliness:The automatic update ensures that the website always presents the latest information, maintaining the professional image of the enterprise or brand.
- Reduce operational burden:Saying goodbye to the hassle of manually modifying copyrights every year, focus your energy on more valuable content creation and marketing activities.
- Enhance user experience:Visitors will feel the vitality and maintenance of the website, enhancing a sense of trust.
- Mild SEO benefit:Although insignificant, continuously updated page content is also a positive signal of website activity for search engines.
Anqi CMS is a modern content management system based on the Go language, which provides strong support for content operation with its high efficiency, customizable and easy extensibility.It has a flexible template engine and rich built-in tags, which are the core tools for us to implement dynamic copyright information.
Step by step implementation of dynamic copyright year and information display
Next, we will use several simple steps to dynamically display copyright information and the current year at the bottom of the website or other areas using the template tag feature of the security CMS.
第一步:Locate the template file
The template files of Anqi CMS are usually stored in:/templateUnder the directory. To achieve a unified copyright information display across the entire site, 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 namedfooter.htmlor a similarly named file under your template theme directory, 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 the footer code by using the online editing feature in the "Template Design" area of the background management interface.
第二步:Insert current year tag
Anqi CMS provides a very practicalnowLabel, it can directly output the current time. To display the current year, we just need to specify its format.
In the footer template file you find, replace the position where the year needs to be displayed with the following code:
{% now "2006" %}
Here2006Is a specific time format string used in Go language to represent the year. This label will automatically retrieve and output the current year.
Step 3: Display custom copyright information
In addition to the year, we usually also need to display the copyright statement of the website, the name of the website, and other information.The "Global Function Settings" in the "AnQi CMS" backend provides the "Website Name" and "Copyright Content" fields, making it convenient for you to manage them uniformly.systemLabel to get this information.
In the footer template, you can use the following labels 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 filled in the "Global Feature Settings" in the background.
If your copyright content may contain HTML tags (such as, for bold text or adding links), to ensure that these HTML tags are properly parsed by the browser rather than displayed as plain text, pleaseSiteCopyrightUsing|safeFilter.
{% system siteCopyrightText with name="SiteCopyright" %}{{ siteCopyrightText|safe }}
Here we assign the copyright content tositeCopyrightTextthe variable, and then pass through|safeFilter output.
Step 4: Integrate and perfect the bottom area
Now, we combine the year label and the copyright information label to build a complete bottom copyright area.An English translation of '一个常见的版权格式是“© [当前年份] [网站名称].' is 'A common copyright format is '© [current year] [website name].' All Rights Reserved.[Custom copyright content]
In your footer template file, you can integrate it like this:
<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 you set up in the background, then the general 'All Rights Reserved.', and finally the supplementary copyright information you customized in the background.
Step 5: Save and preview
After completing the modification, please save your template file.If you are editing online in the background, usually clicking save will take effect.If you modify the file through FTP or other methods, you may need to clear the security CMS system cache (in the "Cache Update" function of the background management interface), then refresh the website front-end page, and you will see that the bottom copyright information has been dynamically updated.
Tips: Personalize your copyright information
In the AnQi CMS backend, go toBackend settings -> Global function settingsYou will see the fields "Website Name" and "Copyright Content".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, filing information link, and even some brief promotional phrases.|safeFilter, you can even use HTML tags directly in the "Copyright Content" field to achieve richer styles and links.
Summary
Through the simple and powerful template tag system of AnQi CMS, dynamically displaying copyright information and the year at the bottom of the website becomes extremely easy.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 the more flexible functions of Anqi CMS, making website operation more at ease.
Common Questions (FAQ)
Q1:Why does the year at the bottom of my website not update immediately after modification?
A1:This is usually caused by the website cache.In the Anqi CMS backend, try clicking the "Update Cache" button to clear the system cache, and then refresh your website page.If there is still no update, please check whether the template file you modified is the correct common footer file, and confirm that the changes have been saved successfully.
Q2:Can I add links or images in the “Copyright Content” section?
A2:Yes, the 'Global Function Settings' of the 'AnQi CMS backend' supports you to input HTML code, including links (<a>tags) and images (<img>Label)。To ensure that these HTML codes are correctly parsed on the front-end page, please make sure to output them in the template.SiteCopyrightUsing|safeFilter, for example{{ siteCopyrightContent|safe }}.
Q3: If I use Safe CMS to manage multiple sites, do I need to set the copyright information separately for each site?
A3: Yes, Aanqi CMS supports multi-site management, with each site being independently configured.You need to log in to the backend of each site, then set the 'Website Name' and 'Copyright Content' in the 'Global Function Settings' of each site to achieve personalized management.