year-span
) in your footer where the year should appear.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.
year-span
) so you can target it with JavaScript.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.
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.