From a9b350d9889926c756dcadb80fb59b7910524749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouven=20B=C3=BChlmann?= Date: Tue, 28 Jan 2020 06:45:53 +0100 Subject: [PATCH] Docs(nuxt): Do not slice the first two chars of the file name (#3152) --- website/content/docs/nuxt.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/content/docs/nuxt.md b/website/content/docs/nuxt.md index c2431ddc..43783fa7 100644 --- a/website/content/docs/nuxt.md +++ b/website/content/docs/nuxt.md @@ -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}`), }; });