Add your pages to the sitemap and llms.txt
Two helpers list your published pages: floconSitemap() and floconLlmsTxt(). Both come from @flocon-ai/react.
Drafts are never listed. Run them on the server only: they read your token from FLOCON_TOKEN.
Give your URL rule
Both helpers take a url function. It gets { locale, path } and returns the full URL of the page on your website. Build it the way your website does.
Sitemap
Example with React Router v7:
app/routes/sitemap[.]xml.ts
import { floconSitemap } from "@flocon-ai/react"
export async function loader() {
const xml = await floconSitemap({
url: ({ locale, path }) => `https://example.com${path}`,
})
return new Response(xml, {
headers: { "content-type": "application/xml; charset=utf-8" },
})
}floconSitemap() returns XML with hreflang links.
llms.txt
app/routes/llms[.]txt.ts
import { floconLlmsTxt } from "@flocon-ai/react"
export async function loader() {
const text = await floconLlmsTxt({
url: ({ locale, path }) => `https://example.com${path}`,
})
return new Response(text, {
headers: { "content-type": "text/plain; charset=utf-8" },
})
}getAllPages()
Use it when you need the list yourself. It returns the published pages, without their blocks.
import { getAllPages } from "@flocon-ai/react"
const pages = await getAllPages()Updated