Seo playbook
Local-SEO rules and page-skill router for server-rendered multi-location marketing sites. Use when building, auditing, or changing anything that affects crawlability — titles, canonicals, robots, sitemaps, JSON-LD, hreflang, thin pages, indexing hosts — or when the user mentions SEO, structured data, rich results, Google Business Profile, or ranking. Load this before any of the seo-* page skills.From its SKILL.md
npx -y skills add nickdemari/Bytesize-SEO --skill seo-playbookAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
14.0 KB, as published. Nobody here has run it
SEO Playbook
Cross-cutting rules for a site whose reason for existing is search. The failure each rule prevents is recorded next to it, because a rule without its failure gets "simplified" away by the next person.
Scope. Server-rendered marketing and catalog sites with physical locations. Written against Rails/ERB, but every rule is framework-independent; only the snippets are Rails.
Route to the page skill
Load this skill first, then the one that matches the surface you are touching.
| Surface | Skill |
|---|---|
| Homepage, hero, H1, above-the-fold conversion | seo-home |
| Catalog: categories, subcategories, product pages, filters | seo-products |
| Service pages and service index | seo-services |
| Location pages, city/county pages, NAP, LocalBusiness | seo-locations |
| About, trust, founder story, Organization schema | seo-about |
| Global nav, logo, dropdowns, skip links | seo-header |
| Footer NAP, link mesh, secondary nav | seo-footer |
| Anything interactive: keyboard, focus, contrast, targets, labels | seo-accessibility |
Touching two surfaces means loading two skills. They do not repeat these rules — this file is the shared base.
seo-accessibility cuts across all of them rather than owning a surface. A page can satisfy
every rule in this playbook and still be unusable without a mouse — crawlers never tab, focus
or zoom, so nothing here tests it.
The first question, always
Is the content a crawler needs present in the initial HTML response?
If a fetch of the raw HTML does not contain the headings, copy, links and structured data,
nothing else in this playbook matters. Verify with curl, not with a browser — a browser
runs the JavaScript that is hiding the problem from you.
curl -s https://example.com/page | grep -c "the phrase that must rank"
The head contract
Every public page emits exactly these, and no page is allowed to skip one:
- A unique
<title> - A unique meta description, squished and truncated to ~160 characters
- A
<link rel="canonical">built from a configured origin, never the request - Open Graph and Twitter tags derived from the title and description already set
<meta name="robots">only when the page or the host needs a directive
Deriving the social tags from the same values the page already set is what stops the three
from disagreeing. Do not let a page set an OG title independently of its <title>.
<%# every page starts like this %>
<% page_title "..." %>
<% page_description "..." %>
<% content_for :head do %>
<%= some_json_ld %>
<% end %>
Open Graph uses property, Twitter uses name. Emitting the wrong attribute makes the
tag invisible to the scraper — it fails silently and looks fine in the markup.
Canonicals
Build canonicals from a configured host, not from the request.
def canonical_origin
Rails.application.config.x.canonical_host.presence || request.base_url
end
def canonical_url
"#{canonical_origin}#{request.path.chomp('/').presence || '/'}"
end
request.base_url means http://, https://, apex and www each canonicalise to
themselves — which consolidates nothing, the single job the tag has. The fallback to the
request exists only for development, where there is no fixed host.
- Drop query strings. Filters and tracking params must not split rankings.
- Drop the trailing slash.
/about/and/aboutare one page and must not claim two canonicals. - Anything emitting an absolute URL goes through
canonical_origin. This is where it gets missed:BreadcrumbListitemURLs were built fromrequest.base_url, so the staging deploy emitted structured data namingherokuapp.comon a page whose canonical named the production domain. The structured data and the canonical contradicted each other on the same page. Audit every absolute URL: canonical, OGurl, breadcrumb items, schema@id,Organization.url,logo, image URLs, the sitemap, androbots.txt.
Indexing is derived from the host, never from a flag
Any host that is not the canonical one gets noindex, nofollow.
def canonical_host?
configured = Rails.application.config.x.canonical_host.presence
return true if configured.blank? # dev and test have no fixed host
URI.parse(configured).host == request.host
rescue URI::InvalidURIError
false
end
Why derived and not an ALLOW_INDEXING env var: a flag defaults to the wrong answer the
day somebody forgets to set it on the real domain, and a silently noindexed production site
is unrecoverable for months. Derived means an unrecognised host is noindexed by default and
the real domain needs no configuration at all.
Emit it twice — as a meta tag for HTML, and as an X-Robots-Tag header for everything
with no <head> (XML, redirects, file responses):
before_action :noindex_non_canonical_hosts
def noindex_non_canonical_hosts
return if helpers.canonical_host?
response.set_header("X-Robots-Tag", "noindex, nofollow")
end
Crawling stays allowed on non-canonical hosts. Disallow: / on staging feels tidy and
is actively wrong: it stops crawlers fetching the pages at all, so they never see the
noindex and can keep the URLs indexed on inbound links alone. Allowing the crawl is what
actually gets a staging copy dropped. Do not "harden" this.
robots.txt
Render it from a controller. Do not put a file in public/.
A static file is served by the static-file middleware before the router runs, so it
silently shadows the route — and a committed robots.txt hardcodes one host, which a
crawler on any other host ignores outright. Rendering it means the Sitemap: line names the
same origin the canonicals do.
On a non-canonical host: allow crawling, disallow admin and health endpoints, and omit the
Sitemap: line — submitting a sitemap from a host that must not be indexed works against
your own noindex.
Sitemap
Generate a static file and serve it off disk. There is deliberately no route: static files are matched before the router, so a catch-all route never sees the request.
- No
priority, nochangefreq. Google has stated it ignores both; emitting them is noise. lastmodonly where a real timestamp exists. An invented one teaches crawlers to distrust the entire file. Hand-written pages get nolastmod.- Exclude thin pages (see below). A sitemap entry for a page that is
noindexis a direct contradiction of the page's own tag. - Absolute URLs, one origin, no trailing slashes.
- Regenerate on deploy and whenever content changes through an admin. A sitemap is stale the moment someone publishes a product.
The cache-control trap
Static-file middleware applies its headers as a flat hash with no per-path support. A
production cache-control: max-age=31536000 — correct for fingerprinted assets — also lands
on robots.txt and sitemap.xml. A crawler or CDN holding a year-old sitemap never sees a
new page.
Fix with a tiny middleware inserted before the static-file middleware, rewriting the header on the way out:
class CrawlerFileCacheControl
PATHS = %w[/sitemap.xml /robots.txt].freeze
CACHE_CONTROL = "public, max-age=#{1.hour.to_i}".freeze
def initialize(app) = @app = app
def call(env)
status, headers, body = @app.call(env)
headers["cache-control"] = CACHE_CONTROL if PATHS.include?(env["PATH_INFO"])
[ status, headers, body ]
end
end
Structured data
Escape it properly. Anything that reaches JSON-LD from a database — product copy, a service description — is user input.
def json_ld_tag(data)
tag.script(raw(ERB::Util.json_escape(ActiveSupport::JSON.encode(data))),
type: "application/ld+json")
end
JSON.pretty_generate bypasses HTML-entity escaping, so a description containing a literal
</script> breaks out of the element — invalid structured data at best, stored XSS at worst.
json_escape turns < > & into \u00xx, which JSON parsers read identically and HTML
parsers cannot act on.
Verify every @type against schema.org before shipping it. FlooringStore looks
entirely plausible and does not exist — schema.org returns 404 for it — and an
unrecognised type makes the whole block meaningless while validating tools stay quiet. When
no leaf type fits, use an array of real ones that share an ancestor:
"@type" => [ "Store", "HomeAndConstructionBusiness" ]
Never emit aggregateRating or review on your own Organization or LocalBusiness
nodes. Google rules a business ineligible for review stars when it controls the reviews
about itself. Genuine per-product reviews on Product are the only compliant route to stars.
Omit offers when you have no prices. Google ignores the block for snippets rather than
penalising you; fabricating a price to gain rich-result eligibility violates the
structured-data policies.
Absolute URLs only. Google rejects relative image paths in structured data.
Emit optional fields only when the data is real. Approximated geo coordinates drop a
pin on the wrong building, which is worse than no pin. .compact the hash.
FAQPage rich results were removed from Google Search in May 2026. Valid markup, zero snippet. Keep it if you already have it; do not build content strategy around it.
Thin pages
A page that renders a heading and a phone number reads as a soft 404, and Google drags the surrounding taxonomy down with it. When a page has no substance yet:
<% robots_directives "noindex, follow" unless @has_content %>
follow, not nofollow — the page's links still deserve to be crawled. And exclude it from
the sitemap.
Key the check off whether real content exists, never off a filtered result count. Otherwise ticking a filter deindexes a page that has plenty of products. This distinction has its own regression test for a reason.
URLs
- Human-readable slugs in every public URL. Never numeric ids.
- Scope slug uniqueness to the parent, not globally, so two categories can each have an "area-rugs" child.
- Admin URLs use numeric ids. If
to_paramreturns a slug, Rails path helpers call it automatically and every admin edit link silently points at the wrong record — slugs unique only within a parent can resolve to a different row. Constrain admin routes withid: /\d+/and passrecord.idexplicitly, including inform_with'surl:. - Breadcrumbs describe hierarchy, not path segments. A location at
/springfieldstill belongs under Home / Locations in its trail. - Render the visible trail and the
BreadcrumbListfrom one source, so they cannot drift.
Do not reach for SEO gems
Researched, not assumed:
canonical-rails— gemspec excludes Rails 8.1 and failsbundle lockoutright.friendly_id— redundant against a 30-lineSluggableconcern whose unique indexes are already scoped per parent.meta-tags— the only gap it fills is OG/Twitter tags, which is a dozen tags over values you already compute.sitemap_generator— a sitemap model is ~100 lines of ordinary code. The gem is a dependency earning very little.
Serving XML is not an SEO decision. Google cannot tell how the file was produced.
Multi-location
Never duplicate copy between location pages. Near-identical pages with the city swapped
is the most common multi-location failure and Google discounts both. Different service towns,
different landmarks, different staff, different photographs. See seo-locations.
Images
Real photography of the actual premises, staff and installs. Stock imagery is worth nothing for local search — anyone can buy the same file.
Resize client photographs before they ship. A 4000×3000 phone photo at 1.7 MB became 1800×1013 at 356 KB with a centre crop, quality 70 and EXIF stripped — and it was the LCP element on the page. Set an explicit budget and hold to it.
Give width/height on every image so nothing reflows, fetchpriority="high" to the one
LCP image and nothing else, and loading="lazy" below the fold.
Verification
Write one integration test that asserts the invariants, and treat every production SEO bug as a new case in it. The suite that guards this playbook covers:
- every public page returns 200 with a title, description and canonical
- titles are unique across public pages
- canonicals drop query strings and trailing slashes
- every JSON-LD block on every page parses
- admin-entered content cannot break out of the
ld+jsonblock - schema
@types are real and opening hours are valid - location nodes have distinct
@ids - no
aggregateRatingorreviewon org/business nodes Productomitsoffers- thin pages are
noindex, followand absent from the sitemap - a non-canonical host is noindexed and still crawlable
- breadcrumb
itemURLs use the canonical host
Run it after any change to the SEO helper, the layout, or the sitemap.
Deployment traps that break SEO silently
- Release-phase filesystem writes do not persist. Generating
sitemap.xmlin a platform's release phase writes it to a container that is then thrown away — the web process serves a 404 forever. Generate at build time into the slug/image, commit the file, or serve it from a route. - Know which branch pushes are covered by CI. A workflow triggering only on
pull_requestandpush: [main]gives zero coverage to a deploy branch named anything else. Direct pushes then reach production unchecked, and a red PR check may be inherited from a base branch someone broke rather than from your own diff. - Verify the deploy, do not assume it.
curlthe live page for a string unique to the change. A green build is not a live change.