Jump to content

Span tag not working in Code Block

Recommended Posts

Hi there,

I have started 2 new Squarespace websites since the start of 2024. I am having issues with adding Copyright info with the current year span tag -- the year isn't displaying .

The code I am using on all my 2023 sites is working in that the current year is displaying on these older sites.

However with both my brand new sites, the <span id="currentYear"> tag is not displaying anything.

This is the code that I am using, and I have tried it within div tags too:

<p style="font-size:small;">Copyright &copy; <span id="currentYear"></span> [My website] All rights reserved.</p>

It's not a CSS issue because these new sites so far have no added CSS. 

Hmm. Have I got something wrong? Or this there a bug?

Thanks very much for being there and any assistance you may be able to give me.

All the best,

Angela

Link to comment
9 hours ago, AngelaSH said:

The code I am using on all my 2023 sites is working. However with both my brand new sites, the <span id="currentYear"> tag is not displaying anything.

Hi @AngelaSH.

The code you've quoted above is just one part of the code required to update the year. This is the HTML element that is usually placed in the visible footer area, and then updated by some JavaScript that you place in the Code Injection Footer panel.

Perhaps you've added script to the 2023 sites, but forgotten to add it to the newer ones? 🙂

The script will typically be something like this:

<script>
  var currentYear = new Date().getFullYear(); 
  document.getElementById("currentYear").innerText = currentYear; 
</script>

 

Did this help? Please give feedback by clicking an icon below  ⬇️

Edited by paul2009

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Would you like your customers to be able to mark their favourite products in your Squarespace store?

Link to comment

Thank you very much @paul2009

With my new 2024 sites, I copied and pasted the html script that I have been using on my other sites, the same script I added to my top level message. I will try your javascript once I upgrade the sites because javascript is a premium feature.

In appreciation. 🙂

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.