slug page improvements

This commit is contained in:
tmshv committed 2021-02-16 20:53:28 +03:00
1 parent 5ccec9e2ba
commit 82c9b88f77
3 files changed
+15 -12

No files matched your search

+3
View File
@@ -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,
+6
View File
@@ -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}`
}