summaryrefslogtreecommitdiff
path: root/src/core/utils/slug.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/utils/slug.js')
-rw-r--r--src/core/utils/slug.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/utils/slug.js b/src/core/utils/slug.js
index d5eecd3e..e91bcf83 100644
--- a/src/core/utils/slug.js
+++ b/src/core/utils/slug.js
@@ -9,7 +9,7 @@ import toTitleCase from './toTitleCase'
* @param {number} id - The ID to be appended to the slug.
* @returns {string} - The generated slug with the prefix, name, and ID.
*/
-const createSlug = (prefix, name, id) => {
+const createSlug = (prefix, name, id, withHost = false) => {
let slug =
name
?.trim()
@@ -19,7 +19,9 @@ const createSlug = (prefix, name, id) => {
id
let splitSlug = slug.split('-')
let filterSlugFromEmptyChar = splitSlug.filter((x) => x != '')
- return prefix + filterSlugFromEmptyChar.join('-')
+ slug = prefix + filterSlugFromEmptyChar.join('-')
+ if (withHost) slug = process.env.NEXT_PUBLIC_SELF_HOST + slug
+ return slug
}
/**