GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 📦 NEW: Add versioning by ahmadbilaldev · Pull Request #48 · sourcegraph/docs

Conversation

@ahmadbilaldev

@ahmadbilaldev ahmadbilaldev commented Jan 21, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ahmadbilaldev added 3 commits January 22, 2024 01:58
@ahmadbilaldev
📦 NEW: Add version select dropdown
19de41a
@ahmadbilaldev
👌 IMPROVE: Version selector
1589815
@ahmadbilaldev
📦 NEW: Legacy versions page
7895cf4
@vercel

vercel Bot commented Jan 21, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview January 21, 2024 21:03
View deployment
ahmadbilaldev added 16 commits January 31, 2024 18:01
@ahmadbilaldev
Remove old routing
ba402ab
@ahmadbilaldev
Add new catch all route
fb79196
@ahmadbilaldev
Add catch all route for versioned docs
3e6c147
@ahmadbilaldev
Update breadcrumbs to support catch all routes
94cdce4
@ahmadbilaldev
Update version selector
e9db736
@ahmadbilaldev
Fix theme selector hydration warning
0fa6971
@ahmadbilaldev
Add home page for versioned docs
f3d93b9
@ahmadbilaldev
Dynamically add versions to links inside docs
6079efa
@ahmadbilaldev
Custom component for versioning links inside docs
97d76e7
@ahmadbilaldev
Add versioning support to link cards
219a7b5
@ahmadbilaldev
Add versioning support to product cards
78cbee7
@ahmadbilaldev
Add versioning support to quick links
a368959
@ahmadbilaldev
improve version selector
f97fe0f
@ahmadbilaldev
Add versioning support to breadcrumbs
2d518a8
@ahmadbilaldev
Add versioning support to Side Nav
891e976
@ahmadbilaldev
Add missing slash to changelog link in nav
22ac2ae
@ahmadbilaldev ahmadbilaldev changed the title 📦 NEW: Add version selector dropdown 📦 NEW: Add versioning Feb 4, 2024
@vercel
vercel Bot had a problem deploying to Preview February 4, 2024 20:59 Failure
@ahmadbilaldev
Fix build error
3cd58c4
@vercel
vercel Bot deployed to Preview February 4, 2024 21:42
View deployment
@MaedahBatool

MaedahBatool commented Feb 5, 2024

Copy link
Copy Markdown
Contributor

LGTM 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MaedahBatool
MaedahBatool merged commit 3d53253 into sourcegraph:main Feb 5, 2024
@sourcegraph-bot-devx sourcegraph-bot-devx mentioned this pull request Feb 5, 2024
sourcegraph/docs#48: "📦 NEW: Add versioning" sourcegraph/sec-pr-audit-trail#454
Closed
@marcleblanc2 marcleblanc2 mentioned this pull request Sep 6, 2026
fix/site: Return HTTP 404 instead of 200 for unknown pages #1860
Merged
marcleblanc2 added a commit that referenced this pull request Sep 18, 2026
@marcleblanc2 @ampagent
chore: drop dead DocSearch icons, a stale hook duplicate, and unused …
777a9ab
…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 <[email protected]>
@marcleblanc2 marcleblanc2 mentioned this pull request Sep 18, 2026
Remove dead code #1997
Merged
marcleblanc2 added a commit that referenced this pull request Sep 18, 2026
@marcleblanc2 @ampagent
chore: drop dead DocSearch icons, a stale hook duplicate, and unused …
39deda6
…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 <[email protected]>
marcleblanc2 added a commit that referenced this pull request Sep 23, 2026
@marcleblanc2 @ampagent
chore: drop dead DocSearch icons, a stale hook duplicate, and unused …
383c2d3
…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 <[email protected]>
marcleblanc2 added a commit that referenced this pull request Sep 23, 2026
@marcleblanc2 @ampagent
chore: drop dead DocSearch icons, a stale hook duplicate, and unused …
c84e245
…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 <[email protected]>
marcleblanc2 added a commit that referenced this pull request Sep 23, 2026
@marcleblanc2 @ampagent
chore: drop dead DocSearch icons, a stale hook duplicate, and unused …
017d077
…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 <[email protected]>
marcleblanc2 added a commit that referenced this pull request Sep 23, 2026
@marcleblanc2 @ampagent
Remove dead code (#1997)
7382402
## Problem

- kbar (a ⌘K palette) was removed in #110, but its config in
`src/data/search.ts` and the contentlayer `onSuccess` hook stayed
behind, writing a 725 KB `public/search.json` on every build that
nothing fetches
- `src/utils/contentlayer.ts` only existed to build that index
- The `video` entry in `MdxComponents.tsx` never runs: MDX compiles an
explicit `<video>` to a literal element, so `components.video` is never
consulted (the `rounded-xl` class it set has never been applied)
- A knip scan turned up more dead code nothing imports:
- `docsearch/icons/index.ts` barrel and the `AlgoliaLogo`,
`NoResultsIcon`, `ControlKeyIcon`, `GoToExternalIcon` icons only it
re-exported (plus two commented-out usages and 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
- Dependencies `@iconify-json/logos`, `@iconify/types`, and `mdx` (not
MDX: a 2013 "generic documentation extractor", likely a typo-install of
`@mdx-js/mdx`)
- Absorbed from #1986 (closed in favour of this PR; the two collided on
`package.json`, the lockfile, `.gitignore`, and
`src/utils/contentlayer.ts`):
- `src/components/PreCode.tsx` (empty; the real `PreCode` lives in
`PreCodeBlock.tsx`), `src/components/ResourceEstimator.tsx` (older
duplicate of `resource-estimator/ResourceEstimator.tsx`),
`src/components/DemoLayout.tsx` (template leftover),
`src/components/TopBanner.tsx`, `src/components/icons/Globe.tsx`,
`src/components/icons/BugIcon.tsx`
- Dependencies with no import in `src/`, `dev/`, or any config:
`@docsearch/react` (only its CSS is vendored under
`src/components/search/docsearch/`), `@mdx-js/mdx` (contentlayer2 pulls
the same 3.1.1 transitively), `date-fns`, `fast-glob`, `feed`,
`prism-react-renderer`, `react-highlight-words` +
`@types/react-highlight-words`, `react-syntax-highlighter`,
`rehype-toc`, `simple-functional-loader`, `dotenv`. Kept on purpose:
`shiki` (peer of `rehype-pretty-code`) and `sharp`
- `.gitignore` entries for `public/changelog.rss` and
`public/technical-changelog.rss`: nothing generates them; the feed comes
from sourcegraph.com and `src/proxy.ts` redirects the old paths

## Change

Five commits, one per group above. 15 files deleted, 15 dependencies
removed, +1 −1585 (880 of that lockfile).

Independent of #1977 (only shared line was the `searchDocumentsPath`
comment in `src/data/search.ts`, gone here); whichever merges second
gets a one-line rebase.

## Verification

- `pnpm install --frozen-lockfile`, `npx tsc --noEmit` clean, `pnpm run
lint` at the 8-warning baseline, `pnpm run build` passes and no longer
produces `public/search.json`
- `rg -i 'kbar|search\.json'` finds nothing; `rg` finds no imports of
any deleted file, export, or dependency
- Rendered `<video>` markup on `/docs/code-monitoring` is byte-identical
before and after (it never had the class)
- Nobody fetches `search.json`: the new Algolia indexer (#2009) reads
`.contentlayer/generated/Post`, the old DocSearch crawler scraped HTML,
and Cloudflare analytics for `sourcegraph.com` show ~150 sampled
requests to `/docs/search.json` in the last 30 days, all with an empty
referer, random geos and browser UAs, and no daily cadence: scanner
noise, not a consumer

---------

Co-authored-by: Amp <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 3cd58c4d Deployed Feb 4, 2024 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ahmadbilaldev @MaedahBatool
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.