Update content categorization and handle hierarchical documentation
Enhancements were implemented to support hierarchical documentation. Local CMS now respects parent ID and order attributes of content items, and content can be categories as 'blog' or 'documentation'. Changes were also made to the wordpress integration supporting these new categorizations. Introduced working with nested documentation pages.
This commit is contained in:
@@ -66,6 +66,13 @@ export const Post = defineDocumentType(() => ({
|
||||
type: 'string',
|
||||
resolve: (post) => `/blog/${getSlug(post._raw.sourceFileName)}`,
|
||||
},
|
||||
parentId: {
|
||||
type: 'string',
|
||||
resolve: (doc) => {
|
||||
const segments = getPathSegments(doc);
|
||||
return segments.length > 1 ? segments.slice(0, -1).join('/') : 'blog';
|
||||
},
|
||||
},
|
||||
structuredData: {
|
||||
type: 'object',
|
||||
resolve: (doc) => ({
|
||||
@@ -124,6 +131,33 @@ export const DocumentationPage = defineDocumentType(() => ({
|
||||
type: 'number',
|
||||
resolve: (post) => calculateReadingTime(post.body.raw),
|
||||
},
|
||||
parentId: {
|
||||
type: 'string',
|
||||
resolve: (doc) => {
|
||||
const segments = getPathSegments(doc);
|
||||
|
||||
if (segments.length > 1) {
|
||||
const { pathName } = getMetaFromFolderName(segments[0]);
|
||||
|
||||
if (pathName === 'index') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return pathName;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
order: {
|
||||
type: 'number',
|
||||
resolve: (doc) => {
|
||||
const segments = getPathSegments(doc);
|
||||
const { order } = getMetaFromFolderName(segments[segments.length - 1]);
|
||||
|
||||
return order;
|
||||
},
|
||||
},
|
||||
structuredData: {
|
||||
type: 'object',
|
||||
resolve: (doc) => ({
|
||||
|
||||
Reference in New Issue
Block a user