Alternate copyright license on footer

Hi to all, I want a Creative Commons license on the footer of my blog, in my site’s code injection I enter the following

<script>
  document.addEventListener('DOMContentLoaded', function() {
      const copyrightElement = document.querySelector('.gh-copyright');
      if (copyrightElement) {
          copyrightElement.textContent ='CC BY-SA 4.0';
      }
  });
</script>

How can I make the text to link with the official license page?
Thanks in advance

You’d just need a slightly different code that not only changes the text content, but the entire HTML node :slight_smile:

<script>
  document.addEventListener('DOMContentLoaded', function() {
      const copyrightElement = document.querySelector('.gh-copyright');
      if (copyrightElement) {
          copyrightElement.innerHTML = '<a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="noopener noreferrer">CC BY-SA 4.0</a>';
      }
  });
</script>
1 Like

Jannis, I have no words, my friend, I appreciate your help all these times, Thank you I learned something from you today.

3 Likes

Absolute pleasure – glad this helps you with your site :slight_smile:

2 Likes