Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Site: search engines are told when the live site updates

Eric Brownrout6028ec27e05e
diff --git a/site/package.json b/site/package.json
index d23606be..ba276bf8 100644
--- a/site/package.json
+++ b/site/package.json
@@ -4,12 +4,12 @@
"license": "MIT",
"scripts": {
"dev": "next dev",
- "build": "node scripts/stars-snapshot.mjs && next build",
+ "build": "node scripts/stars-snapshot.mjs && next build && node scripts/submit-indexnow.mjs",
"start": "next start",
"site:bundle": "node scripts/bundle.mjs",
"site:stars": "node scripts/stars-snapshot.mjs --save",
"site:stills": "node scripts/stills.mjs",
- "test": "node renderer/timeline.test.mjs && node scripts/ribbon-geometry.test.mjs && node scripts/hero-entry.test.mjs && node scripts/headline.test.mjs && node scripts/theme.test.mjs && node scripts/hero-theme.test.mjs && node scripts/stars.test.mjs && node scripts/walkthrough.test.mjs && node scripts/features.test.mjs && node scripts/navigation.test.mjs && node scripts/updates.test.mjs && node scripts/llms.test.mjs && node scripts/home-metadata.test.mjs"
+ "test": "node renderer/timeline.test.mjs && node scripts/ribbon-geometry.test.mjs && node scripts/hero-entry.test.mjs && node scripts/headline.test.mjs && node scripts/theme.test.mjs && node scripts/hero-theme.test.mjs && node scripts/stars.test.mjs && node scripts/walkthrough.test.mjs && node scripts/features.test.mjs && node scripts/navigation.test.mjs && node scripts/updates.test.mjs && node scripts/llms.test.mjs && node scripts/home-metadata.test.mjs && node scripts/indexnow.test.mjs"
},
"dependencies": {
"next": "16.4.5",
diff --git a/site/public/80136ef773ad0e698e159c2c0af1c24a.txt b/site/public/80136ef773ad0e698e159c2c0af1c24a.txt
new file mode 100644
index 00000000..59ef4dab
--- /dev/null
+++ b/site/public/80136ef773ad0e698e159c2c0af1c24a.txt
@@ -0,0 +1 @@
+80136ef773ad0e698e159c2c0af1c24a
diff --git a/site/scripts/indexnow.test.mjs b/site/scripts/indexnow.test.mjs
new file mode 100644
index 00000000..0fca6b17
--- /dev/null
+++ b/site/scripts/indexnow.test.mjs
@@ -0,0 +1,28 @@
+import assert from 'node:assert/strict'
+import { readFileSync } from 'node:fs'
+import { submitIndexNow } from './submit-indexnow.mjs'
+import { pageUrls } from './site-urls.mjs'
+
+const prod = { VERCEL: '1', VERCEL_ENV: 'production', VERCEL_GIT_COMMIT_REF: 'main' }
+let requests = 0
+const send = async (endpoint, options) => {
+ requests++
+ assert.equal(endpoint, 'https://api.indexnow.org/indexnow')
+ assert.equal(options.method, 'POST')
+ assert(options.signal instanceof AbortSignal)
+ const body = JSON.parse(options.body)
+ assert.deepEqual(body.urlList, pageUrls)
+ assert.equal(body.host, 'yogurt.so')
+ assert.match(body.key, /^[a-f0-9]{32}$/)
+ assert.equal(body.keyLocation, 'https://yogurt.so/' + body.key + '.txt')
+ assert.equal(readFileSync(new URL('../public/' + body.key + '.txt', import.meta.url), 'utf8').trim(), body.key)
+ return { status: 202 }
+}
+for (const env of [{}, { ...prod, VERCEL: '' }, { ...prod, VERCEL_ENV: 'preview' }, { ...prod, VERCEL_GIT_COMMIT_REF: 'feature' }])
+ assert.match(await submitIndexNow(env, send), /skipped/)
+assert.equal(requests, 0)
+assert.match(await submitIndexNow(prod, send), /202/)
+assert.equal(requests, 1)
+assert.match(await submitIndexNow(prod, async () => ({ status: 403 })), /key/)
+assert.match(await submitIndexNow(prod, async () => { throw Error('offline') }), /continuing/)
+console.log('IndexNow permits only production main, uses its published key, and tolerates submission failures.')
diff --git a/site/scripts/submit-indexnow.mjs b/site/scripts/submit-indexnow.mjs
new file mode 100644
index 00000000..ca292b64
--- /dev/null
+++ b/site/scripts/submit-indexnow.mjs
@@ -0,0 +1,26 @@
+import { pathToFileURL } from 'node:url'
+import { pageUrls } from './site-urls.mjs'
+
+const host = 'yogurt.so'
+const key = '80136ef773ad0e698e159c2c0af1c24a'
+
+export async function submitIndexNow(env, request = fetch) {
+ if (env.VERCEL !== '1' || env.VERCEL_ENV !== 'production' || env.VERCEL_GIT_COMMIT_REF !== 'main')
+ return 'skipped outside a production deploy of main'
+
+ try {
+ const response = await request('https://api.indexnow.org/indexnow', {
+ method: 'POST', headers: { 'Content-Type': 'application/json' }, redirect: 'error',
+ body: JSON.stringify({ host, key, keyLocation: `https://${host}/${key}.txt`, urlList: pageUrls }),
+ signal: AbortSignal.timeout(1000),
+ })
+ if (response.status === 403) return 'HTTP 403; the public key may not be live yet'
+ return `HTTP ${response.status} for ${pageUrls.length} public URLs`
+ } catch {
+ return 'request timed out or failed; continuing'
+ }
+}
+
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+ console.log('IndexNow: ' + await submitIndexNow(process.env))
+}