fix: fixed title parsing for special characters
This commit is contained in:
parent
602e92f986
commit
93837aaf20
2 changed files with 70 additions and 38 deletions
|
|
@ -44,6 +44,8 @@ const getPlantBased = (filePath) => {
|
|||
const slugify = (text) => {
|
||||
return text
|
||||
.toLowerCase()
|
||||
.normalize('NFD') // Decompose accented characters
|
||||
.replace(/[\u0300-\u036f]/g, '') // Remove combining diacritical marks
|
||||
.replace(/\s+/g, '-') // Replace spaces with hyphens
|
||||
.replace(/[()]/g, '') // Remove parentheses
|
||||
.replace(/[^\w-]+/g, '') // Remove non-word chars except hyphens
|
||||
|
|
@ -224,7 +226,7 @@ module.exports = {
|
|||
return getSlugFromPath(data.page.inputPath);
|
||||
},
|
||||
title: (data) => {
|
||||
if (data.title && data.title !== data.page.fileSlug) {
|
||||
if (data.title) {
|
||||
return data.title;
|
||||
}
|
||||
const slug = getSlugFromPath(data.page.inputPath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue