Webflow sync, pageviews & more.
NEW

How can I dynamically display the current year in the footer of all my Webflow sites?

TL;DR
  • Add a text element with a unique class (e.g., year-span) in your footer where the year should appear.
  • Insert JavaScript in your site's Footer Custom Code to set the element’s text to the current year: document.querySelector('.year-span').textContent = new Date().getFullYear();

To dynamically display the current year in your Webflow site footer, use a small custom script to auto-update it every year without manual edits.

1. Add a Text Element for the Year

  • In your Footer section, drag a Text Span or Text Block where the year should appear (e.g., next to © Your Company).
  • Add a custom class (like year-span) so you can target it with JavaScript.

2. Insert Custom Code to Update the Year

  • Go to Page Settings or Project Settings → Custom Code → Footer Code.

  • Add this script before the closing tag:

    <script>document.querySelector('.year-span').textContent = new Date().getFullYear();</script>

  • This sets the inner text of the .year-span element to the current year.

3. Publish and Test

  • Publish your website to view the change (scripts don’t run within Webflow Designer).
  • Confirm the correct 4-digit year appears in the footer.

4. Optional: Use CMS or Symbol for Multi-page Sites

  • If your footer is reused across pages using a Symbol, the year will update everywhere automatically since the script runs on each page.
  • No need to duplicate the script—once in the site-wide footer (via Custom Code) is enough.

Summary

Add a year-span text element in your footer, then use a short JavaScript snippet in your Custom Code to dynamically insert the current year. This ensures your site always displays the correct year without manual updates.

Rate this answer

Other Webflow Questions