Skip to content

Commit

Permalink
Merge branch 'resolution' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobinstein committed Nov 11, 2024
2 parents 35dcd2e + 8fd2156 commit 4fb551f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 28 deletions.
1 change: 1 addition & 0 deletions docs/src/.vuepress/theme/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export default {
},
mounted() {
this.setupKeyboardShortcuts();
this.$router.afterEach(() => {
this.isSidebarOpen = false;
Expand Down
55 changes: 37 additions & 18 deletions docs/src/.vuepress/theme/layouts/NotFound.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
<template>
<Layout>
<Layout :sidebar-items="sidebarItems">
<div class="NotFound">
<img src="/images/Lost-File-v4.gif" />
<p><strong>404s suck!</strong> And we're sorry for this one.</p>
<p>
Good thing the permaweb has
<a href="https://ardrive.io/fragility-of-the-internet/" target="_blank" rel="noreferrer">
no more 404s
</a>
</p>
</div>
</Layout>
</template>

<div class="NotFound">
<img src="/images/Lost-File-v4.gif"/>
<p><strong>404s suck!</strong> And we're sorry for this one.</p>
<p>Good thing the permaweb has <a src="https://ardrive.io/fragility-of-the-internet/" target="_blank" rel="noreferrer">no more 404s</a></p>
</div>



</Layout>
</template>

<script>
import Layout from "./Layout"
export default {
name: "NotFound"
};
</script>
<script>
import Layout from "./Layout";
export default {
name: "NotFound",
components: {
Layout,
},
computed: {
sidebarItems() {
const { themeConfig } = this.$site;
// Use the root ("/") sidebar config as a fallback
return themeConfig.sidebar ? themeConfig.sidebar["/"] || [] : [];
},
},
};
</script>

<style scoped>
.NotFound {
text-align: center;
padding: 2em;
}
</style>
28 changes: 18 additions & 10 deletions docs/src/.vuepress/theme/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,32 +121,40 @@ function resolvePath (relative, base, append) {
* @param { string } localePath
* @returns { SidebarGroup }
*/
export function resolveSidebarItems (page, regularPath, site, localePath) {
const { pages, themeConfig } = site
export function resolveSidebarItems(page, regularPath, site, localePath) {
const { pages, themeConfig } = site;

const localeConfig = localePath && themeConfig.locales
? themeConfig.locales[localePath] || themeConfig
: themeConfig
: themeConfig;

const pageSidebarConfig = page.frontmatter.sidebar || localeConfig.sidebar || themeConfig.sidebar
// Fallback: If page or regularPath is missing, use root ("/") sidebar config directly
if (!page || !regularPath) {
console.warn("[vuepress] No page or regularPath found. Falling back to root sidebar.");
const fallbackSidebarConfig = themeConfig.sidebar["/"] || [];
return fallbackSidebarConfig.map(item => resolveItem(item, pages, '/'));
}

const pageSidebarConfig = page.frontmatter.sidebar || localeConfig.sidebar || themeConfig.sidebar;
if (pageSidebarConfig === 'auto') {
return resolveHeaders(page)
return resolveHeaders(page);
}

const sidebarConfig = localeConfig.sidebar || themeConfig.sidebar
const sidebarConfig = localeConfig.sidebar || themeConfig.sidebar;
if (!sidebarConfig) {
return []
return [];
} else {
const { base, config } = resolveMatchingConfig(regularPath, sidebarConfig)
const { base, config } = resolveMatchingConfig(regularPath, sidebarConfig);
if (config === 'auto') {
return resolveHeaders(page)
return resolveHeaders(page);
}
return config
? config.map(item => resolveItem(item, pages, base))
: []
: [];
}
}


/**
* @param { Page } page
* @returns { SidebarGroup }
Expand Down

0 comments on commit 4fb551f

Please sign in to comment.