Show slug fallback when writing

This commit is contained in:
Will Boyd
2025-02-15 10:23:18 -05:00
parent e8852a2900
commit c546cd47ca
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -7,6 +7,10 @@ export function camelCase(str) {
return str.replace(/-(.)/g, (match) => match[1].toUpperCase());
}
export function getSlugWithFallback(post) {
return post.slug ? post.slug : 'id-' + post.id;
}
export function buildPostPath(post, overrideConfig) {
const pathConfig = overrideConfig ?? config;
@@ -35,7 +39,7 @@ export function buildPostPath(post, overrideConfig) {
}
// get slug with fallback
let slug = post.slug ? post.slug : 'id-' + post.id;
let slug = getSlugWithFallback(post);
// prepend date to slug as appropriate
if (pathConfig.prefixDate && post.date) {
+1 -1
View File
@@ -55,7 +55,7 @@ async function writeMarkdownFilesPromise(posts) {
const payload = {
item: post,
type: post.type,
name: post.slug,
name: shared.getSlugWithFallback(post),
destinationPath,
delay
};