sitemap.xml

A sitemap is the list of pages you want search engines to know about. Your PocketOne app builds one for you at https://<your app>/sitemap.xml:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>https://notes.example.com/</loc></url>
  <url><loc>https://notes.example.com/about</loc><lastmod>2026-11-30</lastmod></url>
  <url><loc>https://notes.example.com/pricing</loc></url>
</urlset>

and robots.txt points crawlers at it.

What's in it

  • Your pages. Every page in pb_pages (Pages).
  • Your static HTML. Every .html file in pb_public, with index.html listed as its folder (/docs/). Files whose names start with . or _, and 404.html, are skipped.
  • URLs you add, in Settings or from code (below).

Private paths are always left out (see Keep pages out of search). With nothing to list, or on an app kept out of search (staging, or --dev), /sitemap.xml answers 404 and robots.txt doesn't mention it.

Where the settings are

Open your app's dashboard at https://<your app>/_/, click Settings, then Extensions in the sidebar. The sitemap.xml section on that page holds the settings below. Change what you need and click Save.

Leave a page out

In a Markdown page's front matter:

---
sitemap: false
---

In a page's .ts code:

export const sitemap = false

To leave out pb_public's files altogether, turn on Leave out pb_public's HTML files in the sitemap.xml settings.

List pages with parameters

A route like pb_pages/blog/[slug].ets has one page per post, so it isn't listed until you say which. Export a sitemap function from its .ts file:

// pb_pages/blog/[slug].ts
export const sitemap = ({ app }) =>
  app.findRecordsByFilter('posts', 'published = true', '-updated', 0, 0).map((post) => ({
    params: { slug: post.get('slug') },
    lastmod: post.get('updated'),
  }))

Each entry fills the route's [params]; lastmod is optional. The function may be async.

Add URLs

In the sitemap.xml settings, Extra URLs, one per line: a path (/pricing) or a full URL.

From any pb_hooks file:

// pb_hooks/sitemap.pb.js
$sitemapXml.add('/pricing')
$sitemapXml.add(['/about', { path: '/changelog', lastmod: '2026-12-01' }])

// built each time the sitemap is: query anything
$sitemapXml.add(() => {
  const docs = $app.findRecordsByFilter('docs', 'public = true', 'slug', 0, 0)
  return docs.map((d) => ({ path: `/docs/${d.get('slug')}`, lastmod: d.get('updated') }))
})

A function that throws is left out and logged; the rest of the sitemap still answers. The list is rebuilt at most once a minute.

Big sites

Past 50,000 URLs, /sitemap.xml becomes an index pointing at /sitemap-1.xml, /sitemap-2.xml, and so on. Nothing to set up.

Write the whole file yourself

Put a sitemap.xml in pb_public (or pb_pages) and it answers instead of the generated one.

Turn it off

In pocketone.yaml:

sitemap-xml:
  enabled: false

Reference