6
1
Fork 0

Conditionally hide and show post. #1

Merged
alberto merged 1 commits from dev into main 11 months ago

@ -1,4 +1,5 @@
---
import config from '@/config'
import Link from '@/components/Link.astro'
import 'katex/dist/katex.min.css'
@ -12,6 +13,10 @@ import '@/themes/modern.css'
// import '@/themes/colorful.css'
// import '@/themes/mono.css'
// import '@/themes/sober.css'
const posts = import.meta.glob<MarkdownInstance<PostFrontmatter>>('../pages/posts/*.md', { eager: true })
---
<!doctype html>
@ -79,7 +84,10 @@ import '@/themes/modern.css'
<nav>
<div class="nav-item"><Link href="/">Home</Link></div>
<div class="nav-item"><Link href="/appunti">Appunti</Link></div>
{ (Object.values(posts) != undefined &&
Object.values(posts).length != 0) ? (
<div class="nav-item"><Link href="/posts">Post</Link></div>
) : ( <></> ) }
</nav>
</header>

@ -17,7 +17,10 @@ const posts = import.meta.glob<MarkdownInstance<PostFrontmatter>>('./posts/*.md'
articoli su vari argomenti, appunti di studio e molto altro.
</p>
</div>
<div>
{ (Object.values(posts) != undefined && Object.values(posts).length != 0) ? (
<h2>Post Recenti</h2>
</div>
<div class="card-list">
{
Object.values(posts)
@ -39,5 +42,8 @@ const posts = import.meta.glob<MarkdownInstance<PostFrontmatter>>('./posts/*.md'
))
}
</div>
) : (<></>)
}
</main>
</Base>

Loading…
Cancel
Save