:3
This commit is contained in:
parent
ba72f0bf22
commit
5a911771d0
8 changed files with 114 additions and 100 deletions
|
@ -73,18 +73,23 @@ export function getPagesInfo(searchDirectory: string, pageLocation: PageLocation
|
|||
console.log(files);
|
||||
|
||||
files.forEach((file) => {
|
||||
const fullPath = path.join(currentDirectory, file);
|
||||
const localPath = fullPath.replace(pageLocation.root, pageLocation.map);
|
||||
var fullPath = path.join(currentDirectory, file);
|
||||
var localPath = fullPath.replace(pageLocation.root, pageLocation.map);
|
||||
console.log(fullPath);
|
||||
console.log(localPath);
|
||||
if (fs.lstatSync(fullPath).isDirectory()) {
|
||||
Object.assign(pageInfo, getPagesInfo(path.join(searchDirectory, file), pageLocation));
|
||||
} else if (file.endsWith('.md')) {
|
||||
|
||||
const metadata = getMetadata(fullPath);
|
||||
const sha256Hash = getSha256Hash(fullPath);
|
||||
const charCount = getCharCount(fullPath);
|
||||
const wordCount = getWordCount(fullPath);
|
||||
|
||||
// Remove the .md extension
|
||||
localPath = localPath.replace('.md', '');
|
||||
fullPath = fullPath.replace('.md', '');
|
||||
|
||||
pageInfo[fullPath] = {
|
||||
local_path: localPath,
|
||||
absolute_path: fullPath,
|
||||
|
|
|
@ -52,13 +52,6 @@ function generatePageCategory(pagesInfo: Record<string, any>): PageCategory {
|
|||
}
|
||||
|
||||
const postDirectories: pages.PageLocation[] = [
|
||||
{
|
||||
title: "Blog",
|
||||
description: "General blog posts",
|
||||
tags: ["blog"],
|
||||
map: "blog",
|
||||
root: "content/blog"
|
||||
},
|
||||
{
|
||||
title: "Site",
|
||||
description: "Articles to test site functionality",
|
||||
|
@ -72,6 +65,13 @@ const postDirectories: pages.PageLocation[] = [
|
|||
tags: ["collection"],
|
||||
map: "collections",
|
||||
root: "content/collections"
|
||||
},
|
||||
{
|
||||
title: "Guides",
|
||||
description: "Guides and tutorials",
|
||||
tags: ["guide"],
|
||||
map: "guides",
|
||||
root: "content/guides"
|
||||
}
|
||||
]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue