All skills

Google Preferred Source

Adds Google's "Preferred source" button to your site with a no-JS deeplink and your own button component, so readers can pick you in Google's Top Stories without loading Google's script.

Audit passed · 7/7SEO and webkreddevils18/marketing-skills

Install

Run `npx skills use "https://github.com/kreddevils18/marketing-skills" --skill "google-preferred-source"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.

Paste into any agent. It loads the skill for this task without installing it.

SKILL.md

View source

Google Preferred Source

Add a "Prefer us on Google" button that links readers to Google's source preferences tool for the site's host. The button is a plain link rendered by the site's own component: no Google script, no request to Google on page load.

Scope: the button, its placement, its test and its verification in the user's own repository. Hand off Search Console changes, Google News publisher setup and ranking or content work; this skill changes no Google account settings.

What it does

  • Readers choose sources at https://www.google.com/preferences/source. A chosen site is more likely to appear in their Top Stories and can be highlighted with a "preferred" label in AI Mode and AI Overviews.
  • Eligible: a domain or subdomain (example.com, news.example.com). A subpath (example.com/blog) is not.
  • AI Mode and AI Overviews also need the site to be included in "Search generative AI features" in Search Console. That is the owner's setting.

Details, sources and the approach comparison: references/preferred-sources-facts-and-approach.md.

Approach

Link to https://www.google.com/preferences/source?q=<host> as <a href target="_blank" rel="noopener"> from the site's own button component. Do not load publisher.js, even though Google calls it the recommended option: it is a third-party script with a privacy and performance cost, it does not follow the site's theme toggle, and it is harder to test. If the user insists on it, say this trade-off once and then follow Google's docs.

Workflow

  1. Find the canonical host. Look for an existing site URL constant or env var (metadata base URL, sitemap config, SITE_URL). Use its host only, with no scheme or path (example.com, or www.example.com if that is canonical). If the site lives on a subpath, or no host is found, stop and ask the user.
  2. Define the URL once, next to that constant: https://www.google.com/preferences/source?q= plus the URL-encoded host.
  3. Build one component in the site's framework, rendered on the server:
    • variants: default (icon + label + short line) and compact (icon + label);
    • an <a> with href, target="_blank", rel="noopener";
    • accessible name ending in "(opens in a new tab)" (visually hidden text or aria-label), decorative icon marked aria-hidden;
    • the site's own design tokens and button styles, correct in light and dark, a visible focus ring, at least a 44px tap target, no horizontal scroll at 375px width. Reuse the site's existing button or link primitive when it has one.
  4. Place it where readers have just finished reading: end of articles or posts, and the footer (compact). Ask before adding it anywhere more prominent.
  5. Test it. One focused test: href equals the expected URL, target is _blank, rel contains noopener, accessible name contains the label and "(opens in a new tab)". Use the repo's test runner and conventions.
  6. Verify (below), then hand the manual checks to the user.

Generic HTML and a Next.js/React example: references/component-examples.md. Keep copy short and in the site's voice, for example "Prefer us on Google" or "Add us as a preferred source on Google". Use Google's official badge graphics only if the user wants them (ZIP link in the facts reference).

Verify

  • Run the test and the repo's lint/type checks.

  • Load a page with the button and confirm in the browser network panel, or with the server HTML, that nothing is requested from google.com or news.google.com until the button is clicked:

    curl -s https://example.com/some-article | grep -o 'google.com/preferences/source[^"]*'
    curl -s https://example.com/some-article | grep -c 'publisher\.js'   # expect 0
    
  • Check the button at 375px width and in both themes; tab to it and see the focus ring.

Done when

  • The URL is defined once from the canonical host, and one component renders it.
  • The component is placed where the user agreed, and the focused test passes along with the repo's lint and type checks.
  • The server HTML contains the deeplink and no publisher.js, and the 375px, theme and focus checks were done, or each one is reported as not checked.
  • The manual checks below are handed to the user as pending.

Manual checks for the site owner

Report these as pending; the agent cannot confirm them:

  1. Open https://www.google.com/preferences/source, search for the domain and confirm it is listed. If it is not, the button still works but leads to an empty result.
  2. In Search Console, confirm the site is included in Search generative AI features, if the owner wants the preferred label in AI Mode and AI Overviews.

Security audits

Structure and frontmatter
Pass
Prompt lint and routing
Pass
Executable code
Pass
Secrets and private data
Pass
Network and data exfiltration
Pass
Instruction safety
Pass
Dependencies
Pass