From 4bb7737126212560be9ff43896fb687ef6509002 Mon Sep 17 00:00:00 2001 From: lorinjameson Date: Fri, 15 Nov 2024 13:33:04 -0500 Subject: [PATCH 1/3] WIP --- src/components/TableOfContents.astro | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro index 6571c1c..38ba361 100644 --- a/src/components/TableOfContents.astro +++ b/src/components/TableOfContents.astro @@ -18,12 +18,21 @@ const homePage = pages.find((p) => p.data.autogenerate.type === 'home'); if (!homePage) { throw new Error('No homepage found?!?'); } + +const path = Astro.url.pathname; + +console.log(path); +console.log(baseUrl); ---
- - {homePage.data.title} - + { + ![`/${baseUrl}/`, '/'].includes(path) && ( + + {homePage.data.title} + + ) + } { pages .filter((page) => page.id !== homePage.id) From bd7929780c414235b2c88fbb21fd3c0a76aa0d42 Mon Sep 17 00:00:00 2001 From: lorinjameson Date: Fri, 15 Nov 2024 13:42:54 -0500 Subject: [PATCH 2/3] WIP --- src/components/TableOfContents.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro index 38ba361..ba961e7 100644 --- a/src/components/TableOfContents.astro +++ b/src/components/TableOfContents.astro @@ -21,8 +21,8 @@ if (!homePage) { const path = Astro.url.pathname; -console.log(path); -console.log(baseUrl); +console.log('Path: ', path); +console.log('BaseUrl: ', baseUrl); ---
From 6783cbf721d5c2cb96ad7a090e149024c787bea7 Mon Sep 17 00:00:00 2001 From: lorinjameson Date: Fri, 15 Nov 2024 13:55:25 -0500 Subject: [PATCH 3/3] Don't show home in ToC on home page --- src/components/TableOfContents.astro | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro index ba961e7..56317de 100644 --- a/src/components/TableOfContents.astro +++ b/src/components/TableOfContents.astro @@ -18,16 +18,11 @@ const homePage = pages.find((p) => p.data.autogenerate.type === 'home'); if (!homePage) { throw new Error('No homepage found?!?'); } - -const path = Astro.url.pathname; - -console.log('Path: ', path); -console.log('BaseUrl: ', baseUrl); ---
{ - ![`/${baseUrl}/`, '/'].includes(path) && ( + ![`/${baseUrl}/`, '/'].includes(Astro.url.pathname) && ( {homePage.data.title}