Skip to content

Commit

Permalink
bugfix: refs should never be tagged in the starlight redirect URLs
Browse files Browse the repository at this point in the history
Tony Sullivan committed Jun 6, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent cf859ea commit a5878f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/data/examples.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import toTitle from "title"
import { toStarlightName } from "../utils/constants.js"
import { isStarlightName, toStarlightName } from "../utils/constants.js"
import {
astroContentUrl,
githubRequest,
@@ -55,7 +55,8 @@ export type Example = {
}

function toExample({ name }: ExampleData, ref: string): Example {
const suffix = ref === "main" ? "@next" : ""
// ignore refs for Starlight! Those examples always come from main
const suffix = ref === "main" && !isStarlightName(name) ? "@next" : ""
let title: string
if (TITLES.has(name)) {
title = TITLES.get(name) as string // we just checked w/ `.has()` it should exist.

0 comments on commit a5878f8

Please sign in to comment.