mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
Replace internal slug codes with slugify function
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
---
|
||||
import slugify from "src/utils/slugify";
|
||||
|
||||
export interface Props {
|
||||
name: string;
|
||||
size?: "sm" | "lg";
|
||||
@@ -6,11 +8,7 @@ export interface Props {
|
||||
|
||||
const { name, size = "sm" } = Astro.props;
|
||||
|
||||
const slug = ((str: string) =>
|
||||
str
|
||||
.toLowerCase()
|
||||
.replace(/ /g, "-")
|
||||
.replace(/[^\w-]+/g, ""))(name);
|
||||
const slug = slugify(name);
|
||||
---
|
||||
|
||||
<li class="inline-block my-1">
|
||||
|
||||
Reference in New Issue
Block a user