-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
200 additions
and
52 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
import { Icon } from "astro-icon/components"; | ||
import type { CollectionEntry } from "astro:content"; | ||
import { getCollection } from "astro:content"; | ||
import { getSortedArticles } from "@/lib/utils"; | ||
export interface Props { | ||
article: CollectionEntry<"blog">; | ||
} | ||
const { article } = Astro.props; | ||
// Get all articles and find current article index | ||
const articles = await getCollection("blog"); | ||
const sortedArticles = getSortedArticles(articles); | ||
const currentIndex = sortedArticles.findIndex(a => a.id === article.id); | ||
// Get next and previous articles | ||
const previousArticle = | ||
currentIndex < sortedArticles.length - 1 | ||
? sortedArticles[currentIndex + 1] | ||
: null; | ||
const nextArticle = currentIndex > 0 ? sortedArticles[currentIndex - 1] : null; | ||
--- | ||
|
||
<nav class="mx-auto mt-2 max-w-3xl" aria-label="Article navigation"> | ||
<div class="flex justify-between"> | ||
{ | ||
previousArticle && ( | ||
<a | ||
href={`/blog/${previousArticle.data.slug}`} | ||
class="group flex max-w-[45%] flex-col items-start gap-2 hover:text-neutral-dark-50" | ||
> | ||
<div class="flex items-center gap-2 text-sm text-neutral-dark-50"> | ||
<Icon name="arrow-left" class="h-4 w-4" /> | ||
<span>Previous Article</span> | ||
</div> | ||
<span class="line-clamp-2 text-base font-medium"> | ||
{previousArticle.data.title} | ||
</span> | ||
</a> | ||
) | ||
} | ||
|
||
{ | ||
nextArticle && ( | ||
<a | ||
href={`/blog/${nextArticle.data.slug}`} | ||
class="group ml-auto flex max-w-[45%] flex-col items-end gap-2 text-right hover:text-neutral-dark-50" | ||
> | ||
<div class="flex items-center gap-2 text-sm text-neutral-dark-50"> | ||
<span>Next Article</span> | ||
<Icon name="arrow-right" class="h-4 w-4" /> | ||
</div> | ||
<span class="line-clamp-2 text-base font-medium"> | ||
{nextArticle.data.title} | ||
</span> | ||
</a> | ||
) | ||
} | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
import type { ImageMetadata } from "astro"; | ||
import { Image } from "astro:assets"; | ||
interface Props { | ||
slug: string; | ||
title: string; | ||
ogImage?: ImageMetadata; | ||
} | ||
const { slug, title, ogImage } = Astro.props; | ||
--- | ||
|
||
{ | ||
ogImage && ( | ||
<Image src={ogImage} alt={title} class="h-full w-full object-cover" /> | ||
) | ||
} | ||
{ | ||
!ogImage && ( | ||
<img | ||
class="h-full w-full bg-neutral-300" | ||
src={`/blog/${slug}.png`} | ||
alt={title} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,11 @@ const socialImageURL = new URL( | |
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:[email protected]&display=swap" | ||
rel="stylesheet" | ||
/> | ||
|
||
<link | ||
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
|
||
<body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.