upstream #1
| @@ -14,7 +14,7 @@ export async function generateMetadata({ | ||||
|   params: { slug: string[] } | ||||
| }): Promise<Metadata | undefined> { | ||||
|   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 authorDetails = authorList.map((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[] } }) { | ||||
|   const slug = params.slug.join('/') | ||||
|   console.log('begin generate for slug: %o', slug) | ||||
|   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 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 authorDetails = authorList.map((author) => { | ||||
|     const authorResults = allAuthors.find((p) => p.slug === author) | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| import 'css/tailwind.css' | ||||
| import 'css/prism.css' | ||||
| import 'pliny/search/algolia.css' | ||||
| import 'katex/dist/katex.css' | ||||
|  | ||||
| import { Inter } from 'next/font/google' | ||||
| import { Analytics, AnalyticsConfig } from 'pliny/analytics' | ||||
|   | ||||
| @@ -81,7 +81,7 @@ export const Blog = defineDocumentType(() => ({ | ||||
|   fields: { | ||||
|     title: { type: 'string', required: true }, | ||||
|     date: { type: 'date', required: true }, | ||||
|     tags: { type: 'list', of: { type: 'string' } }, | ||||
|     tags: { type: 'list', of: { type: 'string' }, default: [] }, | ||||
|     lastmod: { type: 'date' }, | ||||
|     draft: { type: 'boolean' }, | ||||
|     summary: { type: 'string' }, | ||||
| @@ -145,7 +145,7 @@ export default makeSource({ | ||||
|       rehypeAutolinkHeadings, | ||||
|       rehypeKatex, | ||||
|       [rehypeCitation, { path: path.join(root, 'data') }], | ||||
|       [rehypePrismPlus, { defaultLanguage: 'js' }], | ||||
|       [rehypePrismPlus, { defaultLanguage: 'js', ignoreMissing: true }], | ||||
|       rehypePresetMinify, | ||||
|     ], | ||||
|   }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ import Tag from '@/components/Tag' | ||||
| import siteMetadata from '@/data/siteMetadata' | ||||
| import ScrollTopAndComment from '@/components/ScrollTopAndComment' | ||||
|  | ||||
| const editUrl = (path) => `${siteMetadata.siteRepo}/blob/master/data/${path}` | ||||
| const editUrl = (path) => `${siteMetadata.siteRepo}/blob/main/data/${path}` | ||||
| const discussUrl = (path) => | ||||
|   `https://mobile.twitter.com/search?q=${encodeURIComponent(`${siteMetadata.siteUrl}/${path}`)}` | ||||
|  | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
|     "@next/bundle-analyzer": "13.4.12", | ||||
|     "@tailwindcss/forms": "^0.5.4", | ||||
|     "@tailwindcss/typography": "^0.5.9", | ||||
|     "@types/mdx": "^2.0.5", | ||||
|     "autoprefixer": "^10.4.13", | ||||
|     "contentlayer": "0.3.4", | ||||
|     "esbuild": "0.18.11", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user