seo 0.13.3 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/PRIVACY.md +9 -1
  2. package/dist/cli.js +84 -80
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{dist-BbTqJIE_.js → dist-4Yam8ps7.js} +1 -1
  5. package/dist/dist-B_2zww72.js +427 -0
  6. package/dist/dist-B_2zww72.js.map +1 -0
  7. package/dist/{esm-hHlvm1W0.js → esm-BmuxgZyN.js} +95 -188
  8. package/dist/{esm-hHlvm1W0.js.map → esm-BmuxgZyN.js.map} +1 -1
  9. package/dist/index.d.ts +73 -406
  10. package/dist/index.js +1448 -564
  11. package/dist/index.js.map +1 -1
  12. package/dist/mcp.d.ts +0 -14
  13. package/dist/mcp.js +1020 -807
  14. package/dist/mcp.js.map +1 -1
  15. package/dist/provider-sdk.d.ts +0 -2
  16. package/dist/provider-sdk.js +1 -2
  17. package/package.json +6 -5
  18. package/site-kit/README.md +13 -0
  19. package/site-kit/guide/build.md +70 -0
  20. package/site-kit/guide/data.md +49 -0
  21. package/site-kit/guide/golden-page.md +50 -0
  22. package/site-kit/guide/grow.md +58 -0
  23. package/site-kit/guide/launch.md +55 -0
  24. package/site-kit/guide/market.md +57 -0
  25. package/site-kit/guide/plan.md +49 -0
  26. package/site-kit/guide/scale.md +41 -0
  27. package/site-kit/guide/setup.md +59 -0
  28. package/site-kit/guide/writing.md +55 -0
  29. package/site-kit/starter/.github/workflows/refresh-data.yml +88 -0
  30. package/site-kit/starter/.node-version +1 -0
  31. package/site-kit/starter/AGENTS.md +65 -0
  32. package/site-kit/starter/README.md +11 -0
  33. package/site-kit/starter/astro.config.mjs +31 -0
  34. package/site-kit/starter/gitignore +7 -0
  35. package/site-kit/starter/llms.config.mjs +38 -0
  36. package/site-kit/starter/package.json +31 -0
  37. package/site-kit/starter/pnpm-workspace.yaml +5 -0
  38. package/site-kit/starter/public/_headers +5 -0
  39. package/site-kit/starter/public/favicon.svg +1 -0
  40. package/site-kit/starter/public/fonts/InterLatinVF.woff2 +0 -0
  41. package/site-kit/starter/public/fonts/JetBrainsMonoLatinVF.woff2 +0 -0
  42. package/site-kit/starter/public/fonts/LICENSE-inter.txt +93 -0
  43. package/site-kit/starter/public/fonts/LICENSE-jetbrains-mono.txt +93 -0
  44. package/site-kit/starter/scripts/deploy.mjs +60 -0
  45. package/site-kit/starter/scripts/markdown-rewrites.mjs +33 -0
  46. package/site-kit/starter/scripts/refresh-data.mjs +60 -0
  47. package/site-kit/starter/scripts/validate-data.mjs +47 -0
  48. package/site-kit/starter/site.config.json +9 -0
  49. package/site-kit/starter/src/components/Breadcrumbs.astro +27 -0
  50. package/site-kit/starter/src/components/Button.astro +46 -0
  51. package/site-kit/starter/src/components/Card.astro +54 -0
  52. package/site-kit/starter/src/components/CodeBlock.astro +62 -0
  53. package/site-kit/starter/src/components/FactTable.astro +45 -0
  54. package/site-kit/starter/src/components/FaqAccordion.astro +143 -0
  55. package/site-kit/starter/src/components/Footer.astro +34 -0
  56. package/site-kit/starter/src/components/FormInput.astro +18 -0
  57. package/site-kit/starter/src/components/FormSelect.astro +34 -0
  58. package/site-kit/starter/src/components/Header.astro +17 -0
  59. package/site-kit/starter/src/components/HugeIcon.astro +36 -0
  60. package/site-kit/starter/src/components/Logo.astro +21 -0
  61. package/site-kit/starter/src/components/PageHeader.astro +33 -0
  62. package/site-kit/starter/src/components/SectionHeading.astro +18 -0
  63. package/site-kit/starter/src/components/ui/button.ts +51 -0
  64. package/site-kit/starter/src/data/parks.json +106 -0
  65. package/site-kit/starter/src/data/sources.json +11 -0
  66. package/site-kit/starter/src/integrations/og-images.ts +49 -0
  67. package/site-kit/starter/src/integrations/sitemaps.ts +104 -0
  68. package/site-kit/starter/src/layouts/Base.astro +69 -0
  69. package/site-kit/starter/src/lib/cn.ts +5 -0
  70. package/site-kit/starter/src/lib/narrative.ts +115 -0
  71. package/site-kit/starter/src/lib/og/card.ts +85 -0
  72. package/site-kit/starter/src/lib/og/path.ts +14 -0
  73. package/site-kit/starter/src/lib/og/render.ts +30 -0
  74. package/site-kit/starter/src/lib/parks.ts +84 -0
  75. package/site-kit/starter/src/lib/seo.ts +97 -0
  76. package/site-kit/starter/src/pages/404.astro +30 -0
  77. package/site-kit/starter/src/pages/about.astro +39 -0
  78. package/site-kit/starter/src/pages/index.astro +52 -0
  79. package/site-kit/starter/src/pages/parks/[slug].astro +95 -0
  80. package/site-kit/starter/src/pages/regions/[region].astro +58 -0
  81. package/site-kit/starter/src/pages/robots.txt.ts +16 -0
  82. package/site-kit/starter/src/site.ts +29 -0
  83. package/site-kit/starter/src/styles/globals.css +561 -0
  84. package/site-kit/starter/tsconfig.json +5 -0
  85. package/site-kit/starter/wrangler.jsonc +16 -0
  86. package/skills/seo/SKILL.md +19 -1
  87. package/dist/dist-DBI-BioS.js +0 -420
  88. package/dist/dist-DBI-BioS.js.map +0 -1
@@ -0,0 +1,88 @@
1
+ name: Refresh data
2
+
3
+ # Checks the data sources once a month and opens a pull request when one
4
+ # changed. Nothing reaches the live site until a person reviews and merges
5
+ # it, so a bad source can never rewrite a price, a rate or a health number
6
+ # on its own. Set the schedule to how often your sources really change.
7
+ on:
8
+ schedule:
9
+ - cron: "23 4 1 * *"
10
+ workflow_dispatch:
11
+
12
+ concurrency:
13
+ group: refresh-data
14
+ cancel-in-progress: false
15
+
16
+ permissions:
17
+ contents: write
18
+ pull-requests: write
19
+
20
+ jobs:
21
+ refresh:
22
+ runs-on: ubuntu-latest
23
+ timeout-minutes: 60
24
+ env:
25
+ BRANCH: automation/refresh-data-${{ github.run_id }}
26
+ steps:
27
+ - uses: actions/checkout@v6
28
+
29
+ - name: Stop when a refresh pull request is already open
30
+ env:
31
+ GH_TOKEN: ${{ github.token }}
32
+ run: |
33
+ open=$(gh pr list --state open --json headRefName --jq '[.[] | select(.headRefName | startswith("automation/refresh-data-"))] | length')
34
+ if [ "$open" -gt 0 ]; then
35
+ echo "A data refresh pull request is already open. Review it first."
36
+ exit 0
37
+ fi
38
+
39
+ - uses: pnpm/action-setup@v4
40
+
41
+ - uses: actions/setup-node@v6
42
+ with:
43
+ node-version-file: .node-version
44
+ cache: pnpm
45
+
46
+ - run: pnpm install --frozen-lockfile
47
+
48
+ - name: Fetch changed sources
49
+ run: pnpm data:refresh
50
+
51
+ - name: Validate the data
52
+ run: pnpm data:validate
53
+
54
+ - name: Check what changed
55
+ id: changes
56
+ run: |
57
+ changed=$( { git diff --name-only; git ls-files --others --exclude-standard; } | sort -u)
58
+ if [ -z "$changed" ]; then
59
+ echo "No source changed."
60
+ echo "changed=false" >> "$GITHUB_OUTPUT"
61
+ exit 0
62
+ fi
63
+ unexpected=$(echo "$changed" | grep -Ev '^(src/data/|data/raw/)' || true)
64
+ if [ -n "$unexpected" ]; then
65
+ echo "The refresh changed files outside src/data and data/raw:"
66
+ echo "$unexpected"
67
+ exit 1
68
+ fi
69
+ echo "changed=true" >> "$GITHUB_OUTPUT"
70
+
71
+ - name: Build and check the site
72
+ if: steps.changes.outputs.changed == 'true'
73
+ run: pnpm build
74
+
75
+ - name: Open a pull request
76
+ if: steps.changes.outputs.changed == 'true'
77
+ env:
78
+ GH_TOKEN: ${{ github.token }}
79
+ run: |
80
+ git config user.name "github-actions[bot]"
81
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
82
+ git switch -c "$BRANCH"
83
+ git add -A -- src/data data/raw
84
+ git commit -m "chore(data): refresh data sources"
85
+ git push origin "$BRANCH"
86
+ gh pr create --base "${{ github.event.repository.default_branch }}" --head "$BRANCH" \
87
+ --title "Refresh data sources" \
88
+ --body "A data source changed. Check the changed numbers against the source before you merge. \`seo site check\` passed on this build."
@@ -0,0 +1 @@
1
+ 24
@@ -0,0 +1,65 @@
1
+ # Agent notes
2
+
3
+ This site was made with `seo site new`. It is a static Astro site on
4
+ Cloudflare Workers static assets, built from the data in `src/data`.
5
+
6
+ Work one step at a time. Print the instructions for a step with
7
+ `seo site guide <step>`: setup, market, data, plan, build, golden-page,
8
+ writing, scale, launch, grow. Follow the step, then show the person the
9
+ result before the next one.
10
+
11
+ `pnpm build` runs `seo site check`, and Cloudflare will not deploy a build
12
+ that fails it. Fix the page, the template or the data, never the check.
13
+ When a word the copy rules ban is part of the site's subject, add it to
14
+ `allowWords` in `site.config.json`.
15
+
16
+ ## Components
17
+
18
+ The design matches a clean blank theme: Tailwind 4, Inter and JetBrains
19
+ Mono, soft `bg-muted` panels with no borders or shadows, and automatic
20
+ light and dark mode. Reuse these before writing new markup:
21
+
22
+ - `Header.astro`, `Footer.astro`: links come from `nav` and `footerLinks`
23
+ in `src/site.ts`.
24
+ - `PageHeader.astro`: the H1 and the one-paragraph answer under it.
25
+ - `Breadcrumbs.astro`: drawn by the layout from its `breadcrumbs` prop.
26
+ - `SectionHeading.astro`: an H2 with a short line of text.
27
+ - `Card.astro`: a muted panel with an icon, title and text. A linked card
28
+ takes `link`, a label that says where it goes. Put cards in
29
+ `grid grid-cols-1 gap-2 sm:grid-cols-2`.
30
+ - `FactTable.astro`: facts with their source and checked date.
31
+ - `FaqAccordion.astro`: questions and answers. Pass the same list to the
32
+ layout's `faqs` prop.
33
+ - `Button.astro` (and `ui/button.ts`), `FormInput.astro`,
34
+ `FormSelect.astro`, `CodeBlock.astro`, `HugeIcon.astro`, `Logo.astro`.
35
+ - `site-prose`: put it on an `<article>` for plain headings, paragraphs,
36
+ lists and tables.
37
+
38
+ Every colour comes from `src/styles/globals.css`. Use token classes such
39
+ as `bg-muted`, `text-foreground`, `text-foreground-muted` and
40
+ `text-primary`. `seo site check` fails on raw colours (`#fff`, `rgb()`,
41
+ `bg-blue-600`) and on `<style>` blocks in pages, components and layouts,
42
+ so the theme changes in one place. To restyle the site, change the tokens
43
+ there, the mark in `Logo.astro` and `public/favicon.svg`, and the card
44
+ colours in `src/lib/og/card.ts`.
45
+
46
+ ## Where things live
47
+
48
+ - `site.config.json`: the site name, domain, description and choices.
49
+ - `src/data`: the dataset and its sources, each with a checked date.
50
+ - `src/lib/narrative.ts`: page prose built from facts in the data.
51
+ - `src/layouts/Base.astro`: the title, canonical, sharing tags and JSON-LD.
52
+ - `src/components`: the components listed above.
53
+ - `src/styles/globals.css`: the theme, the only place for colours.
54
+ - `src/integrations`: sharing images and sitemaps, drawn from the build.
55
+ - `scripts`: data refresh and validation, deploy with IndexNow, and the
56
+ Markdown rewrite rules.
57
+
58
+ ## Never
59
+
60
+ - Never add noindex to a page people should find. Protect previews with
61
+ Cloudflare Access instead.
62
+ - Never guess a fact. Keep an unknown value unknown and say so on the page.
63
+ - Never use `run_worker_first` for Markdown copies.
64
+ - Never change a live URL without a 301 to the closest page.
65
+ - Never write about the build, the tools or search terms in page copy.
@@ -0,0 +1,11 @@
1
+ # Example Parks
2
+
3
+ A data-driven site made with `seo site new`.
4
+
5
+ ```sh
6
+ pnpm dev # local preview
7
+ pnpm build # build, then seo site check
8
+ pnpm run deploy
9
+ ```
10
+
11
+ Read `AGENTS.md`, then run `seo site guide setup` for the first step.
@@ -0,0 +1,31 @@
1
+ // @ts-check
2
+ import { agentMarkdown } from '@iannuttall/seo-graph-astro'
3
+ import tailwindcss from '@tailwindcss/vite'
4
+ import { defineConfig } from 'astro/config'
5
+ import ogImages from './src/integrations/og-images.ts'
6
+ import sitemaps from './src/integrations/sitemaps.ts'
7
+ import { llmsTxt } from './llms.config.mjs'
8
+ import config from './site.config.json' with { type: 'json' }
9
+
10
+ // Static HTML on Cloudflare Workers static assets. Every URL has one form:
11
+ // no trailing slash, served from `page.html`.
12
+ export default defineConfig({
13
+ site: `https://${config.domain}`,
14
+ output: 'static',
15
+ trailingSlash: 'never',
16
+ build: { format: 'file' },
17
+ devToolbar: { enabled: false },
18
+ integrations: [
19
+ // A Markdown copy of every page, llms.txt and agent-routes.json.
20
+ agentMarkdown({ llmsTxt, routeMigrationWarnings: false }),
21
+ // These two read the finished HTML, so they run last.
22
+ ogImages(),
23
+ sitemaps(),
24
+ ],
25
+ vite: {
26
+ // Tailwind 4. The theme is src/styles/globals.css.
27
+ plugins: [tailwindcss()],
28
+ // Orb and tunnel previews use generated hostnames.
29
+ server: { allowedHosts: true },
30
+ },
31
+ })
@@ -0,0 +1,7 @@
1
+ node_modules
2
+ dist
3
+ .astro
4
+ .wrangler
5
+ .env
6
+ .env.*
7
+ .dev.vars*
@@ -0,0 +1,38 @@
1
+ import parks from './src/data/parks.json' with { type: 'json' }
2
+ import config from './site.config.json' with { type: 'json' }
3
+
4
+ const regions = [...new Set(parks.map((park) => park.region))].sort()
5
+ const slug = (text) =>
6
+ text
7
+ .toLowerCase()
8
+ .replace(/[^a-z0-9]+/g, '-')
9
+ .replace(/^-|-$/g, '')
10
+
11
+ /** @satisfies {import('@iannuttall/seo-graph-core').LlmsTxtConfig} */
12
+ export const llmsTxt = {
13
+ title: config.name,
14
+ summary: config.description,
15
+ sections: [
16
+ {
17
+ heading: 'Start here',
18
+ items: [
19
+ { path: '/', label: config.name },
20
+ { path: '/about', label: 'Where the data comes from' },
21
+ ],
22
+ },
23
+ {
24
+ heading: 'Regions',
25
+ items: regions.map((region) => ({
26
+ path: `/regions/${slug(region)}`,
27
+ label: `Parks in ${region}`,
28
+ })),
29
+ },
30
+ {
31
+ heading: 'Parks',
32
+ items: parks.map((park) => ({
33
+ path: `/parks/${park.slug}`,
34
+ label: park.name,
35
+ })),
36
+ },
37
+ ],
38
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "example-site",
3
+ "private": true,
4
+ "type": "module",
5
+ "engines": {
6
+ "node": ">=22.12"
7
+ },
8
+ "scripts": {
9
+ "dev": "astro dev",
10
+ "build": "astro build && seo site check",
11
+ "preview": "astro preview",
12
+ "check": "seo site check",
13
+ "deploy": "node scripts/deploy.mjs",
14
+ "data:refresh": "node scripts/refresh-data.mjs",
15
+ "data:validate": "node scripts/validate-data.mjs",
16
+ "rewrites": "node scripts/markdown-rewrites.mjs"
17
+ },
18
+ "dependencies": {
19
+ "@hugeicons/core-free-icons": "^4.4.0",
20
+ "@iannuttall/seo-graph-astro": "0.0.12",
21
+ "@iannuttall/seo-graph-core": "0.0.5",
22
+ "@tailwindcss/vite": "^4.3.4",
23
+ "astro": "^7.4.5",
24
+ "tailwindcss": "^4.3.4"
25
+ },
26
+ "devDependencies": {
27
+ "seo": "latest",
28
+ "takumi-js": "2.19.0",
29
+ "wrangler": "^4.156.2"
30
+ }
31
+ }
@@ -0,0 +1,5 @@
1
+ # Packages whose install scripts may run: the bundler Astro uses and the
2
+ # local Cloudflare runtime that wrangler uses.
3
+ allowBuilds:
4
+ esbuild: true
5
+ workerd: true
@@ -0,0 +1,5 @@
1
+ /_astro/*
2
+ Cache-Control: public, max-age=31536000, immutable
3
+
4
+ /og/*
5
+ Cache-Control: public, max-age=86400
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>Site icon</title><style>path{fill:#111}@media (prefers-color-scheme:dark){path{fill:#fff}}</style><path d="M16 3c-4 5-7 9-7 13a7 7 0 0 0 6 6.9V29h2v-6.1A7 7 0 0 0 23 16c0-4-3-8-7-13z"/></svg>
@@ -0,0 +1,93 @@
1
+ Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) Inter-Italic[opsz,wght].ttf: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) JetBrainsMono-Italic[wght].ttf: Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,60 @@
1
+ // Deploys the built site, then tells search engines which pages changed.
2
+ // It compares the page hashes in dist/indexnow.json with the copy on the
3
+ // live site and sends only added, updated and removed URLs to IndexNow.
4
+ // Set this as the Cloudflare Workers Builds deploy command: pnpm run deploy
5
+ import { execFileSync } from 'node:child_process'
6
+ import { readFile } from 'node:fs/promises'
7
+ import {
8
+ changedUrls,
9
+ diffManifests,
10
+ parseManifest,
11
+ submitToIndexNow,
12
+ } from '@iannuttall/seo-graph-core'
13
+ import config from '../site.config.json' with { type: 'json' }
14
+
15
+ const origin = `https://${config.domain}`
16
+ const current = parseManifest(await readFile('dist/indexnow.json', 'utf8'))
17
+ if (!current) throw new Error('dist/indexnow.json is missing. Run the build.')
18
+
19
+ let previous = null
20
+ try {
21
+ const response = await fetch(`${origin}/indexnow.json`, {
22
+ signal: AbortSignal.timeout(10_000),
23
+ })
24
+ if (response.ok) previous = parseManifest(await response.text())
25
+ } catch {
26
+ // The first deploy has no live copy.
27
+ }
28
+
29
+ execFileSync('npx', ['wrangler', 'deploy'], { stdio: 'inherit' })
30
+
31
+ // Only tell search engines once the domain serves this site, which the
32
+ // key file proves. Before launch the site lives on workers.dev.
33
+ let live = false
34
+ try {
35
+ const response = await fetch(`${origin}/${config.indexNowKey}.txt`, {
36
+ signal: AbortSignal.timeout(10_000),
37
+ })
38
+ live = response.ok && (await response.text()).trim() === config.indexNowKey
39
+ } catch {
40
+ live = false
41
+ }
42
+ if (!config.indexNowKey || !live) {
43
+ console.log(`IndexNow skipped: ${origin} does not serve this site yet.`)
44
+ } else {
45
+ const urls = changedUrls(diffManifests(previous ?? {}, current))
46
+ if (!urls.length) {
47
+ console.log('IndexNow: no pages changed.')
48
+ } else {
49
+ const results = await submitToIndexNow({
50
+ host: config.domain,
51
+ key: config.indexNowKey,
52
+ urls,
53
+ })
54
+ for (const result of results) {
55
+ console.log(
56
+ `IndexNow: ${result.submitted} URLs, status ${result.status}${result.ok ? '' : ` (${result.message})`}`,
57
+ )
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,33 @@
1
+ // Prints the two Cloudflare URL rewrite rules that answer
2
+ // `Accept: text/markdown` at a page's normal URL with its Markdown copy.
3
+ // Add them under Rules > Transform Rules > Rewrite URL for the zone.
4
+ // Rewrite rules run before the static assets, so no Worker code runs and
5
+ // bots cost nothing (never use run_worker_first for this).
6
+ import config from '../site.config.json' with { type: 'json' }
7
+
8
+ const host = `http.host eq "${config.domain}"`
9
+ const method = '(http.request.method eq "GET" or http.request.method eq "HEAD")'
10
+ const accept =
11
+ '(starts_with(lower(http.request.headers["accept"][0]), "text/markdown"))'
12
+
13
+ const rules = [
14
+ {
15
+ name: 'Markdown copy of the home page',
16
+ expression: `(${host} and ${method} and http.request.uri.path eq "/" and ${accept})`,
17
+ rewrite: 'Static: /index.md',
18
+ },
19
+ {
20
+ name: 'Markdown copy of every other page',
21
+ expression: `(${host} and ${method} and http.request.uri.path ne "/" and not ends_with(http.request.uri.path, "/") and not (http.request.uri.path contains ".") and ${accept})`,
22
+ rewrite: 'Dynamic: concat(http.request.uri.path, ".md")',
23
+ },
24
+ ]
25
+
26
+ for (const rule of rules) {
27
+ console.log(
28
+ `${rule.name}\n\nWhen incoming requests match (Edit expression):\n${rule.expression}\n\nThen rewrite the path to:\n${rule.rewrite}\n\nQuery: preserve\n`,
29
+ )
30
+ }
31
+ console.log(
32
+ `Check it after the next deploy:\ncurl -sI -H "Accept: text/markdown" https://${config.domain}/ | grep -i content-type`,
33
+ )
@@ -0,0 +1,60 @@
1
+ // Checks every source in src/data/sources.json for changes. A source that
2
+ // answers with the same ETag, Last-Modified date or file hash is unchanged.
3
+ // A changed source is saved to data/raw/<id>, its checked date moves to
4
+ // today, and the refresh workflow opens a pull request for a person to
5
+ // review. Turning the raw file into src/data/*.json is site specific: write
6
+ // that step in scripts/build-data.mjs when you add your own data.
7
+ import { createHash } from 'node:crypto'
8
+ import { existsSync } from 'node:fs'
9
+ import { mkdir, readFile, writeFile } from 'node:fs/promises'
10
+
11
+ const sourcesFile = 'src/data/sources.json'
12
+ const sources = JSON.parse(await readFile(sourcesFile, 'utf8'))
13
+ const today = new Date().toISOString().slice(0, 10)
14
+ let changed = 0
15
+
16
+ for (const source of sources) {
17
+ const headers = {}
18
+ if (source.etag) headers['If-None-Match'] = source.etag
19
+ if (source.lastModified) headers['If-Modified-Since'] = source.lastModified
20
+ let response
21
+ try {
22
+ response = await fetch(source.url, {
23
+ headers,
24
+ signal: AbortSignal.timeout(60_000),
25
+ })
26
+ } catch (error) {
27
+ console.error(`${source.id}: could not fetch ${source.url}: ${error}`)
28
+ process.exitCode = 1
29
+ continue
30
+ }
31
+ if (response.status === 304) {
32
+ console.log(`${source.id}: unchanged`)
33
+ continue
34
+ }
35
+ if (!response.ok) {
36
+ console.error(`${source.id}: ${source.url} returned ${response.status}`)
37
+ process.exitCode = 1
38
+ continue
39
+ }
40
+ const body = Buffer.from(await response.arrayBuffer())
41
+ const sha256 = createHash('sha256').update(body).digest('hex')
42
+ source.etag = response.headers.get('etag')
43
+ source.lastModified = response.headers.get('last-modified')
44
+ if (sha256 === source.sha256) {
45
+ console.log(`${source.id}: unchanged`)
46
+ continue
47
+ }
48
+ await mkdir('data/raw', { recursive: true })
49
+ await writeFile(`data/raw/${source.id}`, body)
50
+ source.sha256 = sha256
51
+ source.checked = today
52
+ changed += 1
53
+ console.log(`${source.id}: changed, saved to data/raw/${source.id}`)
54
+ }
55
+
56
+ await writeFile(sourcesFile, `${JSON.stringify(sources, null, 2)}\n`)
57
+ if (changed && existsSync('scripts/build-data.mjs')) {
58
+ await import('./build-data.mjs')
59
+ }
60
+ console.log(`${changed} of ${sources.length} sources changed.`)