SEO tags, sitemap and legal pages
SEO + metadata + legal generator
For when the answer to “People should find it on Google, and it needs privacy/terms pages” is yes.
Generates canonical/OG/Twitter tags, JSON-LD, sitemap.xml, robots.txt, and privacy/terms pages from the config the site already has, plus a --check that fails the build when launch placeholders remain.
Built by hand again in 9 of 20 audited projects before this existed. Each rebuild was another chance to make the mistake below.
Skip the rebuild
You do not write this one. It arrives in your project as ordinary source you can read, change and keep, with its audit record and its caveats beside it.
- Download the Playground. It is free and runs on your own machine.
- Start a new app and tick “People should find it on Google, and it needs privacy/terms pages”.
- This block is written in, along with anything else you ticked.
The mistake it removes
The single most repetitive hand-written work in the audit (9/20 sites). Audits keep failing sites on the same two mechanical things: placeholders shipping in canonical URLs, and no privacy/terms on a site that takes money.
What is already handled
This is checked by running the block’s own tests every time its checks run. Tested means the block’s own test suite runs that code. It does not mean a live run against an outside service such as a payment provider.
- JSON-LD is escaped for script context: a business_name containing '</script><script>alert(1)</script>' round-trips as DATA, verified with the real payload, asserting the block still parses as JSON and still contains exactly one script element. Tested
What the audit found
Named rather than summarized. The reasoning behind each one ships inside the block, so it travels with the code instead of living on a page you have to trust. A finding marked fixed was fixed after the audit ran; the verdict above is still the one the audit gave.
- Every open() uses the locale encoding, so on a non-UTF-8 locale the generator crashes on its own em dash and leaves an EMPTY privacy-policy.html behind major · Correctness Fixed after the audit in
ab176dc7f - Five malformed-input shapes produce a Python traceback with exit 1 instead of the promised `seo-kit:` refusal with exit 2 minor · Error handling & resilience Fixed after the audit in
e2a52bf48 - sitemap lastmod is written into XML unescaped and unvalidated minor · Security Fixed after the audit in
945d9f277 - The privacy and terms pages carry fixed promises the generator cannot know and config cannot override minor · Claims match behavior Fixed after the audit in
8171ad945 - write_all's `disallow` parameter has no CLI flag, so robots.txt Disallow lines are unreachable from the documented entry point minor · Reachability Fixed after the audit in
e161c3676
2 more findings are written in the auditors' internal shorthand, so they are not listed here. The full text is in the report inside the block. Both were fixed after the audit, in 1b285d04e, 82557d847.
What you still have to do
A copied file cannot own your secrets, your host or your legal obligations. This is the part the block deliberately does not claim.
- Serve the generated sitemap.xml and robots.txt at your domain root, and set base_url to the real origin. The generator writes correct files; whether a crawler can fetch them at the expected path is a hosting decision it cannot make.
- Wire `--check` into your build or CI so it can fail a deploy. Unrun, it fails nothing, and shipping launch placeholders in canonical URLs is the exact failure it exists to stop.
- Have the generated privacy and terms reviewed for your business and jurisdiction, and keep them in step with what the site actually collects. They are a baseline written from your config, not legal advice.
- These sentences are FIXED and no config key changes them, so edit the generated page if one is not true for you. Privacy: 'To answer your inquiry and provide the service you asked for. We do not sell your data.' and 'Ask us to show, correct, or delete the data we hold about you and we will.' Terms: 'Use it lawfully and don't try to break it. We may change or withdraw the service.', 'The site is provided as-is. We are not liable for indirect losses.', and with --sells 'Prices are shown before you pay and confirmed by our payment processor. We only charge you for what you order.' and 'Shipping times are estimates, not guarantees.' The cookie sentence follows `analytics` and the refund window follows `refund_days`.
- The JSON-LD never carries an aggregateRating, and a config rating or review_count is ignored. Google does not allow a business to mark up its own rating on its LocalBusiness or Organization entity, even with real numbers, so do not add one by hand either.
What lands in your project
python
- python/seo_kit.py
Import SeoKit, or run as CLI: python3 seo_kit.py --config config.json --out output/ --check. Stdlib only. --disallow PATH (repeat it for each path) writes a Disallow line to robots.txt; without it robots.txt allows everything. --pages takes [{path, title, description, image, lastmod}]: path is required, lastmod goes in the sitemap, and title+description (BOTH, or neither) write a meta/<slug>.html head block for you to include in that page. An unknown page key is an ERROR: this generator does not accept a value and then drop it. Choosing each path: Every page URL carries the page's target keyword: lowercase, hyphens, the city for a local page, no dates or ids (`/cape-coral-realtor/`, not `/page2/`, `/2026/09/new-post/` or `/services?id=4`).
What you supply
- business_name: required: refuses to generate without it
- base_url: required, absolute: a relative og:image silently shows no preview
- address/email/phone: optional: JSON-LD only includes what's real
- analytics: optional, true or false (default false). true swaps the privacy page's cookie sentence for an analytics-cookie disclosure. Any value that is not a real boolean is refused.
- refund_days: optional, whole number of days, at least 1 (default 30). The refund window the terms print with --sells. When it is unset and --sells is on, stderr says the 30-day promise is a default made on your behalf.
Licensed MIT. It is a starting point, not a finished product.
Get it
Download the Playground See the other blocks
Nothing here is locked. The files are yours, in your folder, under a permissive license.
Questions
- Is SEO tags, sitemap and legal pages audited?
- It was audited on 2026-09-29, and the verdict was not a clean pass. 7 findings have been fixed since then, and the verdict stands until the block is audited again.
- What do I still have to do myself?
- Serve the generated sitemap.xml and robots.txt at your domain root, and set base_url to the real origin. The generator writes correct files; whether a crawler can fetch them at the expected path is a hosting decision it cannot make.
- How do I get this code?
- Download the Playground, start a new app, and tick “People should find it on Google, and it needs privacy/terms pages”. The block is written into your project as ordinary source you can read and edit.
All pre-built code blocks · Learn to build from zero · The coding guide