Docs(nuxt): Do not slice the first two chars of the file name (#3152)
This commit is contained in:
parent
a3646edf52
commit
a9b350d988
@ -247,9 +247,10 @@ export default {
|
||||
generate: {
|
||||
routes: function() {
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
return fs.readdirSync('./assets/content/blog').map(file => {
|
||||
return {
|
||||
route: `/blog/${file.slice(2, -5)}`, // Remove the .json from the end of the filename
|
||||
route: `/blog/${path.parse(file).name}`, // Return the slug
|
||||
payload: require(`./assets/content/blog/${file}`),
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user