mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor: replace postSlug with Astro content slug
* refactor: replace postSlug with Astro content slug Remove postSlug from blog schema. Refactor articles that use postSlug. Remove slugify function from slugify util file. Replace slugify logic with Astro's content collections slug logic. Closes: #186 * docs: update docs for removed slugify contents * refactor: remove unused import
This commit is contained in:
@@ -8,7 +8,6 @@ import Hr from "@components/Hr.astro";
|
||||
import Card from "@components/Card";
|
||||
import Socials from "@components/Socials.astro";
|
||||
import getSortedPosts from "@utils/getSortedPosts";
|
||||
import slugify from "@utils/slugify";
|
||||
import { SOCIALS } from "@config";
|
||||
|
||||
const posts = await getCollection("blog");
|
||||
@@ -49,7 +48,7 @@ const socialCount = SOCIALS.filter(social => social.active).length;
|
||||
<p>
|
||||
Read the blog posts or check
|
||||
<LinkButton
|
||||
className="hover:text-skin-accent underline underline-offset-4 decoration-dashed"
|
||||
className="underline decoration-dashed underline-offset-4 hover:text-skin-accent"
|
||||
href="https://github.com/satnaing/astro-paper#readme"
|
||||
>
|
||||
README
|
||||
@@ -74,9 +73,9 @@ const socialCount = SOCIALS.filter(social => social.active).length;
|
||||
<section id="featured">
|
||||
<h2>Featured</h2>
|
||||
<ul>
|
||||
{featuredPosts.map(({ data }) => (
|
||||
{featuredPosts.map(({ data, slug }) => (
|
||||
<Card
|
||||
href={`/posts/${slugify(data)}`}
|
||||
href={`/posts/${slug}`}
|
||||
frontmatter={data}
|
||||
secHeading={false}
|
||||
/>
|
||||
@@ -95,10 +94,10 @@ const socialCount = SOCIALS.filter(social => social.active).length;
|
||||
sortedPosts
|
||||
.filter(({ data }) => !data.featured)
|
||||
.map(
|
||||
({ data }, index) =>
|
||||
({ data, slug }, index) =>
|
||||
index < 4 && (
|
||||
<Card
|
||||
href={`/posts/${slugify(data)}`}
|
||||
href={`/posts/${slug}`}
|
||||
frontmatter={data}
|
||||
secHeading={false}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user