Skip to content

Bug in calculation of "_raw.flattenedPath" #487

@Oleksandr-Kei

Description

@Oleksandr-Kei

There is a problem with _raw.flattenedPath in generated JSON schemas for content files.
If there is a file with "index" in the end of filename then this part will be erased in resulted value of _raw.flattenedPath
For example:

  • “search-by-index.mdx” will be resulted into “search-by-” in generated JSON schema;
  • “find-element-by-index.md” will be resulted into “find-element-by-“
  • “solution-documents/search-by-index.mdx” will be resulted into “solution-documents/search-by-“
  • “solution-documents/find-element-by-index.md” will be resulted into “solution-documents/find-element-by-”

Screenshot (889)

Here is a repo to reproduce the issue: https://github.com/Oleksandr-Kei/contentlayer-project

Actual problem could be in this line
Because /\/?index$/ covers not only cases of "something/index" and "index". But also cases like "something-index", "somethingindex", etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions