File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ export async function getStaticPaths() {
3737const { model, descriptionHtml } = Astro .props ;
3838const 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
4146const fileTree = {};
4247model .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 }/ ` } >← 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 >
You can’t perform that action at this time.
0 commit comments