Hi,
How do I have the year change by default with the year changes in the footer of my website?
http://bluelakecreative.webflow.io/
https://preview.webflow.com/preview/bluelakecreative?preview=68cfbfda25786cb12e08e263487bbcaa
Best,
Nathan
Hi,
How do I have the year change by default with the year changes in the footer of my website?
http://bluelakecreative.webflow.io/
https://preview.webflow.com/preview/bluelakecreative?preview=68cfbfda25786cb12e08e263487bbcaa
Best,
Nathan
Hey @nathanphilsteele,
First let’s split that footer text in two parts:
Part 1: “Copyright © "
Part 2: " Blue Lake Creative. All Rights Reserved.”
Now set the footer text to display: inline so they align nicely in one row (you’ll also have to set the footer to text-align: center.)
Drag in an Embed field right in between the two footer text parts, Add this snippet and give the Embed the same class as footer text.
<script type="text/javascript">
document.write(new Date().getFullYear());
</script>
That should do the trick! It will now refresh the year browser-side, depending on the user’s time settings.
Let me know if you need any help!
Thanks @SidneyOttelohe!
I know waaay too many websites who could use this wonderful code. Awesome, simple guide @SidneyOttelohe
+1
Christopher
@ctrav Haha oh man don’t even get me started.
@nathanphilsteele You could also use this code you can customize, skip the first few steps and just drag in an Embed.
Copyright © 2015<script>new Date().getFullYear()>2015&&document.write("-"+new Date().getFullYear());</script>, Your Company Details.
Cheers
Hi @SidneyOttelohe,
The correct year is being pulled in like it should which is awesome!
I do have a couple of questions though:
Best,
Nathan
Select your footer section, go to typography and select text align.
For point 2 though, I’m not seeing any weird spaces on mobile, could you elaborate on this?
Yes that’s not looking smooth at all.
Try this:
Delete that footer text and embed,
Drag in a new embed and add this script:
Copyright © 2015<script>new Date().getFullYear()>2015&&document.write("-"+new Date().getFullYear());</script>, Blue Lake Creative. All Rights Reserved.
That should make things a bit easier!
Awesome, glad I could help!