From 9c222edcdf8d33a3701e20ebe8af36e6c4dd860c Mon Sep 17 00:00:00 2001 From: Peaceultime Date: Thu, 14 Mar 2024 17:45:39 +0100 Subject: [PATCH] Navigation links sorting change: index file are always on top. Markdown content: If the content don't includes a h1, the title is render at the beginning of the page --- components/NavigationLink.vue | 11 +++++++++++ pages/[...slug].vue | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/components/NavigationLink.vue b/components/NavigationLink.vue index c64a1d8..f9ff713 100644 --- a/components/NavigationLink.vue +++ b/components/NavigationLink.vue @@ -17,6 +17,17 @@ const hasChildren = computed(() => { return props.link && props.link.children && props.link.children.length > 0 || false; }); +if(hasChildren.value) +{ + props.link.children?.sort((a, b) => { + if(a._path === props.link._path) + return -1; + if(b._path === props.link._path) + return 1; + return 0; + }); +} + const collapsed = ref(!useRoute().path.startsWith(props.link._path)); diff --git a/pages/[...slug].vue b/pages/[...slug].vue index b1f455b..dc340a2 100644 --- a/pages/[...slug].vue +++ b/pages/[...slug].vue @@ -6,6 +6,7 @@ function toggleLeftPanel(_: Event) {