Add a Dynamic Copyright Year to Your Squarespace Site
To create a dynamic copyright year on your Squarespace site, you can use a small JavaScript snippet that updates the year automatically. Here's how to implement it:
Step 1: Add the JavaScript
Log in to your Squarespace site.
Navigate to Settings > Advanced > Code Injection.
In the Footer section, paste the following JavaScript:
<!-- Date auto updater --> <script> document.addEventListener("DOMContentLoaded", function() { const copyrightElements = document.querySelectorAll(".dynamic-year"); copyrightElements.forEach(element => { element.textContent = new Date().getFullYear(); }); }); </script>
4. Save your changes.
This script finds all elements with the class ‘dynamic-year’ and updates them with the current year.
Step 2: Add the Dynamic Year Element
Go to the Squarespace page where your copyright information is displayed.
Replace the static year with this HTML:
<span class="dynamic-year"></span>
3. For example, your copyright section might now look like this:
© <span class="dynamic-year"></span> Your Company Name
Step 3: Add Custom CSS
Navigate to Design > Custom CSS.
Add the following code to style the dynamic year and the entire block:
.dynamic-year { color: white; font-size: 0.85rem; } #block-yui_3_17_2_1_1733844344098_19048 { font-family: Space Grotesk !important; font-size: 0.85rem; color: white; }
3. Save your changes.
This CSS ensures the dynamic year text and the overall block have consistent styling with your site's design.
Step 4: Customize the Block ID
Replace #block-yui_3_17_2_1_1733844344098_19048 with the Block ID of the block you want to apply the effect to.
How to Find a Block ID in Squarespace
Open your site in a browser.
Right-click on the block you want to edit and select Inspect (in Chrome) or your browser’s developer tools.
Look for the unique ID associated with the block, which typically starts with
#block-
followed by a string of numbers and letters.Copy the ID and replace it in the code snippet above.
Or, you can download Will Myers free chrome plugin, ‘Squarespace ID Finder’, from the Chrome store.