feat: hide nav item if no content in relevant collection
All checks were successful
Docker / build-and-push-image (push) Successful in 3m1s
All checks were successful
Docker / build-and-push-image (push) Successful in 3m1s
This commit is contained in:
parent
d1990ffb0e
commit
e8160ad4fe
6 changed files with 29 additions and 21 deletions
|
@ -2,9 +2,30 @@
|
|||
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;
|
||||
});
|
||||
---
|
||||
|
||||
<header class="mx-auto w-full">
|
||||
|
@ -17,9 +38,10 @@ const currentPath = pathname.replace(/\/$/, "");
|
|||
</a>
|
||||
<ul class="flex w-fit flex-row items-center gap-4">
|
||||
{
|
||||
SITE.NAVLINKS.map((link) => {
|
||||
filteredNavLinks.map((link) => {
|
||||
let linkHref = link.href.replace(/\/$/, "");
|
||||
const isActive = currentPath.startsWith(linkHref);
|
||||
|
||||
return (
|
||||
<li class="text-tertiary hover:text-secondary focus:text-secondary font-medium transition-colors duration-300 focus:outline-hidden">
|
||||
<a
|
||||
|
|
|
@ -8,6 +8,7 @@ image:
|
|||
alt: "Flashing the chips"
|
||||
categories: ["personal"]
|
||||
tags: ["linux", "libreboot", "raspberry pi", "thinkpad", "x230"]
|
||||
draft: true
|
||||
---
|
||||
|
||||
This post is a simple guide on how I "Librebooted" my Lenovo Thinkpad X230. I struggled to find instructions which detailed the entire process for a beginner who has never used tools such as flashrom before. The examples I have given here are based on what I did personally. Whilst these are the exact steps I took, for you there may be other or completely different steps so please reference the [documentation](https://libreboot.org/docs/install/x230_external.html) before carrying out any steps listed here.
|
||||
|
|
|
@ -29,6 +29,9 @@ _**Night** This was the original vision for the piece before pivoting towards th
|
|||

|
||||
_**Reference board** A small collection of related in-game imagery used as inspiration for both explored lighting approaches._
|
||||
|
||||

|
||||
_**Viewport** View of the scene within Blender with heavily instanced assets being hidden such as the floor mulch or trees._
|
||||
|
||||
### Early progress and tests
|
||||
|
||||
<Gallery
|
||||
|
|
BIN
src/content/projects/the-heart/viewport.jpg
Normal file
BIN
src/content/projects/the-heart/viewport.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 378 KiB |
|
@ -16,17 +16,6 @@ const posts = (await getCollection("posts"))
|
|||
<ol
|
||||
class="animate-reveal grid grid-cols-1 gap-6 opacity-0 [animation-delay:0.1s]"
|
||||
>
|
||||
{
|
||||
//import type { CollectionEntry } from "astro:content";
|
||||
//posts.map((article: CollectionEntry<"posts">) => (
|
||||
posts.map((article: any) => <ShowcasePost collection={article} />)
|
||||
}
|
||||
{posts.map((article) => <ShowcasePost collection={article} />)}
|
||||
</ol>
|
||||
<div class="animate-reveal flex justify-end opacity-0 [animation-delay:0.2s]">
|
||||
<a
|
||||
href="/posts.xml"
|
||||
class="text-tertiary hover:text-secondary text-xs transition-colors duration-300"
|
||||
>View posts feed</a
|
||||
>
|
||||
</div>
|
||||
</Layout>
|
||||
|
|
|
@ -21,13 +21,6 @@ const projects = (await getCollection("projects"))
|
|||
<ol
|
||||
class="animate-reveal grid grid-cols-1 gap-4 opacity-0 [animation-delay:0.1s] md:grid-cols-2"
|
||||
>
|
||||
{projects.map((article: any) => <ShowcaseProject collection={article} />)}
|
||||
{projects.map((article) => <ShowcaseProject collection={article} />)}
|
||||
</ol>
|
||||
<div class="animate-reveal flex justify-end opacity-0 [animation-delay:0.2s]">
|
||||
<a
|
||||
href="/projects.xml"
|
||||
class="text-tertiary hover:text-secondary text-xs transition-colors duration-300"
|
||||
>View projects feed</a
|
||||
>
|
||||
</div>
|
||||
</Layout>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue