slug page improvements
This commit is contained in:
1 parent
5ccec9e2ba
commit
82c9b88f77
3 files changed
+15
-12
No files matched your search
@@ -65,6 +65,9 @@ export function createPageTokens(components: StrapiComponent[]): Token[] {
|
||||
|
||||
export function createPage(res: StrapiPage | StrapiPage[]): IPage {
|
||||
const item = asItem(res)
|
||||
if (!item) {
|
||||
return null
|
||||
}
|
||||
|
||||
return {
|
||||
title: item.title,
|
||||
|
||||
@@ -9,3 +9,9 @@ export function asItem<T>(value: T | T[]) {
|
||||
? value[0]
|
||||
: value
|
||||
}
|
||||
|
||||
export function paramsToSlug(parts: string | string[]): string {
|
||||
const slug = asArray(parts).join('/')
|
||||
|
||||
return `/${slug}`
|
||||
}
|
||||
Reference in new issue
Block a user