Skip to content

Commit abf950a

Browse files
author
Chris D. Macrae
committed
Try and fix pre-render logic
1 parent eab7666 commit abf950a

File tree

2 files changed

+5
-47
lines changed

2 files changed

+5
-47
lines changed

packages/cdm-content/posts/posts.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,17 @@ const postsDirectory = join(process.cwd(), 'packages/cdm-content/posts')
1717
export function getPostPaths() {
1818
return fs.readdirSync(postsDirectory)
1919
.filter(f => f.endsWith('md'))
20-
.map(slug => slug.replace(/\.md$/, ''))
20+
.map(path => path.replace(/\.md$/, ''))
2121
}
2222

23-
export async function getPostSlugs() {
24-
const paths = getPostPaths();
25-
const posts = await Promise.all(paths.map(p => getPostBySlug(p)));
26-
const slugs = posts
27-
.filter(p => p !== null)
28-
.map(p => p.slug);
23+
export function getPostSlugs() {
24+
const slugs = getPostPaths()
25+
.map(p => `/articles/${p}`);
2926

3027
return slugs;
3128
}
3229

33-
export async function getPostBySlug(slug, fields = []): Promise<PostModel> {
30+
export async function getPostBySlug(slug: string, fields = []): Promise<PostModel> {
3431
const realPath = slug.replace('/articles/', '')
3532
const fullPath = join(postsDirectory, `${realPath}.md`)
3633
const fileContents = fs.readFileSync(fullPath, 'utf8')

src/pages/articles/[slug].tsx

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)