Skip to content

Swift.org logo and link - #136

Open
heckj wants to merge 5 commits into
swiftlang:mainfrom
heckj:swift-logo-link
Open

Swift.org logo and link#136
heckj wants to merge 5 commits into
swiftlang:mainfrom
heckj:swift-logo-link

Conversation

@heckj

@heckj heckj commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a Swift logo link (to swift.org) above the Navigator sidebar's link list in the shared DocC header, injected via DocC's custom-header template hook.
  • Since the custom-header renders in its own shadow root while the Navigator sidebar lives in the app's regular DOM, a small 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.
  • Still reserves the #version-switcher div for a future documentation-version switcher.

See #138 for an alternate that's more invasive in DocC Render's output, but provides tighter customization than DocC currently allows.

And see #139 for an alternate the provides the link in a static header above the DocC Render content, following a bit closer to SPI's mantra of "don't touch anything DocC doesn't make available"

davelester and others added 2 commits August 10, 2026 10:00
… mark

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.
@heckj

heckj commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

@davelester I took the diff you started with, and changed it up:

  • replaced it with the swift-logo.svg from the swift.org website assets
  • injected it using a bit of JavaScript into the structure, but higher than you originally aimed it:
    • It's now inline with the button that toggles nav visibility on Desktop, and it's not overlaid into the content space when viewed on a mobile or small-size-class window
    • logo I choose intentionally works for both light and dark modes

Screenshots:

  • light, dark, and a dark-mode with the nav content toggled off

The swift logo is a link to www.swift.org to provide a link to the project
light-with-nav

dark-with-nav dark-nav-hidden

@heckj heckj self-assigned this Aug 10, 2026
@heckj
heckj requested review from davelester and daveverwer August 10, 2026 17:15
@heckj

heckj commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

New set of screenshots using the color logo, light & dark mode, nav toggled and off when in mobile size class

light-large dark-large dark-small dark-small-navtoggled light-small light-small-navtoggled

@heckj heckj changed the title Insert Swift logo above consolidated docc navigation Swift.org logo and link Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants