Conversation
Docusaurus treats every absolute URL as external and opens it in a new tab, with no special case for other temporal.io properties. temporal.io itself only treats a link as external if its hostname isn't temporal.io or a *.temporal.io subdomain — so links between Temporal properties (docs.temporal.io, learn.temporal.io, community.temporal.io, etc.) stay in the same tab there. This mirrors that logic across docs.temporal.io. Adds src/utils/links.ts (isExternalHref, ported from temporal.io) and applies it to: - MDX prose links (src/theme/MDXComponents.tsx) - GridCard, PatternCards, SdkOverviewCards, which each had their own partial or hardcoded notion of "external" (PatternCards even had `dotnet.temporal.io` etc. marked `external: true` by hand) - The navbar: NavbarItem/ComponentTypes now registers a full custom 'default' item component (TemporalNavbarLink), since Docusaurus's own NavbarNavLink decides the new-tab/icon behavior internally and isn't overridable via props. This also gives us an owned seam for future top-nav changes, alongside the existing custom-askAI item. - The footer (Footer/LinkItem) and both logos (Logo, Footer/Logo), same reasoning — the icon/rel decisions are baked into Docusaurus's defaults, not exposed as overridable props, so those are swizzled rather than wrapped. Verified in the browser: temporal.io-family links (learn.temporal.io, community.temporal.io, trust.temporal.io, the nav/footer logos, etc.) now stay in-tab with no external icon, while genuinely external links (GitHub, YouTube, partner integration docs, t.mp, pkg.go.dev) keep target="_blank" and the icon. Desktop nav active-states, the mobile hamburger menu, and dropdown-item rendering all still work. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📖 Docs PR preview links
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
temporal.io only treats a link as external — and only then opens it in a new tab — if its hostname isn't
temporal.ioor a*.temporal.iosubdomain. docs.temporal.io had no equivalent logic: Docusaurus's defaults treat every absolute URL as external, so links tolearn.temporal.io,community.temporal.io,trust.temporal.io, etc. all opened in a new tab, and several components had their own partial or hand-maintained version of "is this external" that had already drifted (e.g.PatternCardshaddotnet.temporal.iomarkedexternal: trueby hand).src/utils/links.ts(isExternalHref), a direct port of temporal.io's own check.src/theme/MDXComponents.tsx).GridCard,PatternCards, andSdkOverviewCardsto derive "external" from the href via the shared check instead of their own ad hoc logic, and drops the now-deadexternal: truefields fromdocs/references/api-reference.mdxanddocs/security.mdx.TemporalNavbarLink, registered as thedefaulttype inNavbarItem/ComponentTypes, alongside the existingcustom-askAIitem) since Docusaurus's own navbar link renderer decides the new-tab/icon behavior internally and doesn't expose it as an overridable prop. This also gives us an owned seam for future top-nav changes.Footer/LinkItem) and both logos (Logo,Footer/Logo) — those are swizzled (fully reimplemented, matching Docusaurus's own logic) rather than thinly wrapped, since the icon/rel decisions aren't exposed as props either.Test plan
yarn build(runs automatically via this repo's pre-commit hook) — succeeds.vale --config .vale-ci.ini docs/references/api-reference.mdx docs/security.mdx— 0 errors/warnings.learn.temporal.iostay in-tab;chatgpt.com/claude.ai/GitHub links are unaffected.PatternCards/SdkOverviewCards:dotnet.temporal.io,php.temporal.io,python.temporal.io,ruby.temporal.io,typescript.temporal.iostay in-tab;pkg.go.dev,javadoc.io,docs.rs,t.mpstill open a new tab.learn.temporal.io) and "Code Exchange" (temporal.io/code-exchange) stay in-tab with no external icon; active-state highlighting and the mobile hamburger menu still work; dropdown-item rendering path unchanged.learn.temporal.io,community.temporal.io,trust.temporal.io, etc. lost the new-tab/icon;github.com/youtube.comkept both.https://temporal.io) no longer open a new tab and carry notarget/rel.🤖 Generated with Claude Code