Adding initial nuxt version for static page.

This commit is contained in:
Tomasz Półgrabia 2022-01-30 14:51:59 +01:00
parent 0f7094c61a
commit 1671d19134
28 changed files with 2744 additions and 102 deletions

View file

@ -5,13 +5,15 @@ export default {
generate: {
routes: () => {
console.log('Generating routes...');
let listOfFiles = fs.readdirSync(path.join('.', 'data', 'posts'));
let listOfPosts = JSON.parse(
fs.readFileSync(
path.join('.', 'data', 'posts', 'index.json')));
let postRoutes = listOfFiles.filter((file) => {
return file.endsWith('.md');
}).map((file) => {
return '/post/' + file.substr(0, file.length - 3);
});
let postRoutes = listOfPosts
.map(it => it.slug)
.map((slug) => {
return '/post/' + slug;
});
return postRoutes;
}