We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0528999 commit e9cf3faCopy full SHA for e9cf3fa
src/Post.js
@@ -345,7 +345,13 @@ export const ReactionBar = ({
345
};
346
347
function slugify(s: string): string {
348
- return lowerCase(s).replace(/[^A-Za-z0-9-]+/g, '-');
+ return lowerCase(s)
349
+ .replace(/\s+/g, '-') // Replace spaces with -
350
+ .replace(/&/g, '-and-') // Replace & with 'and'
351
+ .replace(/[^\w\-]+/g, '') // Remove all non-word characters
352
+ .replace(/\-\-+/g, '-') // Replace multiple - with single -
353
+ .trimStart() // Trim from start of text
354
+ .trimEnd(); // Trim from end of text
355
}
356
357
export function postUrl({
0 commit comments