Please add support for nested page frontmatter data and link data
See original GitHub issueIs your feature request related to a problem? Please describe. For custom themes such as blogs, it is useful to have access to the directory structure and frontmatter data for nested pages. For example, if I have the following directory structure:
/blog/index.md
/blog/post_1.md
/blog/post_2.md
Then I would like to be able to create a clickable list of posts on the /blog/index
page with information for nested posts such as the post title, date, etc.
To do this, I need to be able to retrieve the frontmatter data from post_1
and post_2
(titles, dates) as well as information about what nested pages (i.e. links) are available.
At the moment I see no way to see frontmatter or site structure information other than for the currently selected page?
I realise that the current goal is to keep vitepress
simple and lightweight, however, this change would make vitepress
viable for themes such as blogs without IMHO complicating the conceptual purity of the package.
Describe the solution you’d like
- A site-level property in
siteData
containing information about the nested page structure (for building links). - A site-level property in
siteData
containing frontmatter data for each page.
Describe alternatives you’ve considered
I’ve looked around siteData
and other locations, but don’t currently see a way to recover this information. (Please let me know if there is a way!!)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Vitepress points the way forward (vite as opposed to webpack) and so there will only be growing interest in using vitepress more extensively.
I agree that the framework should remain minimal and focused on what it does so that the code base remains lean and because this lets us easily tweak or tailor to our own use cases per theme customisation (without getting bogged down in technicalities).
However, some basic site-wide information is really useful in certain contexts such as blogs or situations like nested documentation sites, and allows for a much more expressive use of the package. Some thoughts:
EDIT: It can also be argued that a property with site-wide information about path’s and frontmatter actually favours a lean paradigm because things like sidebars, navbars, and page content can be built dynamically for respective themes without needing to overload the configs file with assorted manual configurations, which are prone to bugs.
If I may: beyond the “thumbs up” that I added to the post above, I too would really like to echo support for this feature / enhancement request.
For context, I am (and imagine a few others are as well) building a blog with vitepress and so far everything has been absolutely fantastic.
This feature would make it much easier when it comes to generating the lists of articles on the home page in a custom theme.