Skip to content

Workshop: language-track switcher for jsii-published languages #6

Description

@so0k

Once TerraConstructs publishes to Python/Go/.NET/Java via jsii, the workshop should let a reader pick their language.

Not per-block tabs

The tempting design is tabbed code blocks (JS | Python | Go) inside one page. That works for API docs, where only the snippet differs. It does not work for a tutorial, where changing the language also changes:

  • file names (hitcounter.ts vs hitcounter.py)
  • imports and idioms
  • project init commands and CLI invocation
  • which prerequisites apply at all

The original Hugo workshop already solved this with separate page trees per language — the Japanese content still has 20-typescript, 30-python, 40-dotnet, 50-java, 60-go side by side. Only the TypeScript track was ever written in English.

What already supports this

The ported content keeps that shape:

content/workshops/<locale>/<cloud>/<track>/...
content/workshops/en/aws/20-typescript/30-hello-cdk/200-lambda.mdx

lib/workshops.ts walks the tree generically, so adding 30-python/ alongside 20-typescript/ produces routes, sidebar entries and prev/next with no code change. Numeric prefixes order the tree and are stripped from URLs.

So this is a navigation feature, not a code-block one.

Scope

  • A track switcher in the workshop chrome that maps the current page to its equivalent in another track, falling back to the track root when there is no equivalent (tracks will not stay in lockstep).
  • Persist the choice across pages.
  • Decide what the shared chapters do — prerequisites and conclusion are language-agnostic today and sit outside any track.
  • Avoid advertising tracks that do not exist yet; the switcher should be driven by which track directories are actually present.

Per-block tabs are still worth having separately for genuinely snippet-only cases (npm/pnpm/yarn, macOS/Windows shell variants) — that is a much smaller component and not blocked on jsii.

Blocked on jsii publishing actually landing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions