Webflow tip

Always display current copyright date in the footer using JavaScript in Webflow

Jaroslav Dlask
Jaroslav Dlask
June 6, 2022
2 min
Always display current copyright date in the footer using JavaScript in Webflow

1) Add a text block to the footer

Locate your website's footer and add a text block there. Make sure you are using the footer as a component so that it automatically updates on all other pages.

text block at the footer
Text block in the footer

2) Add a text span to text block's year

Select the "2000" and create a text span. You don't need to give it any class.

Text Span
Text Span

3) Give a unique ID to the text span

Switch to the settings panel in Webflow and give a unique ID to the text span. In this case, I choose "copyright-year". Please mind that the ID has to be unique in your entire Webflow project.

Text Span ID

4) Add this piece of code right after the text block

Last but not least don't forget to add the code below into the embed right after the text span. Don't forget to place the code between <script></script> tags. This way the copyright year will be always up to date!

document.getElementById("copyright-year").innerHTML = new Date().getFullYear();
Embed
Embedded script
I am working on the new articles. Feel free to contact me if you are interested in some topics!