feat: upgrade to astro v3

Upgrade to astro v3. Update dependencies. Fix codes and features due to migration.

BREAKING CHANGE: Astro v3

resolve #111
This commit is contained in:
satnaing
2023-09-14 13:44:49 +06:30
committed by Sat Naing
parent 620446370d
commit e486687610
16 changed files with 2651 additions and 9191 deletions
+2 -3
View File
@@ -2,9 +2,8 @@ import { getCollection } from "astro:content";
import generateOgImage from "@utils/generateOgImage";
import type { APIRoute } from "astro";
export const get: APIRoute = async ({ params }) => ({
body: await generateOgImage(params.ogTitle),
});
export const GET: APIRoute = async ({ params }) =>
new Response(await generateOgImage(params.ogTitle));
const postImportResult = await getCollection("blog", ({ data }) => !data.draft);
const posts = Object.values(postImportResult);
+1 -1
View File
@@ -23,7 +23,7 @@ const socialCount = SOCIALS.filter(social => social.active).length;
<Header />
<main id="main-content">
<section id="hero">
<h1>Mingalaba</h1>
<h1 class="mr-2">Mingalaba</h1>
<a
target="_blank"
href="/rss.xml"
+1 -1
View File
@@ -1,5 +1,5 @@
---
import { CollectionEntry, getCollection } from "astro:content";
import { type CollectionEntry, getCollection } from "astro:content";
import Posts from "@layouts/Posts.astro";
import PostDetails from "@layouts/PostDetails.astro";
import getSortedPosts from "@utils/getSortedPosts";
+1 -1
View File
@@ -4,7 +4,7 @@ import getSortedPosts from "@utils/getSortedPosts";
import slugify from "@utils/slugify";
import { SITE } from "@config";
export async function get() {
export async function GET() {
const posts = await getCollection("blog");
const sortedPosts = getSortedPosts(posts);
return rss({
+2 -2
View File
@@ -5,7 +5,7 @@ import Layout from "@layouts/Layout.astro";
import Main from "@layouts/Main.astro";
import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import Search from "@components/Search";
import SearchBar from "@components/Search";
// Retrieve all articles
const posts = await getCollection("blog", ({ data }) => !data.draft);
@@ -21,7 +21,7 @@ const searchList = posts.map(({ data }) => ({
<Layout title={`Search | ${SITE.title}`}>
<Header activeNav="search" />
<Main pageTitle="Search" pageDesc="Search any article ...">
<Search client:load searchList={searchList} />
<SearchBar client:load searchList={searchList} />
</Main>
<Footer />
</Layout>
+1 -1
View File
@@ -1,5 +1,5 @@
---
import { CollectionEntry, getCollection } from "astro:content";
import { type CollectionEntry, getCollection } from "astro:content";
import Layout from "@layouts/Layout.astro";
import Main from "@layouts/Main.astro";
import Header from "@components/Header.astro";