squirrelscan
GitHub

Social share buttons: detecting them on content pages

Share buttons make it one click instead of three to pass a page on. squirrel looks for share markup, share libraries and platform share URLs.

What a share button is

A share button is a link or control that opens a platform’s compose window prefilled with the page URL. It saves a reader copying the address and switching apps, which is most of the friction in sharing something.

They earn their place on content people share: articles, guides, research. On a pricing page or a contact form they are decoration. Three or four platforms is usually the whole useful set. A share button can be a plain link, but the widget versions bring a third-party script each.

What squirrel checks

The rule runs on every crawled page and looks for two things. The lowercased page HTML matching one of four patterns: share plus facebook, share plus twitter, share plus linkedin, or the names addthis, addtoany, shareaholic and sumo-share. And links whose href contains facebook.com/sharer, twitter.com/intent/tweet or linkedin.com/share. It emits a single check named share-buttons:

  • Pass when either was found. Message: Social share functionality detected, with 3 share link(s) as the value when share URLs were counted.
  • Info when neither was found and the page URL contains /blog, /article, /post or /news. Message: No share buttons on content page, with Consider adding for better engagement as the value.
  • Info otherwise. Message: No social share buttons detected.

The HTML pattern test is loose: an article about sharing on Facebook can match it. Severity info, weight 2.

How to fix it

<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fexample.com%2Fpost">Share on X</a>

Plain links to each platform’s share endpoint need no third-party script and work without JavaScript. Note that this rule recognises twitter.com/intent/tweet and not the x.com form, so a site using the newer host is not detected. Put them where a reader finishes reading rather than before they start.

The navigator.share API is a better fit on mobile, since it offers the platforms the reader actually uses.

Rule IDsocial/share-buttons
CategorySocial Media
ScopePer-page
Severityinfo
Weight2/10

Enable / disable

Disable this rule

[rules]
disable = ["social/share-buttons"]

Disable all Social Media rules

[rules]
disable = ["social/*"]

Enable only this rule

[rules]
enable = ["social/share-buttons"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

Social Media findings ship in every audit next to the SEO, performance and agent experience rules. See Fix SEO issues with AI for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the Social Media section of the report. Each page is reported with whether share functionality was detected. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close