From 81f8f9873615362aaace7c3243d2a1207d388ff7 Mon Sep 17 00:00:00 2001 From: Dave Lester <18080+davelester@users.noreply.github.com> Date: Mon, 10 Aug 2026 07:56:07 -0700 Subject: [PATCH 1/6] Inserts Swift logo above consolidated docc navigation. --- common/README | 13 ++++++++++--- common/header.html | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/common/README b/common/README index cce65f4b..505c2f2e 100644 --- a/common/README +++ b/common/README @@ -8,9 +8,16 @@ The common files need to be copied, or perhaps linked, into each of the DocC cat Both files are intentionally minimal: -- `header.html` has no visible content. It's a reserved hook (DocC's - `custom-header` template) for a future documentation-version switcher — - add the switcher UI to the `#version-switcher` div when that lands. +- `header.html` uses DocC's `custom-header` template hook to inject a Swift + logo linking to swift.org above the sidebar's link list. Because the + custom-header element renders in its own shadow root while the Navigator + sidebar it targets lives in the app's regular (light) DOM, the logo can't + be placed there via markup/slots alone — a script waits for + `.navigator .head-wrapper` to mount (via MutationObserver, since it's + rendered client-side by swift-docc-render) and prepends the logo link to + it. It also still reserves the `#version-switcher` div for a future + documentation-version switcher — add the switcher UI there when that + lands. - `footer.html` carries the copyright/trademark notice, the same legal links (License, Security, Privacy Policy, Cookies) swift.org's footer has, and an Adobe Analytics page-activation snippet mirroring swift.org's diff --git a/common/header.html b/common/header.html index ef1d844f..8ac24b6f 100644 --- a/common/header.html +++ b/common/header.html @@ -9,3 +9,42 @@ -->
+ + From e051780dc8de3b40c6495a8a527383ade4f2a71f Mon Sep 17 00:00:00 2001 From: Joe Heck Date: Mon, 10 Aug 2026 10:00:21 -0700 Subject: [PATCH 2/6] Move Swift logo into the masthead and use the official icon-swift.svg mark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original approach targeted the Navigator sidebar's `.head-wrapper`, which swift-docc-render tears down and rebuilds once the navigator index data finishes loading, discarding whatever a script had inserted into the loading-skeleton version — so the logo never stuck around. The masthead's `.pre-title` has no such swap: it mounts once from data already known at page load, so the logo (appended there, between the sidebar toggle and the page title) stays visible regardless of the sidebar's own shown/hidden/drawer state. Also swaps the placeholder mark for the official currentColor icon from swiftlang/swift-org-website's assets/images/icon-swift.svg. --- common/README | 24 +++++++++++++++-------- common/header.html | 48 ++++++++++++++++++++++++++++++---------------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/common/README b/common/README index 505c2f2e..f5db85ac 100644 --- a/common/README +++ b/common/README @@ -8,14 +8,22 @@ The common files need to be copied, or perhaps linked, into each of the DocC cat Both files are intentionally minimal: -- `header.html` uses DocC's `custom-header` template hook to inject a Swift - logo linking to swift.org above the sidebar's link list. Because the - custom-header element renders in its own shadow root while the Navigator - sidebar it targets lives in the app's regular (light) DOM, the logo can't - be placed there via markup/slots alone — a script waits for - `.navigator .head-wrapper` to mount (via MutationObserver, since it's - rendered client-side by swift-docc-render) and prepends the logo link to - it. It also still reserves the `#version-switcher` div for a future +- `header.html` uses DocC's `custom-header` template hook to add a Swift logo + linking to swift.org to the masthead, between the sidebar-toggle control + and the page title. It targets the masthead rather than the Navigator + sidebar itself because the masthead mounts once from data already known at + page load and never gets torn down and rebuilt — unlike the sidebar, which + swift-docc-render swaps from a loading-skeleton state to the real, + populated one once the navigator index data has loaded, discarding + whatever a script had inserted into the skeleton. The logo is appended as + the last child of `.pre-title` (the toggle's own wrapper) rather than + inserted as a sibling before `.nav-title`, because swift-docc-render's CSS + assigns the title its grid placement via the adjacent-sibling selector + `.pre-title + .nav-title`, which requires them to stay immediate siblings. + Because it's part of the persistent masthead rather than the sidebar, the + logo stays visible regardless of whether the sidebar is shown, hidden, or + a mobile drawer, with no extra positioning or z-index logic needed. It + also still reserves the `#version-switcher` div for a future documentation-version switcher — add the switcher UI there when that lands. - `footer.html` carries the copyright/trademark notice, the same legal links diff --git a/common/header.html b/common/header.html index 8ac24b6f..bb6c0204 100644 --- a/common/header.html +++ b/common/header.html @@ -12,38 +12,54 @@