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
This commit is contained in:
Peaceultime 2024-03-14 17:45:39 +01:00
parent 7b2c74c405
commit 9c222edcdf
2 changed files with 15 additions and 2 deletions

View File

@ -17,6 +17,17 @@ const hasChildren = computed(() => {
return props.link && props.link.children && props.link.children.length > 0 || false; 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)); const collapsed = ref(!useRoute().path.startsWith(props.link._path));
</script> </script>

View File

@ -6,6 +6,7 @@ function toggleLeftPanel(_: Event) {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
const { page } = useContent() const { page } = useContent()
useContentHead(page); useContentHead(page);
@ -28,6 +29,7 @@ onMounted(() => {
<div class="publish-renderer"> <div class="publish-renderer">
<div class="markdown-preview-view markdown-rendered node-insert-event hide-title"> <div class="markdown-preview-view markdown-rendered node-insert-event hide-title">
<div class="markdown-preview-sizer markdown-preview-section" style="padding-bottom: 0px;"> <div class="markdown-preview-sizer markdown-preview-section" style="padding-bottom: 0px;">
<h1 v-if="!(page as MarkdownParsedContent).body.children.find((e: MarkdownNode) => e.tag === 'h1')">{{(page as MarkdownParsedContent).title}}</h1>
<ContentRenderer :key="page._id" :value="page" /> <ContentRenderer :key="page._id" :value="page" />
</div> </div>
</div> </div>
@ -48,8 +50,8 @@ onMounted(() => {
<div v-else-if="!!page"> <div v-else-if="!!page">
<div class="not-found-container"> <div class="not-found-container">
<div class="not-found-image"></div> <div class="not-found-image"></div>
<div class="not-found-title">Impossible d'afficher</div> <div class="not-found-title">Impossible d'afficher (ou vide)</div>
<div class="not-found-description">Cette page est actuellement vide et impossible à traiter</div> <div class="not-found-description">Cette page est actuellement vide ou impossible à traiter</div>
</div> </div>
</div> </div>
<div v-else class="not-found-container"> <div v-else class="not-found-container">