Skip to content

Commit

Permalink
add redirect for /results
Browse files Browse the repository at this point in the history
  • Loading branch information
mashehu committed Jul 25, 2023
1 parent 0d6d3ab commit 35f7ab2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/pages/[pipeline]/[version]/[...path].astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ if (meta) {
// check if version starts with usage, output, or docs
// if so, redirect to the versioned docs
if (version?.startsWith('usage') || version?.startsWith('output') || version?.startsWith('docs')) {
console.log('redirecting ', version, ' to ', meta.default_version);
console.log('redirecting ', version, ' to ', meta.releases[0].tag_name);
if (version === 'docs') {
return Astro.redirect(`/${pipeline}/${meta.releases[0].tag_name}/docs/${path}`);
}
return Astro.redirect(`/${pipeline}/${meta.releases[0].tag_name}/${version}`);
}
if (version?.startsWith('results')) {
console.log('redirecting ', version, ' to ', meta.releases[0].tag_name, '/results');
return Astro.redirect(`/${pipeline}/${meta.releases[0].tag_name}/results/`);
}
const release = meta.releases.find((r) => r.tag_name === version);
if (release) {
if (path?.startsWith('usage') || path?.startsWith('output')) {
Expand Down
1 change: 0 additions & 1 deletion src/pages/[pipeline]/[version]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export function getStaticPaths() {
pipelines_json.remote_workflows.forEach((pipeline) => {
const releases = pipeline.releases;
const extended_releases = [...releases, { tag_name: 'latest', doc_files: releases[0].doc_files }];
console.log(extended_releases);
extended_releases.forEach((release) => {
const md_files = release.doc_files.map((file) =>
file.replace('docs/', '').replace('.mdx', '').replace('.md', ''),
Expand Down

0 comments on commit 35f7ab2

Please sign in to comment.