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 in your footer with a unique class like current-year.
  • Insert JavaScript in the Footer Code section to dynamically fill the element with the current year on page load, then publish to activate.

To dynamically display the current year in your Webflow footer, you'll need to use a small snippet of JavaScript since Webflow doesn't have a native dynamic date feature.

1. Add a Text Element for the Year

  • In your Footer Symbol (or global footer), add a Text Span, Text Block, or Text Link where the year should appear.
  • Give it a unique class name or custom ID, such as current-year, so you can target it with JavaScript.

2. Embed Custom Code

  • Go to Page Settings (for specific pages) or Project Settings > Custom Code > Footer Code (for all pages).

  • Paste this JavaScript snippet into the Before tag section:

  • This code finds all elements with the class current-year and updates their content to the current year when the page loads.

3. Publish Your Site

  • Click Publish to see the changes live. Preview mode won't run custom scripts, so publishing is required to test.

Summary

Insert a text element with a unique class like current-year in your footer, then use a JavaScript snippet (in Custom Code) to populate it dynamically at runtime. This ensures the current year updates automatically every new calendar year.

Rate this answer

Other Webflow Questions