Skip to content

Commit e627bfa

Browse files
authored
Update GitHub link to use dynamic repository path
1 parent b813c7a commit e627bfa

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

website/src/pages/parts/[slug].astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export async function getStaticPaths() {
3737
const { model, descriptionHtml } = Astro.props;
3838
const baseUrl = import.meta.env.BASE_URL === '/' ? '' : import.meta.env.BASE_URL;
3939
40+
// 1. Define the repository path
41+
const repoPath = import.meta.env.PUBLIC_GITHUB_REPO || "jdegenstein/OpenPartVault";
42+
// 2. Build the folder URL utilizing the model.slug from your props
43+
const githubFolderUrl = `https://github.com/${repoPath}/tree/main/parts/${model.slug}`;
44+
4045
// Build the hierarchical file tree
4146
const fileTree = {};
4247
model.files.forEach(f => {
@@ -137,7 +142,7 @@ const fileTreeHtml = renderTree(fileTree);
137142
<div class="container">
138143
<div class="header-row" style="margin-bottom: 1rem;">
139144
<a href={`${baseUrl}/`}>&larr; Back to Vault</a>
140-
<a href={`https://github.com/jdegenstein/OpenPartVault/tree/main/parts/${model.slug}`} target="_blank" rel="noopener noreferrer" class="github-link">
145+
<a href={githubFolderUrl} target="_blank" rel="noopener noreferrer" class="github-link">
141146
View Folder on GitHub
142147
</a>
143148
</div>

0 commit comments

Comments
 (0)