(Squarespace) Change summary block title to heading 2

Summary Block Title uses

<a>

tag.

If you want to change it to heading 2

<h2>

tag, you can use this code to Website Tools > Code Injection > Footer
If code doesn’t work, you can comment below, message or email me.

<script>
document.addEventListener('DOMContentLoaded', function() {
 const elements = document.querySelectorAll('div.summary-title');
elements.forEach(element => {
  const div = document.createElement('h2');
  div.className = element.className;
  div.style.cssText = element.style.cssText;
  div.innerHTML = element.innerHTML;
  element.parentNode.replaceChild(div, element);
});
});
</script>

Result

1 Like