Skip to content

📦 NEW: Add versioning - #48

Merged
MaedahBatool merged 20 commits into
sourcegraph:mainfrom
ahmadbilaldev:feature/versions
Feb 5, 2024
Merged

MaedahBatool merged 20 commits into
sourcegraph:mainfrom
ahmadbilaldev:feature/versions

Conversation

@ahmadbilaldev

@ahmadbilaldev ahmadbilaldev commented Jan 21, 2024

Copy link
Copy Markdown
Contributor

This PR adds a versioning support to docs.

It will enable multiple versions locally added in separate folders inside docs/versioned. The latest docs will stay in docs as before.

The link to latest docs will be sourcegraph.com/docs/ while for versioned docs it will be sourcegraph.com/docs/v/{versionName}/, for instance sourcegraph.com/docs/v/5.2.1/.

Working Features:

  • Updated route structure, combined 5 routes into a single catch all route. Previously Server routes are now SSG, speeding up page load times significantly.

  • Version selector dropdown to the top nav and a legacy versions page.

  • Docs/versioned folder for adding versioned docs. For example: Add a docs/versioned/5.2.1 folder to add docs for 5.2.1

  • Version list. Add active (non-legacy) versions list to data/versions.ts. Example below:

     export interface VersionI {
         name: string;
         label?: string; // Optional - Shown in the version dropdown
         url: string;
     }
     
     // Ensure the first entry is the latest active version
     export const versions: VersionI[] = [
         // Latest version
         {
             name: 'v5.2.3',
             label: 'latest',
             url: '/'
         },
         // Example version
         {
             name: 'v5.2.1',
             url: '/v/5.2.1'
         },
     ];
     
     export const latestVersion = versions[0];
    
  • Dynamically prepend versions to links inside docs.

  • Dynamically prepend versions to links inside MDX components.

  • Dynamic versioning support in Side Nav, Breadcrumbs.

Caveats

Versioning is ready for production. However here are some minor caveats that can probably be fixed later:

  • Searching on versioned docs will show results from latest docs.
  • Previous and next links at bottom of the page are disabled for versioned docs.

@MaedahBatool Please review the PR on your end.

@vercel

vercel Bot commented Jan 21, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sourcegraph-docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 4, 2024 9:42pm

@ahmadbilaldev ahmadbilaldev changed the title 📦 NEW: Add version selector dropdown 📦 NEW: Add versioning Feb 4, 2024
@MaedahBatool

Copy link
Copy Markdown
Contributor

LGTM 👍

@MaedahBatool
MaedahBatool merged commit 3d53253 into sourcegraph:main Feb 5, 2024
marcleblanc2 added a commit that referenced this pull request Sep 18, 2026
…exports

knip flagged these and rg confirms nothing imports them:

- docsearch/icons/index.ts barrel, and the AlgoliaLogo, NoResultsIcon,
  ControlKeyIcon, GoToExternalIcon icons only it re-exported. The two
  commented-out usages in Footer.tsx and NoResultsScreen.tsx go with
  them, along with the searchByText translation that only fed AlgoliaLogo
- docsearch/types/useDocSearchKeyboardEvents.ts, a drifted copy of the
  sibling hook DocSearch.tsx actually imports
- src/images/logos/aws/index.ts, generator output from before
  dev/generate-mermaid-icons.mjs switched to icons.generated.ts
- latestVersion in src/data/versions.ts, exported since #48 with no reader

Amp-Thread-ID: https://ampcode.com/threads/T-01a0ae6a-1645-702a-a5ed-92f8b9bce33b
Co-authored-by: Amp <amp@ampcode.com>
marcleblanc2 added a commit that referenced this pull request Sep 18, 2026
…exports

knip flagged these and rg confirms nothing imports them:

- docsearch/icons/index.ts barrel, and the AlgoliaLogo, NoResultsIcon,
  ControlKeyIcon, GoToExternalIcon icons only it re-exported. The two
  commented-out usages in Footer.tsx and NoResultsScreen.tsx go with
  them, along with the searchByText translation that only fed AlgoliaLogo
- docsearch/types/useDocSearchKeyboardEvents.ts, a drifted copy of the
  sibling hook DocSearch.tsx actually imports
- src/images/logos/aws/index.ts, generator output from before
  dev/generate-mermaid-icons.mjs switched to icons.generated.ts
- latestVersion in src/data/versions.ts, exported since #48 with no reader

Amp-Thread-ID: https://ampcode.com/threads/T-01a0ae6a-1645-702a-a5ed-92f8b9bce33b
Co-authored-by: Amp <amp@ampcode.com>
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