Skip to content

Excerpt included in content = parsing overhead #186

Description

@scriptype

Hi, I stumbled across this project while looking for a front matter package that fully respects YAML specs. Such a well-crafted project!

My issue...

var file = matter([
  '---',
  'title: hey its 2026',
  '---',
  'excerpt',
  'more excerpt',
  '---',
  'contentzi'
].join('\n'), { excerpt: true })

console.log(file)

Gives me:

{
  content: 'excerpt\nmore excerpt\n---\ncontentzi',
  data: { title: 'hey its 2026' },
  isEmpty: false,
  excerpt: 'excerpt\nmore excerpt\n'
}

And this means, I need to parse the content field one more time to get rid of the excerpt part. It's useless since I already get the excerpt in its own field. My use-case: building a static CMS.

I guess the assumption was that the excerpt will be the natural beginning of content.

However, an excerpt, by definition, is a paraphrasing of or a quote from any part of the content, and is not necessarily just the first few sentences of the content. So, it was a surprise to see excerpt embedded in content.

If most people use the first few lines in the content as excerpt, they still need to parse the content field anyway, at least to remove '---\n' before sending it to a markdown parser as the full text body.

So, my wish: don't include excerpt in content. People who were relying on excerpt being in content would replace their remove-excerpt-dashes-from-content logic with a content-prefixing-with-excerpt logic. And in my case, no extra work would be needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions