How to automatically display the current year in the footer of a website (for example “© 2023”)?

Calendar 78

As an experienced website operations expert, I am well aware of the importance of the details of website content, especially the minor details like the copyright year in the website footer, which not only concerns the professional image of the website but also indirectly affects the search engine's judgment of the "freshness" of the website content.It is naturally easy to achieve this in such an efficient and flexible content management system as AnQiCMS.Today, let's talk about how to automatically display the current year in the footer of a website, so that your website always remains 'youthful'!

AnQi CMS: Automatically update the copyright year at the footer of the website, say goodbye to the trouble of manual modification

During the operation of the website, many small and medium-sized enterprises or self-media operators often ignore a seemingly trivial detail that actually affects the professionalism and user experience of the website - the copyright year in the footer.If your website footer is still stuck in a few years ago, it not only makes visitors feel that the website lacks maintenance, but may also bring unnecessary trouble in some legal scenarios.Manually update once a year, although it is not frequent, it is also easy to forget, and it is undoubtedly repetitive work for multi-site managers.

The Anqi CMS offers a perfect solution with its simple and efficient architecture and powerful template features.It uses a syntax similar to the Django template engine, allowing you to easily convert technical information into practical display effects.

Learn about the template structure of AnQi CMS

To modify the website's footer, we first need to understand the template file organization of Anqi CMS. Typically, the template files of Anqi CMS are stored in/templatethe directory, and.htmlAs a file suffix. To improve the reusability of templates, common code segments such as headers (header) and footers (footer) are often extracted and placed/template/您的模板目录/belowbash.html(As a common skeleton) orpartial/For example, in the subdirectorypartial/footer.html. These files carry the common elements of the website, ensuring consistency of style across all pages.

Core tags:{% now %}power

The key to automatically updating the footer year in Anqi CMS lies in a very practical built-in tag -{% now %}. This tag is used to retrieve and display the current date and time, which allows us to accurately extract the current year.

{% now %}The use of labels is very intuitive, it requires a format string as a parameter, to tell the system how you want to display the current date and time. This format string follows the Go language's unique time formatting rules, with the most critical reference date being2006-01-02 15:04:05. You need to replace the corresponding part of this reference date with the output format you want. For example, if you want to display a four-digit year, the format string is"2006".

Step Details: Displaying the year dynamically in the footer

With an understanding of the template structure{% now %}Understand the tags, we can start to make changes.

  1. Locate the footer template fileFirst, you need to log in to the AnQi CMS backend, navigate to the "Template Design" section, and then enter "Template Editing". Here, find the template directory you are currently using (for exampledefault)。In the template directory, look for the file namedbash.htmlor in thepartial/subdirectoryfooter.htmlOr other files that may contain footer copyright information.If you are unsure which file it is, try searching for keywords similar to "Copyright

  2. Modify the copyright year codeFind the code line in the footer file that contains the copyright year. It may look like this:

    <p>Copyright © 2023 Your Company. All rights reserved.</p>
    

    Or

    <p>&copy; 2023 AnQiCMS</p>
    

    Now, we will replace the static year with a dynamic one.{% now %}.

    • Only show the current year:If you want to display only the current year, for example “© 2024”, you can modify it like this:“

      <p>Copyright © {% now "2006" %} Your Company. All rights reserved.</p>
      
    • Display the year range (for example “© 2020 - 2024”):If your website was established in 2020 and you want to display the range from the starting year to the current year, you can do it like this:

      <p>Copyright © 2020 - {% now "2006" %} Your Company. All rights reserved.</p>
      

      Please replace2020Replace it with the actual starting year of your website.

  3. Save and view the effectAfter completing the code modification, save your template file.To ensure that the modification takes effect immediately, you may need to go back to the Anqi CMS backend and clear the system cache under the 'Update Cache' function.Then, refresh your website's front-end page, and you will find that the copyright year at the footer has been automatically updated to the current year!

By making such a simple modification, your website footer will automatically update every year, without manual intervention, thereby maintaining the accuracy of information and enhancing the professionalism of the website.This is a small but beautiful convenience brought by Anqi CMS for website operations.

Summary

With the help of Anqi CMS, making the copyright year of the website footer automatically update is a simple and practical operation. Just understand its template mechanism and apply it flexibly.{% now %}The label can permanently solve this detail problem.This not only makes your website look more professional, but also saves the trouble of manual modification every year, allowing you to focus more energy on real content creation and marketing strategies.


Frequently Asked Questions (FAQ)

Q1: How do I display a year range like “© 2020 - 2024”?

A1:Very simple. You just need to manually enter the starting year of the website, then use{% now "2006" %}Dynamically display the current year. For example, if your website was launched in 2020, you can write it like this in the footer template:&copy; 2020 - {% now "2006" %} Your Company. All rights reserved.Thus, whenever a new year comes, the system will automatically replace the year '2006' with the latest year.

Q2:{% now "2006" %}What does the '2006' represent? Can I change it to display a different date format?

A2:Go language uses a specific reference date when formatting dates and times2006-01-02 15:04:05.999999999 -0700 MSTThis seemingly random date actually has special meanings for each number and character, corresponding to year, month, day, hour, minute, and second, etc. Therefore, you are in{% now %}The "2006" provided in the label tells the system that you want to extract and display the year part.

Of course, you can change it to display a different date format! For example:

  • Display "2024-01-02":{% now "2006-01-02" %}
  • Display "Jan 2, 2024":{% now "Jan 2, 2006" %}
  • Display "01/02/2024":{% now "01/02/2006" %}Only adjust the format string according to the reference date rule of the Go language.

Q3: What if my website has multiple footers or I can't find the footer file?

A3:In AnQi CMS, the common footer of the website is usually defined in the root directory of your current theme.bash.htmlIf your theme splits the footer, it may be located in the file.partial/footer.htmlor a similar path.

If you still can't locate:

  1. Check the "Template Design" menu:In the Anqi CMS backend, go to 'Template Design' -> 'Template Edit', select the currently active template, and then check the file list one by one, especiallybash.htmlorpartial/the files in the directory.
  2. Search keywords:In the background "template editing", there is usually a search function, you can try searching for keywords such as "copyright", "copyright", "footer" to quickly locate the files containing the relevant code.
  3. Multiple template situations:If your website has enabled the independent template mode for PC and mobile end, then there may be respective footer files under each template directory, and you may need to modify them separately. Through these methods, you should be able to find and modify the correct footer template file.

Related articles

How to format time with the `now` tag, and which common Go language time formats are supported (such as year month day hour minute second)?

In the daily operation of AnQiCMS, we often need to handle various time information, whether it is to display the article publication date or dynamically display the current time on the page, an accurate and friendly format of time presentation is crucial for improving user experience and website professionalism.As an enterprise-level content management system built with Go language, AnQiCMS also inherits the unique style of Go language in time processing, especially in how the `now` tag formats time, which is worth in-depth exploration.### `now` tag

2025-11-07

How to display the current date and time in the Anqi CMS template and output them in a custom format?

As an expert with many years of experience in website operations, I am well aware of the importance of content timeliness and display professionalism to the value of the website.In an AnQiCMS content management system that is flexible and efficient, accurately controlling the display of dates and times on the page and formatting the output according to actual needs is an indispensable part of improving user experience and optimizing information delivery.Today, let's delve into how to display and format dates and times effortlessly in the AnQiCMS template.

2025-11-07

What do `{{item.Title}}` and `{{archive.Title}}` represent in different template contexts?

As an experienced website operations expert, I know that understanding the meaning and usage scenarios of template variables is crucial for efficient website operation in a content management system.AnQiCMS (AnQiCMS) provides great convenience for content display with its flexible and powerful template engine.However, beginners or users not familiar with its template mechanism often become confused about the two seemingly similar variables `{{item.Title}}` and `{{archive.Title}}`.}]

2025-11-07

If a variable's value is an array or slice, how can you use a `for` loop in a template to iterate over and output its contents?

As an experienced website operations expert, I know that efficiently displaying dynamic data is very important in daily content management.AnQiCMS (AnQiCMS) leverages the powerful performance and flexible template system of the Go language to provide us with an excellent solution.Today, let's delve deeply into a practical and common scenario in AnQi CMS template development: how to use `for` loops to traverse arrays or slices and elegantly present their content on web pages.

2025-11-07

What is the special role of the `fake` parameter in the `now` tag, and in what scenarios would it be used?

As an experienced website operations expert, I have a deep understanding of AnQiCMS, an enterprise-level content management system developed based on the Go language.It is undoubtedly the powerful support for content operation with its high efficiency, flexibility, and is a capable assistant for small and medium-sized enterprises and self-media teams.In the process of dealing with templates every day, we always encounter various tags and parameters, which may seem trivial but can greatly affect development efficiency and content display effect.Today, let's delve into a seemingly mysterious yet extremely practical parameter - the `fake` parameter of the `now` tag.

2025-11-07

If you need to convert timestamp data (such as `CreatedTime`) to a readable date format, which auxiliary tag or filter should you use?

In AnQiCMS (AnQiCMS) daily operations and template design, we often encounter situations where we need to display time data, such as the article's published time `CreatedTime` or the update time `UpdatedTime`. These time data are usually stored in the database in the form of Unix timestamps, and a string of numbers as a timestamp is obviously not as intuitive and easy to read as

2025-11-07

How to quickly generate random Latin text content for placeholder testing during the early development of AnQi CMS templates?

## Enterprise CMS Template Development: Use `lorem` tag to quickly fill placeholder content and test layout effects At the beginning of website template development, every section of the design draft needs to be filled with content to visually display the layout effect.Imagine if every time you adjust the layout, you had to manually input a lot of text to verify the effect, that would be such a time-consuming and tedious task.As an experienced website operations expert, I know that efficiency is the key to success.Fortunately, AnQiCMS (AnQiCMS) relies on its powerful functionality based on a similar Django template engine

2025-11-07

How to specify the generation of random text by word count, paragraph count, or byte count using the `lorem` tag?

The Anqi CMS template tool: skillfully use the `lorem` tag to quickly generate high-quality random text We know that efficiency is the key to success in website operation and content creation.Efficient tools always make twice the work with half the effort when designing new pages, testing layouts, or quickly building content frameworks.AnQiCMS (AnQiCMS) is an enterprise-level content management system developed based on the Go language, committed to providing an efficient, customizable, and scalable solution, and naturally also understands this well.

2025-11-07