mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 19:41:02 +08:00
Update slugify function with new function slugifyStr
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import slugify from "./slugify";
|
import { slugifyStr } from "./slugify";
|
||||||
import type { MarkdownInstance } from "astro";
|
import type { MarkdownInstance } from "astro";
|
||||||
import type { Frontmatter } from "../types";
|
import type { Frontmatter } from "../types";
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ const getUniqueTags = (posts: MarkdownInstance<Frontmatter>[]) => {
|
|||||||
const filteredPosts = posts.filter(({ frontmatter }) => !frontmatter.draft);
|
const filteredPosts = posts.filter(({ frontmatter }) => !frontmatter.draft);
|
||||||
filteredPosts.forEach((post) => {
|
filteredPosts.forEach((post) => {
|
||||||
tags = [...tags, ...post.frontmatter.tags]
|
tags = [...tags, ...post.frontmatter.tags]
|
||||||
.map((tag) => slugify(tag))
|
.map((tag) => slugifyStr(tag))
|
||||||
.filter(
|
.filter(
|
||||||
(value: string, index: number, self: string[]) =>
|
(value: string, index: number, self: string[]) =>
|
||||||
self.indexOf(value) === index
|
self.indexOf(value) === index
|
||||||
|
|||||||
Reference in New Issue
Block a user