Skip to content

Commit

Permalink
Merge pull request nf-core#1945 from mashehu/fix-mermaid-script
Browse files Browse the repository at this point in the history
Handle new url style to fix PrevNextButtons and active side bar elements
  • Loading branch information
mashehu authored Aug 23, 2023
2 parents 552ed23 + fc412c1 commit 118d011
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/components/sidebar/SidebarNav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export interface Props {
minimal?: boolean;
}
const url = Astro.url.pathname.endsWith('/') ? Astro.url.pathname.slice(0, -1) : Astro.url.pathname;
let url = Astro.url.pathname.endsWith('/') ? Astro.url.pathname.slice(0, -1) : Astro.url.pathname;
url = url.replace(/\.html$/, '');
---

<div class="nav">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/[...doc].astro
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contributingDocs
sections[1].children.push({ title: doc.data.title, slug: '/docs/' + doc.slug });
});
// find the index of the current page and use that to get the previous and next page
const url = Astro.url.pathname.replace(/\/$/, '');
const url = Astro.url.pathname.replace(/\/$/, '').replace(/\.html$/, '');
const currentDocs = url.startsWith('/docs/usage/') ? usageDocs : contributingDocs;
const current_page_index = currentDocs.findIndex((page) => '/docs/' + page.slug === url);
Expand Down
10 changes: 5 additions & 5 deletions src/pages/events/[event_type].astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export async function getStaticPaths() {
events = events.filter((event) => {
return event.slug.split('/').length === 2;
});
return events.map((event) => {
if (event.data.title.toLowerCase().match('bytesize')) {
event.data.type = 'bytesize';
}
// reduce events to unique event types
const event_types = [...new Set(events.map((event) => event.data.type)), 'bytesize'];
return event_types.map((event_type) => {
return {
params: {
event_type: event.data.type,
event_type: event_type,
},
props: {
events: events,
Expand Down

0 comments on commit 118d011

Please sign in to comment.