Site address and search engines
Base path: base_url
base_url is the path the site lives under on the server: "/" for the
domain root or, for example, "/docs/" for a subfolder. Set it before the
production build: the generator adds it to all internal links and file
addresses, and verify-static checks that links stay inside it.
Public address: site_url
site_url is the absolute public address of the site: the origin and
base_url together. The path in site_url must match base_url, otherwise
the build stops with SITE_URL_BASE_MISMATCH.
{
"base_url": "/docara/",
"site_url": "https://simai.github.io/docara/",
"discovery": {
"description": "Docara documentation.",
"llms_links": [
{"title": "AI manifest", "path": "ai.json", "description": "machine-readable documentation index"}
]
},
"branding": {
"share_image": "assets/share.png"
}
}
When site_url is set, the build also:
- writes
sitemap.xml,robots.txt,llms.txtandllms-full.txtto the site root (underbase_url); - puts a text copy,
index.md, next to each indexable page; - makes
canonicalandhreflangof every page absolute, and the canonical address of redirect pages too; - adds schema.org structured data (JSON-LD):
WebSite,TechArticle(aWebPagefor a language’s home page) withinLanguage,dateModifiedand the picture, andBreadcrumbListwhen the page shows breadcrumbs; - adds Open Graph and Twitter card tags:
og:title,og:description,og:url,og:type(websitefor a locale’s home page,articlefor the rest),og:localeandog:locale:alternatefor translations,og:site_name,twitter:card,og:imageandtwitter:image.
sitemap.xml lists every published indexable page by its absolute
address with the date of its last change, lastmod — the time of the last
Git commit with the page’s source file (no Git, no date). Translated pages
have xhtml:link hreflang to all translations. The
map leaves out drafts (draft: true), pages with noindex: true in the
front matter, redirect pages, the 404.html page, other error pages (the
last route segment is a 4xx or 5xx code, for example 404/) and pages that
show the source text instead of a translation in publish-current mode.
robots.txt allows crawling the whole site and names sitemap.xml.
With discovery.ai_crawlers: "deny" it also closes the site to crawlers that
gather text for AI (GPTBot, ClaudeBot, Google-Extended, PerplexityBot, CCBot
and others); regular search engines still see the site.
Search robots read robots.txt only at the domain root: for a site in a
subfolder, for example on a project’s GitHub Pages, the file helps only if
the domain root serves it too or links to the sitemap.
llms.txt follows the llmstxt.org convention:
the heading is the site name, then the description (discovery.description,
otherwise the description of the main locale’s home page), the top-level
menu sections of the main locale with links and descriptions, the home pages
of other languages and machine-readable files: the links from
discovery.llms_links, sitemap.xml and _docara/page-metadata.json. A
path in llms_links starts from base_url; the file may appear after the
build too (for example ai.json written by a separate script), but it must
exist by the time verify-static runs.
llms-full.txt is the text of every indexable page of the main language
in one file: each page starts with its title, description and address, and
links to the site’s pages in it are absolute. index.md next to each
page is the same text copy of one page; the page links to it with
<link rel="alternate" type="text/markdown">. Copies are made only for pages
written in Markdown, without front matter and :::preserved blocks. Why this
helps and how to write pages for AI is in
SEO and GEO.
branding.share_image is the share picture: a PNG or JPEG file in the
project (not every social network shows WebP), "auto" or false. By
default ("auto") Docara draws one 1200×630 picture per language: the site
title, the description of the language’s home page (discovery.description
for the default language) and the site address. It needs PHP with the GD extension and FreeType; without them there is no
picture. The text can be in
Latin, Cyrillic and Greek; text in other scripts is left off the picture.
false removes the picture. A section or a page can override the value in
section.json and *.page.json. Without site_url the picture is not
published.
Without site_url the build output stays as before: these files and tags
are not created. If the content already publishes its own robots.txt,
sitemap.xml, llms.txt or llms-full.txt at the root, a build with site_url stops with
DISCOVERY_FILE_COLLISION.
With site_url set, verify-static checks that all three files exist and
are correct: sitemap.xml is a valid urlset, each address lies under
site_url and leads to a built indexable page, every such page is in the
map, and hreflang points to pages of its own locale; robots.txt matches
the expected text; every llms.txt link lies under site_url and leads to a
file of the build.
A site built for one path of a portal sets a portal section next to
site_url: then the build writes only llms.txt and leaves sitemap.xml and
robots.txt to the portal. See Building for a portal.
In CI it is handy to set site_url in the same step as base_url. For
GitHub Pages both values come from actions/configure-pages:
jq --arg base "${BASE_PATH%/}/" --arg site "${SITE_URL%/}/" \
'.base_url = $base | .site_url = $site' docara.json > docara.json.pages
mv docara.json.pages docara.json
where BASE_PATH is steps.pages.outputs.base_path and SITE_URL is
steps.pages.outputs.base_url. This is how
https://simai.github.io/docara/ is built.
Tab title
A page’s <title> is “Page title — Site name”. If the page title matches the
site name (usually on the home page), the name is not repeated:
<title>Docara</title>, not “Docara — Docara”.
See also
- Hosting the site —
base_urlon different hosts - Building for a portal
- Address and publishing fields in docara.json