upstream #1

Merged
jblu merged 1007 commits from upstream into main 2024-11-04 22:35:57 -06:00
Showing only changes of commit 44ffc642cf - Show all commits

View File

@ -14,7 +14,7 @@ export async function generateMetadata({
params: { slug: string[] } params: { slug: string[] }
}): Promise<Metadata | undefined> { }): Promise<Metadata | undefined> {
const slug = params.slug.join('/') const slug = params.slug.join('/')
const post = allBlogs.find((p) => p.slug === slug) const post = allBlogs.find((p) => encodeURIComponent(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)
@ -69,11 +69,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 = params.slug.join('/')
console.log('begin generate for slug: %o', slug)
const sortedPosts = sortedBlogPost(allBlogs) as Blog[] const sortedPosts = sortedBlogPost(allBlogs) as Blog[]
const postIndex = sortedPosts.findIndex((p) => p.slug === slug) const postIndex = sortedPosts.findIndex((p) => encodeURIComponent(p.slug) === 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((p) => p.slug === slug) as Blog const post = sortedPosts.find((p) => encodeURIComponent(p.slug) === 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)