Description
Feature request
Jekyll collections are a wonderful feature and I recommend that you read those docs as it will explain it better than I can.
They allow you to group related pages, like "members of a team" or "talks at a conference" and then to use that data in other pages.
By default collections don't render their own pages / generate their own routes (instead they are intended to be used in other pages) but you can override that on a per-collection basis.
These collections are markdown files which should support everything that a normal Vuepress page does but there are a few major differences.
- Collections will be exposed in a way that any page can access and use them. Perhaps on
$site
or perhaps in a Vuex store? - Collections are by default not rendered as pages / routes are not generated for them.
What problem does this feature solve?
For the Vue Community website there are a few things we'd like to do.
We'd like to have libraries/frameworks be their own "pages" but these shouldn't have routes, instead other pages will include them.
Same goes for the FAQs and a few other things.
What does the proposed API look like?
Perhaps it would look somewhat similar to Jekyll?
{% for staff_member in site.staff_members %}
<h2>{{ staff_member.name }} - {{ staff_member.position }}</h2>
<p>{{ staff_member.content | markdownify }}</p>
{% endfor %}
<template v-for="member in $site.collections.staff_members">
<h2>{{ member.frontmatter.name }} - {{ member.frontmatter.position }}</h2>
<p>{{ member.content | renderMarkdown }}</p>
</template>
Or perhaps there would be a custom component for this, instead of e.g. a filter?
I know that we could kind of achieve this ourselves but the key point here is how would we get renderMarkdown
to use the internal markdown-it instance for rendering and also work with Vue components, like regular VuePress pages do?
How should this be implemented in your opinion?
Maybe we could expose it as $site.collections
, as above. Alternatively via Vuex - a module per collection, for instance?
I like the Jekyll convention of folders with underscores at the beginning being collections.
Are you willing to work on this yourself?
I'm somewhat open to the idea.
I was thinking about making it a plugin but it doesn't seem possible with the current API, I think there would need to be some changes there.
Well, it would be possible but there would be a lot of custom code involved instead of us hooking into the internals of VuePress to do more of the heavy lifting for us.