Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,4 @@ export default defineConfig({
},
},
scopedStyleStrategy: "where",
experimental: {
contentLayer: true,
},
});
5,860 changes: 2,828 additions & 3,032 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"lint": "eslint ."
},
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/rss": "^4.0.7",
"@astrojs/check": "^0.9.4",
"@astrojs/rss": "^4.0.11",
"@resvg/resvg-js": "^2.6.2",
"astro": "^4.16.18",
"astro": "^5.2.2",
"fuse.js": "^7.0.0",
"lodash.kebabcase": "^4.1.1",
"remark-collapse": "^0.1.2",
Expand All @@ -27,9 +27,9 @@
"typescript": "^5.5.3"
},
"devDependencies": {
"@astrojs/react": "^3.6.2",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/tailwind": "^5.1.0",
"@astrojs/react": "^4.2.0",
"@astrojs/sitemap": "^3.2.1",
"@astrojs/tailwind": "^6.0.0",
"@tailwindcss/typography": "^0.5.15",
"@types/github-slugger": "^1.3.0",
"@types/lodash.kebabcase": "^4.1.9",
Expand Down
5 changes: 2 additions & 3 deletions src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export type SearchItem = {
title: string;
description: string;
data: CollectionEntry<"blog">["data"];
slug: string;
};

interface Props {
Expand Down Expand Up @@ -116,9 +115,9 @@ export default function SearchBar({ searchList }: Props) {
{searchResults &&
searchResults.map(({ item, refIndex }) => (
<Card
href={`/posts/${item.slug}/`}
href={`/posts/${item.data.slug}/`}
frontmatter={item.data}
key={`${refIndex}-${item.slug}`}
key={`${refIndex}-${item.data.slug}`}
/>
))}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
author: Sat Naing
pubDatetime: 2022-09-25T15:20:35Z
title: Customizing AstroPaper theme color schemes
slug: customizing-astropaper-theme-color-schemes
featured: false
draft: false
tags:
Expand Down
1 change: 1 addition & 0 deletions src/content/blog/how-to-add-a-new-social-icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ author: Simon Smale
pubDatetime: 2024-01-08T18:16:00.000Z
modDatetime:
title: How to add a new Social Icon to AstroPaper
slug: how-to-add-a-new-social-icon
featured: false
draft: false
tags:
Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/how-to-add-an-estimated-reading-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export async function getStaticPaths() {
const postsWithRT = await getPostsWithRT(posts); // replace reading time logic with this func

const postResult = postsWithRT.map(post => ({ // make sure to replace posts with postsWithRT
params: { slug: post.slug },
params: { slug: post.data.slug },
props: { post },
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
author: Alberto Perdomo
pubDatetime: 2024-09-08T20:58:52.737Z
title: Adding LaTeX Equations in AstroPaper blog posts
slug: adding-latex-equations-in-astropaper-blog-posts
featured: false
tags:
- rendering
Expand Down
1 change: 1 addition & 0 deletions src/content/blog/setting-dates-via-git-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ author: Simon Smale
pubDatetime: 2024-01-03T20:40:08Z
modDatetime: 2024-01-08T18:59:05Z
title: How to use Git Hooks to set Created and Modified Dates
slug: setting-dates-via-git-hooks
featured: false
draft: false
tags:
Expand Down
1 change: 1 addition & 0 deletions src/content/blog/tailwind-typography.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Tailwind Typography Plugin
slug: tailwind-typography
author: Sat Naing
pubDatetime: 2022-07-05T02:05:51Z
featured: false
Expand Down
1 change: 1 addition & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const blog = defineCollection({
pubDatetime: z.date(),
modDatetime: z.date().optional().nullable(),
title: z.string(),
slug: z.string(),
featured: z.boolean().optional(),
draft: z.boolean().optional(),
tags: z.array(z.string()).default(["others"]),
Expand Down
12 changes: 7 additions & 5 deletions src/layouts/PostDetails.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import Tag from "@components/Tag.astro";
import Datetime from "@components/Datetime";
import type { CollectionEntry } from "astro:content";
import { render, type CollectionEntry } from "astro:content";
import { slugifyStr } from "@utils/slugify";
import ShareLinks from "@components/ShareLinks.astro";
import { SITE } from "@config";
Expand All @@ -28,7 +28,7 @@ const {
editPost,
} = post.data;

const { Content } = await post.render();
const { Content } = await render(post);

const ogImageUrl = typeof ogImage === "string" ? ogImage : ogImage?.src;
const ogUrl = new URL(
Expand All @@ -49,12 +49,12 @@ const layoutProps = {

/* ========== Prev/Next Posts ========== */

const allPosts = posts.map(({ data: { title }, slug }) => ({
const allPosts = posts.map(({ data: { title, slug } }) => ({
slug,
title,
}));

const currentPostIndex = allPosts.findIndex(a => a.slug === post.slug);
const currentPostIndex = allPosts.findIndex(a => a.slug === post.data.slug);

const prevPost = currentPostIndex !== 0 ? allPosts[currentPostIndex - 1] : null;
const nextPost =
Expand All @@ -77,7 +77,9 @@ const nextPost =
</button>
</div>
<main id="main-content">
<h1 transition:name={slugifyStr(title)} class="post-title inline-block">{title}</h1>
<h1 transition:name={slugifyStr(title)} class="post-title inline-block">
{title}
</h1>
<Datetime
pubDatetime={pubDatetime}
modDatetime={modDatetime}
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/Posts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const { page } = Astro.props;
<Main pageTitle="Posts" pageDesc="All the articles I've posted.">
<ul>
{
page.data.map(({ data, slug }) => (
<Card href={`/posts/${slug}/`} frontmatter={data} />
page.data.map(({ data }) => (
<Card href={`/posts/${data.slug}/`} frontmatter={data} />
))
}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/TagPosts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const { page, tag, tagName } = Astro.props;
<h1 slot="title" transition:name={tag}>{`Tag:${tag}`}</h1>
<ul>
{
page.data.map(({ data, slug }) => (
<Card href={`/posts/${slug}/`} frontmatter={data} />
page.data.map(({ data }) => (
<Card href={`/posts/${data.slug}/`} frontmatter={data} />
))
}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/archives/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const MonthMap: Record<string, string> = {
new Date(a.data.pubDatetime).getTime() / 1000
)
)
.map(({ data, slug }) => (
<Card href={`/posts/${slug}`} frontmatter={data} />
.map(({ data }) => (
<Card href={`/posts/${data.slug}`} frontmatter={data} />
))}
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ const socialCount = SOCIALS.filter(social => social.active).length;
<section id="featured">
<h2>Featured</h2>
<ul>
{featuredPosts.map(({ data, slug }) => (
{featuredPosts.map(({ data }) => (
<Card
href={`/posts/${slug}/`}
href={`/posts/${data.slug}/`}
frontmatter={data}
secHeading={false}
/>
Expand All @@ -95,10 +95,10 @@ const socialCount = SOCIALS.filter(social => social.active).length;
<h2>Recent Posts</h2>
<ul>
{recentPosts.map(
({ data, slug }, index) =>
({ data }, index) =>
index < SITE.postPerIndex && (
<Card
href={`/posts/${slug}/`}
href={`/posts/${data.slug}/`}
frontmatter={data}
secHeading={false}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/posts/[slug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function getStaticPaths() {
const posts = await getCollection("blog", ({ data }) => !data.draft);

const postResult = posts.map(post => ({
params: { slug: post.slug },
params: { slug: post.data.slug },
props: { post },
}));

Expand Down