Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/util/url-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import slugify from '@sindresorhus/slugify';
export const filters = {
uppercase: (value) => value?.toUpperCase?.(),
lowercase: (value) => value?.toLowerCase?.(),
slugify,
slugify: (value) => slugify(value, { decamelize: false }),
year: (value) => value?.getFullYear?.(),
month: (value) => {
const month = value?.getMonth?.();
Expand Down
4 changes: 2 additions & 2 deletions tests/generators/expected/custom-source.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
},
{
"date": "2020-07-28T00:00:00.000Z",
"title": "Effective upselling techniques",
"title": "Effective UpSelling techniques",
"categories": [
"sales",
"tips"
Expand Down Expand Up @@ -144,4 +144,4 @@
}
]
}
}
}
4 changes: 2 additions & 2 deletions tests/generators/expected/standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
},
{
"date": "2020-07-28T00:00:00.000Z",
"title": "Effective upselling techniques",
"title": "Effective UpSelling techniques",
"categories": [
"sales",
"tips"
Expand Down Expand Up @@ -143,4 +143,4 @@
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
date: 2020-07-28
title: Effective upselling techniques
title: Effective UpSelling techniques
categories:
- sales
- tips
Expand Down
6 changes: 3 additions & 3 deletions tests/util/url-builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const indexFilePath = 'content/pages/index.md';
const data = {
id: 2,
date: new Date('2021-01-09T09:39:05.237Z'),
title: 'My Title!',
title: 'My TiTle!',
description: 'This is a longer than usual field'
};

Expand Down Expand Up @@ -44,8 +44,8 @@ test('Replace index for file placeholders in URL template', (t) => {
});

test('Replace data placeholders in URL template', (t) => {
t.is(buildUrl(filePath, data, '/url/{title}'), '/url/My Title!');
t.is(buildUrl(filePath, data, '/url/{title}{id}'), '/url/My Title!2');
t.is(buildUrl(filePath, data, '/url/{title}'), '/url/My TiTle!');
t.is(buildUrl(filePath, data, '/url/{title}{id}'), '/url/My TiTle!2');
});

test('Replace data placeholders with filters in URL template', (t) => {
Expand Down