upstream #1
@ -13,8 +13,8 @@ export async function generateMetadata({
|
|||||||
}: {
|
}: {
|
||||||
params: { slug: string[] }
|
params: { slug: string[] }
|
||||||
}): Promise<Metadata | undefined> {
|
}): Promise<Metadata | undefined> {
|
||||||
const slug = params.slug.join('/')
|
const slug = decodeURI(params.slug.join('/'))
|
||||||
const post = allBlogs.find((p) => encodeURIComponent(p.slug) === slug)
|
const post = allBlogs.find((p) => p.slug === slug)
|
||||||
const authorList = post?.authors || ['default']
|
const authorList = post?.authors || ['default']
|
||||||
const authorDetails = authorList.map((author) => {
|
const authorDetails = authorList.map((author) => {
|
||||||
const authorResults = allAuthors.find((p) => p.slug === author)
|
const authorResults = allAuthors.find((p) => p.slug === author)
|
||||||
@ -68,16 +68,12 @@ export const generateStaticParams = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { slug: string[] } }) {
|
export default async function Page({ params }: { params: { slug: string[] } }) {
|
||||||
const slug = params.slug.join('/')
|
const slug = decodeURI(params.slug.join('/'))
|
||||||
const sortedPosts = sortedBlogPost(allBlogs) as Blog[]
|
const sortedPosts = sortedBlogPost(allBlogs) as Blog[]
|
||||||
const postIndex = sortedPosts.findIndex(
|
const postIndex = sortedPosts.findIndex((p) => p.slug === slug)
|
||||||
(p) => encodeURIComponent(p.slug) === encodeURIComponent(slug)
|
|
||||||
)
|
|
||||||
const prev = coreContent(sortedPosts[postIndex + 1])
|
const prev = coreContent(sortedPosts[postIndex + 1])
|
||||||
const next = coreContent(sortedPosts[postIndex - 1])
|
const next = coreContent(sortedPosts[postIndex - 1])
|
||||||
const post = sortedPosts.find(
|
const post = sortedPosts.find((p) => p.slug === slug) as Blog
|
||||||
(p) => encodeURIComponent(p.slug) === encodeURIComponent(slug)
|
|
||||||
) as Blog
|
|
||||||
const authorList = post?.authors || ['default']
|
const authorList = post?.authors || ['default']
|
||||||
const authorDetails = authorList.map((author) => {
|
const authorDetails = authorList.map((author) => {
|
||||||
const authorResults = allAuthors.find((p) => p.slug === author)
|
const authorResults = allAuthors.find((p) => p.slug === author)
|
||||||
|
@ -1 +1 @@
|
|||||||
{"markdown":1,"code":1,"features":1,"next-js":5,"math":1,"ols":1,"github":1,"guide":4,"tailwind":2,"holiday":1,"canada":1,"images":1,"writings":1,"book":1,"reflection":1,"multi-author":1,"feature":1}
|
{"markdown":3,"code":3,"features":3,"next-js":5,"math":1,"ols":1,"github":1,"guide":4,"tailwind":2,"holiday":1,"canada":1,"images":1,"writings":1,"book":1,"reflection":1,"multi-author":1,"feature":1}
|
Loading…
x
Reference in New Issue
Block a user