-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data files and dynamic page generation support #452
Comments
This could be something for the roadmap after we've finalized how the plugin system should work. |
@ulivz, sounds good. Would you like to suggest a light option for making it happen? I am after the first case, accessing data files in the vue templates. Have examples and other files stored separately from the markdown. A few suggestion how to organize stuff will do, such as:
A high level idea will do, I'll figure out the coding and details. |
Folks, I'd really appreciate a few tips here. Looking into storing some data in ".vuepress" folder, a bunch of json/yaml files, then reading and making them available globally across pages and vue components. If you could suggest which way to go and what to read up that is really appreciated. |
I'm curious about this too -- what did you decide to do? |
It has been supported at the plugin API, we'll release it ASAP. |
In the meantime, is this what you had in mind? |
|
Is there an example of the Dynamic page generation support? |
For anyone else looking for this, this is now very much possible thanks to https://vuepress.vuejs.org/plugin/option-api.html#additionalpages e.g. in your const path = require('path') module.exports = {
additionalPages: [
{
path: '/readme/',
filePath: path.resolve(__dirname, '../../README.md')
}
]
}
// or ...
module.exports = {
async additionalPages () {
// Note that VuePress doesn't have request library built-in
// you need to install it yourself.
const rp = require('request-promise')
const content = await rp('https://raw.githubusercontent.com/vuejs/vuepress/master/CHANGELOG.md')
return [
{
path: '/changelog/',
content
}
]
}
} |
Hey guys, thanks for this amazing project. That fact that it comes with a built-in support for technical documentation is pure gold.
Looking into doco, could not find anything on how to bring custom datasets into VuePress workflow. For example, there is a bunch of YAML/JSON files somewhere in the folder which will later be used to generate some bits of contents or whole pages. There are two scenario here:
For example, here is how Middleman handles this. It exposed a global "data" object which can be used within templates.
I saw that this.$site and this.$page provides access to page metadata and front matter, but still not sure how to address custom data files access in the right way.
Could you please provide guidance on this? Updating documentation on how to handle these cases would be awesome as well.
The text was updated successfully, but these errors were encountered: