feat(docsite): optional site_url and site_label link back to the main site

- site.yaml keys site_url and site_label, validated: http(s) URL with a host
  or a path starting with a single /; a label needs a URL
- docs:build and docs:serve flags --site-url and --site-label override them
  the way --base-url overrides base_url
- every page header, the 404 page included, links back with the explicit
  label, else the URL host, else Home; unset output is unchanged
- docs/console/utilities.md documents the keys and flags
This commit is contained in:
Jakub Zych
2026-10-01 16:09:40 +02:00
parent 7936234e8c
commit a494375db7
10 changed files with 207 additions and 10 deletions

View File

@@ -67,6 +67,11 @@ type pageView struct {
Content template.HTML
Assets string
HomeURL string
// SiteURL and SiteLabel are the link back to the main site, empty
// when site_url is unset. SiteURL points at another site, so it is
// never prefixed with base_url.
SiteURL string
SiteLabel string
SearchIndex string
LLMS string
LLMSFull string
@@ -85,6 +90,8 @@ func (s *site) baseView(current *Page) pageView {
return pageView{
Assets: s.url("assets"),
HomeURL: s.url("index.html"),
SiteURL: s.siteURL,
SiteLabel: s.siteLabel,
SearchIndex: s.url("search-index.json"),
LLMS: s.url("llms.txt"),
LLMSFull: s.url("llms-full.txt"),