upstream #1
@ -27,8 +27,8 @@ const tokenClassNames = {
|
|||||||
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)
|
||||||
// Only want to return blog/path and ignore root
|
// Only want to return blog/path and ignore root, replace is needed to work on Windows
|
||||||
return files.map((file) => file.slice(prefixPaths.length + 1))
|
return files.map((file) => file.slice(prefixPaths.length + 1).replace(/\\/g, '/'))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatSlug(slug) {
|
export function formatSlug(slug) {
|
||||||
@ -97,7 +97,8 @@ export async function getAllFilesFrontMatter(folder) {
|
|||||||
const allFrontMatter = []
|
const allFrontMatter = []
|
||||||
|
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
const fileName = file.slice(prefixPaths.length + 1)
|
// Replace is needed to work on Windows
|
||||||
|
const fileName = file.slice(prefixPaths.length + 1).replace(/\\/g, '/')
|
||||||
const source = fs.readFileSync(file, 'utf8')
|
const source = fs.readFileSync(file, 'utf8')
|
||||||
const { data } = matter(source)
|
const { data } = matter(source)
|
||||||
if (data.draft !== true) {
|
if (data.draft !== true) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user