Expand description
Search engines and language models: JSON-LD, sitemaps and llms.txt.
json_ld: structured data (Organization,FAQPage,BreadcrumbList…) as a<script type="application/ld+json">, escaped so the JSON can never close the script element.Sitemap:/sitemap.xml, with the other languages of each page (xhtml:link rel="alternate" hreflang) andlastmod.LlmsTxt:/llms.txt, the Markdown index of a site for language models (https://llmstxt.org).
The canonical and hreflang links of a page come from the visitor’s
locale: I18n::alternate_links.
ocre g seo writes src/seo.rs with the routes and a list of pages.
One address per page: redirect_www sends www. + the host of
APP_URL to APP_URL with a 301. IndexNow
tells Bing, Yandex and others that pages changed without waiting for a
crawl: indexnow_routes serves the key file, submit_to_indexnow
sends the URLs.
Structs§
- LlmsTxt
/llms.txt: a site’s summary and links in Markdown, for language models (https://llmstxt.org).- Sitemap
/sitemap.xml: the pages search engines should crawl.- Sitemap
Url - A page of a
Sitemap: its absolute URL, last change and other languages.
Constants§
- INDEXNOW_
ENDPOINT - The endpoint IndexNow submissions go to; participating engines share them.
- INDEXNOW_
KEY - Worker variable holding the IndexNow key: 8 to 128 letters, digits or
-(ocre secretprints one). - INDEXNOW_
KEY_ PATH - Where
indexnow_routesserves the key:/indexnow.txt(the submission names it askeyLocation).
Functions§
- indexnow_
routes GET /indexnow.txt: theINDEXNOW_KEY, which search engines fetch to check a submission.- json_ld
dataas a JSON-LD<script>for a page’s<head>.- redirect_
www - Middleware sending
www.+ the host ofAPP_URLtoAPP_URL, same path and query, with301 Moved Permanently. - submit_
to_ indexnow - Tells IndexNow-participating search engines (Bing, Yandex, Seznam, Naver…) that
urlswere added or changed.