Add posts and old grade-calc

Fix small bugs
>bad commit
This commit is contained in:
2022-02-14 15:32:58 -05:00
parent 391fff28b1
commit bfacb23f8a
21 changed files with 1047 additions and 267 deletions

14
util/post-cache.ts Normal file
View File

@@ -0,0 +1,14 @@
import fs from 'fs';
import { getAllPosts } from '../lib/slug';
import { join } from 'path';
const publicDir = join(process.cwd(), 'public');
export default function cachePostLinkData() {
const posts = getAllPosts(['title', 'slug', 'last_updated']);
fs.writeFile(`${publicDir}/posts.json`, JSON.stringify(posts), (e) => {
if (e)
console.error(e);
});
return posts;
}