Cookie Consent by Free Privacy Policy Generator

The Best Of

Go to the Best Of the SEO Community.

Noah
Noah
Jan 19, 2025, 11:11 AM
Forwarded from another channel:
Forwarded thread from another channel:
Kyle Faber
Kyle Faber
Oct 31, 2024, 7:47 PM
For those of you doing on-page assessments, here’s a simple script that you can save as a bookmark to make headings appear on the page.
Chrome extensions work, but I like this better when visually scanning and scrolling.
  const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
  headings.forEach(heading => {
    const tagName = heading.tagName;
    const prefixText = `[${tagName}] `;
    const firstChild = heading.firstChild;
    const isSpan = firstChild && firstChild.nodeType === Node.ELEMENT_NODE && firstChild.tagName === 'SPAN';
    const hasPrefix = isSpan && firstChild.textContent.trim() === prefixText.trim();
    if (!hasPrefix) {
      const prefixSpan = document.createElement('span');
      prefixSpan.textContent = prefixText;
      prefixSpan.style.background = '#ff0000';      // Red background
      prefixSpan.style.padding = '10px';            // 10px padding
      prefixSpan.style.color = '#fff';              // White text color
      prefixSpan.style.marginRight = '10px';        // 10px right margin
      prefixSpan.style.borderRadius = '3px';        // 3px border-radius
      heading.insertBefore(prefixSpan, firstChild);
    }
  });
})();```
And here it is in bookmark format:
Andy Drinkwater
Andy Drinkwater
Nov 1, 2024, 5:24 AM
Very nice! I’ll have a look later :) thank you.
Anne Berlin
Anne Berlin
Nov 1, 2024, 10:00 AM
ooh, that' *is* a useful way to see them! no dumb questions: how does one bookmark a scriptlet like that?
Kyle Faber
Kyle Faber
Nov 1, 2024, 11:05 AM
@Anne Berlin Take the bookmark code above and when creating the bookmark, set the name (I called mine “Save Headings”) and the URL (URL = the code above)
Anne Berlin
Anne Berlin
Nov 1, 2024, 11:13 AM
ok that was simple. thank you!

Our Values

What we believe in

Building friendships

Kindness

Giving

Elevating others

Creating Signal

Discussing ideas respectfully

What has no home here

Diminishing others

Gatekeeping

Taking without giving back

Spamming others

Arguing

Selling links and guest posts


Sign up for our Newsletter

Join our mailing list for updates

By signing up, you agree to our Privacy Policy and Terms of Service. We may send you occasional newsletters and promotional emails about our products and services. You can opt-out at any time.

Apply now to join our amazing community.

Powered by MODXModx Logo
the blazing fast + secure open source CMS.