changed from hexo to custom react stuff #1

Merged
developomp merged 73 commits from dev into master 2021-06-27 14:37:56 +09:00
2 changed files with 6 additions and 5 deletions
Showing only changes of commit 9f27b34e9e - Show all commits

View file

@ -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}`)

View file

@ -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<
<div
className="link-color"
dangerouslySetInnerHTML={{
__html: marked(
data.content.split(" ").slice(0, 20).join(" ") +
"..."
),
__html: marked(post.preview),
}}
></div>
<small>