Skip to content

Keep temporal.io links in the same tab across the site - #5361

Draft
Duncanma wants to merge 1 commit into
mainfrom
ExternalLinks
Draft

Duncanma wants to merge 1 commit into
mainfrom
ExternalLinks

Conversation

@Duncanma

Copy link
Copy Markdown
Contributor

Summary

temporal.io only treats a link as external — and only then opens it in a new tab — if its hostname isn't temporal.io or a *.temporal.io subdomain. docs.temporal.io had no equivalent logic: Docusaurus's defaults treat every absolute URL as external, so links to learn.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. PatternCards had dotnet.temporal.io marked external: true by hand).

  • Adds src/utils/links.ts (isExternalHref), a direct port of temporal.io's own check.
  • Applies it to MDX prose links (src/theme/MDXComponents.tsx).
  • Refactors GridCard, PatternCards, and SdkOverviewCards to derive "external" from the href via the shared check instead of their own ad hoc logic, and drops the now-dead external: true fields from docs/references/api-reference.mdx and docs/security.mdx.
  • Adds a custom navbar item component (TemporalNavbarLink, registered as the default type in NavbarItem/ComponentTypes, alongside the existing custom-askAI item) 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.
  • Same reasoning for the footer (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.
  • Verified live in the browser (dev server):
    • MDX prose links to learn.temporal.io stay 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.io stay in-tab; pkg.go.dev, javadoc.io, docs.rs, t.mp still open a new tab.
    • Navbar: "Courses" (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.
    • Footer: learn.temporal.io, community.temporal.io, trust.temporal.io, etc. lost the new-tab/icon; github.com/youtube.com kept both.
    • Both the navbar and footer logos (linking to https://temporal.io) no longer open a new tab and carry no target/rel.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
temporal-documentation Ready Ready Preview Sep 17, 2026 10:28pm UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

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.

1 participant