How to get blog excerpts to work #2396
-
Hi, I'm trying to set up the blog plugin so we can have a blog along with the rest of the documentation. I have some of it working but I just don't understand how to get the excerpt to work. I think I have configured the I have also tried to follow the examples for the plugin options but the examples I find quite confusing as they all appear to be doing similar things but very differently. For example: I currently have this in my theme: hopeTheme({
...
plugins: {
...
blog: {
filter: ({ filePathRelative }) =>
filePathRelative ? filePathRelative.startsWith("docs/blog/") : false,
autoExcerpt: true,
getInfo: ({ excerpt, frontmatter, git = {} }) => ({
author: frontmatter.author || "",
date: frontmatter.date || git.createdTime || null,
category: frontmatter.category || [],
tag: frontmatter.tag || [],
excerpt: page.excerpt
}),
}
}, The rest seems to work but I cannot get the auto excerpt to show. Nor can I seem to get it to work by adding an html comment into the doc nor into the frontmatter as per https://vuepress-theme-hope.github.io/v2/guide/blog/article.html#excerpt:
I've also tried commenting out What have I done wrong here and what do I need to do to display the automatic excerpt (or any excerpt)? Test note content ---
title: Testing note 1
author: Daeraxa
date: 2022-11-10
category:
- testcat
- testcat2
tag:
- testtag
- testtag2
---
Some words |
Beta Was this translation helpful? Give feedback.
Some improvements and fixes are made in 11e5a44 and 012b994