mirror of
https://github.com/YouHaveTrouble/youhavetrouble.github.io.git
synced 2026-05-11 22:06:56 +00:00
15 lines
293 B
TypeScript
15 lines
293 B
TypeScript
import readingTime from 'reading-time'
|
|
|
|
type Post = {
|
|
title: string
|
|
file: string
|
|
rawContent: () => string
|
|
}
|
|
|
|
export default function getPostData(post: Post) {
|
|
return {
|
|
slug: post.file.split('/').pop().split('.').shift(),
|
|
readingTime: readingTime(post.rawContent()).text,
|
|
}
|
|
}
|