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

@@ -280,6 +280,23 @@ a { color: var(--c-primary); }
.wordmark-cms { color: var(--c-accent); }
/* Optional link back to the main site (site_url). */
.site-link {
display: inline-flex;
align-items: center;
gap: 4px;
margin-left: 8px;
color: var(--c-side-label);
font-size: 14px;
line-height: 1.5;
text-decoration: none;
transition: color var(--ease);
}
.site-link:hover { color: var(--c-accent); }
.site-link .icon { width: 16px; height: 16px; vertical-align: 0; }
.icon-button,
.theme-toggle,
.search-trigger {
@@ -892,6 +909,7 @@ html.js .copy-button:not([hidden]) { display: inline-flex; }
}
@media (max-width: 639.98px) {
.site-link-label { display: none; }
.pager { grid-template-columns: 1fr; }
.pager-next { grid-column: 1; }
.pager-empty { display: none; }

View File

@@ -1,7 +1,7 @@
{{define "header" -}}
<header class="site-header">
<button class="menu-button icon-button" type="button" aria-label="Open navigation" aria-expanded="false" aria-controls="sidebar">{{template "icon-menu"}}{{template "icon-x"}}</button>
<a class="wordmark" href="{{.HomeURL}}" aria-label="SummerCMS documentation home"><span class="wordmark-sun">{{template "icon-sun"}}</span><span class="wordmark-text">Summer<span class="wordmark-cms">CMS</span></span></a>
<a class="wordmark" href="{{.HomeURL}}" aria-label="SummerCMS documentation home"><span class="wordmark-sun">{{template "icon-sun"}}</span><span class="wordmark-text">Summer<span class="wordmark-cms">CMS</span></span></a>{{if .SiteURL}}<a class="site-link" href="{{.SiteURL}}" aria-label="{{.SiteLabel}}">{{template "icon-chevron-left"}}<span class="site-link-label">{{.SiteLabel}}</span></a>{{end}}
<div class="header-spacer"></div>
<button class="search-trigger" type="button" aria-label="Search docs" aria-haspopup="dialog" aria-controls="search">{{template "icon-search"}}<span class="search-trigger-label">Search docs</span><kbd>Ctrl K</kbd></button>
<button class="theme-toggle" type="button" data-theme="system" aria-label="Color theme: System. Switch to Light." title="Color theme: System. Switch to Light.">{{template "icon-monitor"}}{{template "icon-sun"}}{{template "icon-moon"}}</button>