Update lib/mdx/getFiles to only return files with mdx extension.
This commit is contained in:
@ -26,8 +26,12 @@ const root = process.cwd()
|
|||||||
export function getFiles(type) {
|
export function getFiles(type) {
|
||||||
const prefixPaths = path.join(root, 'data', type)
|
const prefixPaths = path.join(root, 'data', type)
|
||||||
const files = getAllFilesRecursively(prefixPaths)
|
const files = getAllFilesRecursively(prefixPaths)
|
||||||
|
|
||||||
|
// Filter to include only files with .mdx extension
|
||||||
|
const mdxFiles = files.filter(file => file.endsWith('.mdx'));
|
||||||
|
|
||||||
// Only want to return workshop/path and ignore root, replace is needed to work on Windows
|
// Only want to return workshop/path and ignore root, replace is needed to work on Windows
|
||||||
return files.map((file) => file.slice(prefixPaths.length + 1).replace(/\\/g, '/'));
|
return mdxFiles.map((file) => file.slice(prefixPaths.length + 1).replace(/\\/g, '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatSlug(slug) {
|
export function formatSlug(slug) {
|
||||||
|
|||||||
Reference in New Issue
Block a user