diff --git a/src/runtime/server/transformers/path-meta.ts b/src/runtime/server/transformers/path-meta.ts index 17e91cbe1..61c03f6b9 100644 --- a/src/runtime/server/transformers/path-meta.ts +++ b/src/runtime/server/transformers/path-meta.ts @@ -1,6 +1,7 @@ import { pascalCase } from 'scule' import slugify from 'slugify' import { withoutTrailingSlash, withLeadingSlash } from 'ufo' +import { ParsedContentMeta } from '../../types' import { useRuntimeConfig } from '#imports' const SEMVER_REGEX = /^(\d+)(\.\d+)*(\.x)?$/ @@ -12,7 +13,7 @@ const describeId = (_id: string) => { parts[parts.length - 1] = filename const _path = parts.join('/') - return { + return > { _source, _path, _extension, @@ -33,7 +34,7 @@ export default { const filePath = parts.join('/') - return { + return { _path: generatePath(filePath), _draft: isDraft(filePath), _partial: isPartial(filePath), diff --git a/src/runtime/types.d.ts b/src/runtime/types.d.ts index 96da39a69..c5807607c 100644 --- a/src/runtime/types.d.ts +++ b/src/runtime/types.d.ts @@ -13,10 +13,6 @@ export interface ParsedContentMeta { * Content path, this path is source agnostic and it the content my live in any source */ _path?: string - /** - * Content slug - */ - _slug?: string /** * Content title */ @@ -33,11 +29,23 @@ export interface ParsedContentMeta { * Content locale */ _locale?: boolean + /** + * File type of the content, i.e `markdown` + */ + _type?: string + /** + * Path to the file relative to the content directory + */ + _file?: string + /** + * Extension of the file + */ + _extension?: string [key: string]: any } -export interface ParsedContent extends ParsedContentMeta{ +export interface ParsedContent extends ParsedContentMeta { /** * Excerpt */