--- import { SITE } from "@consts"; import Button from "@components/Button.astro"; import { Icon } from "astro-icon/components"; import { getCollection } from "astro:content"; const pathname = new URL(Astro.request.url).pathname; const currentPath = pathname.replace(/\/$/, ""); const allPosts = (await getCollection("posts")).filter( (post) => !post.data.draft, ); const hasPosts = allPosts.length > 0; const allProjects = (await getCollection("projects")).filter( (post) => !post.data.draft, ); const hasProjects = allProjects.length > 0; const filteredNavLinks = SITE.NAVLINKS.filter((link) => { if (link.href === "/posts") { return hasPosts; } if (link.href === "/projects") { return hasProjects; } return true; }); ---