Skip to content

Commit e52f12e

Browse files
Merge pull request #439 from eliashaeussler/docs/repo-links
2 parents 4475977 + 9eafe39 commit e52f12e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/.vitepress/config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const imageAltText: string = 'Screenshot from a terminal window running the "cac
1919
const repoUrl: string = 'https://github.com/eliashaeussler/cache-warmup';
2020
// @ts-ignore
2121
const rootPath: string = path.resolve(__dirname, '..');
22-
const replacer = new RepoLinkReplacer(repoUrl, rootPath);
22+
const replacer = new RepoLinkReplacer(repoUrl, rootPath, version);
2323

2424
export default defineConfig({
2525
title: title,

docs/.vitepress/repo-link-replacer.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class RepoLinkReplacer
66
constructor(
77
private readonly repoUrl: string,
88
private readonly rootPath: string,
9+
private readonly gitReference: string,
910
) {}
1011

1112
public replaceLink(link: string, templatePath: string): string
@@ -22,7 +23,7 @@ export class RepoLinkReplacer
2223
return link;
2324
}
2425

25-
const blobUrl = `${this.repoUrl}/blob/main/${relativePath.substring(3)}`;
26+
const blobUrl = `${this.repoUrl}/blob/${this.gitReference}/${relativePath.substring(3)}`;
2627

2728
if (process.env.NODE_ENV !== 'production') {
2829
console.log(`Replaced link: ${link}${blobUrl}`);

0 commit comments

Comments
 (0)