diff --git a/source/generate.ts b/source/generate.ts index 0a80068..87792b8 100644 --- a/source/generate.ts +++ b/source/generate.ts @@ -107,6 +107,11 @@ function recursiveParser(fileOrFolderPath: string) { result.posts[urlPath] = parsedMarkdown.data + // preview + // might cut mid html tag + result.posts[urlPath].preview = + parsedMarkdown.content.split(" ").slice(0, 20).join(" ") + " ..." + // date if (!result.posts[urlPath].date) { throw Error(`Date does not exist in file: ${urlPath}`) diff --git a/source/src/pages/PostList.tsx b/source/src/pages/PostList.tsx index 01c0dfe..8e041d6 100644 --- a/source/src/pages/PostList.tsx +++ b/source/src/pages/PostList.tsx @@ -87,7 +87,6 @@ export default class PostList extends React.Component< for (const postPath in posts.posts) { if (this.state.isLimited && howMany <= 0) continue - const data = await import(`../data/posts${postPath}.json`) const post = posts.posts[postPath] @@ -105,10 +104,7 @@ export default class PostList extends React.Component<