Hi,
I try to develop one plateform with Nuxt for get in on place docs from multiple repositories.
But I can't get the content from outside content folder, someone has one solution for get content outside the default folder ?
Thank you.
I'm not sure if I understood the question correctly, but if you wish to change the source from the default content folder to another folder, you can use the "dir" property to set it to another folder of your choice.
Example:
nuxt.config.js:
export default {
...
content: {
dir: 'docs'
}
...
}
This means nuxt/content will target docs folder from now on.
Not in that way, I try to get content from multiple sources, like node_modules & content in same time.
Based on what I understood from the source code, seems like currently it will only search/walk through 1 specific directory, which is the dir property we mentioned, as seen in this line of code (this.dir).
I believe one possibility was supposed to making the root directory / as the dir so it will crawl through node_modules as well. However, I do think that is risky especially if there are tons of packages in node_modules, so they actually added sort of a fail-safe at this line which basically ignores node_modules and any file/directory that starts with . (based on the regex used). Hope I didn't interpret the source code wrongly haha.
Just curious, is there a specific use case where you need to get content from node_modules as well?
My use case @azrikahar:
Several repositories and each one has its own content in .md files and I want to gather all the content in one place, with a single design, define the menu, etc ...., but I want each project keep this own content with him.
A content platform with multiple sources of content.
Maybe you can git clone the repos in your content folder and create a cron job to git pull each repo ?
Yes, but I try to find one more usefull method.
You can add the other repo as submodule by using git submodule add link-to-your-repo path-to-target-folder. I did that recently on my project.
For example, to add your content repo to the current repo as submodule, just do:
git submodule add <link-to-content-repo> content
The folder content in your repo will appear as a reference to the target repo, and locally it will have all the files in that repo (assume you have sufficient permission). On Github it will appear as a reference folder and not clickable.
To update submodule with the latest commit from your repo, run
git submodule foreach git pull origin master
or
git submodule update --recursive
https://github.blog/2016-02-01-working-with-submodules/
Hope it helps :)
You can fetch Github API.
This repo for example: https://api.github.com/repos/nuxt/content/git/trees/bef85f4bf2018cf59ada8188bb65dc05feb313a2
{
"sha": "bef85f4bf2018cf59ada8188bb65dc05feb313a2",
"url": "https://api.github.com/repos/nuxt/content/git/trees/bef85f4bf2018cf59ada8188bb65dc05feb313a2",
"tree": [
{
"path": ".editorconfig",
"mode": "100755",
"type": "blob",
"sha": "9142239769f522e59cfcebe8ae5d57dc4dc90822",
"size": 207,
"url": "https://api.github.com/repos/nuxt/content/git/blobs/9142239769f522e59cfcebe8ae5d57dc4dc90822"
},
{
"path": ".eslintignore",
"mode": "100644",
"type": "blob",
"sha": "5588d5dbcc3e98d2e32f89dfe9ec6349ef2a9ac8",
"size": 67,
"url": "https://api.github.com/repos/nuxt/content/git/blobs/5588d5dbcc3e98d2e32f89dfe9ec6349ef2a9ac8"
},
(...)
Yes, but I try to find one more usefull method.
I am also looking for this but didn't get good solution
Any chance to see this optio for multisources on one of next version?
We could consider this option in the future but it can lead to weird behaviour honestly, I thin this could be already done by using a Nuxt module that push into content/
Most helpful comment
I am also looking for this but didn't get good solution