File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ const tokenClassNames = {
2727export function getFiles ( type ) {
2828 const prefixPaths = path . join ( root , 'data' , type )
2929 const files = getAllFilesRecursively ( prefixPaths )
30- // Only want to return blog/path and ignore root
31- return files . map ( ( file ) => file . slice ( prefixPaths . length + 1 ) )
30+ // Only want to return blog/path and ignore root, replace is needed to work on Windows
31+ return files . map ( ( file ) => file . slice ( prefixPaths . length + 1 ) . replace ( / \\ / g , '/' ) )
3232}
3333
3434export function formatSlug ( slug ) {
@@ -97,7 +97,8 @@ export async function getAllFilesFrontMatter(folder) {
9797 const allFrontMatter = [ ]
9898
9999 files . forEach ( ( file ) => {
100- const fileName = file . slice ( prefixPaths . length + 1 )
100+ // Replace is needed to work on Windows
101+ const fileName = file . slice ( prefixPaths . length + 1 ) . replace ( / \\ / g, '/' )
101102 const source = fs . readFileSync ( file , 'utf8' )
102103 const { data } = matter ( source )
103104 if ( data . draft !== true ) {
You can’t perform that action at this time.
0 commit comments