Skip to content

Commit

Permalink
Use timestamp if slugifying the title results in the empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
danburzo committed May 27, 2024
1 parent 7fc2290 commit 387a94f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util/output-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const DEFAULT_TITLE = 'Untitled page';
const OPTS = { strict: true };

function slugifyTitle(title, cache = {}) {
const res = slugify(title || DEFAULT_TITLE, OPTS);
const res =
slugify(title || DEFAULT_TITLE, OPTS) || `percollate-${Date.now()}`;
if (cache[res] !== undefined) {
cache[res] += 1;
return `${res}-${cache[res]}`;
Expand Down

0 comments on commit 387a94f

Please sign in to comment.