getAll by section?

ptdev
3
ptdev
commented 15 days ago

Hi, is there anyway to get the content per section?

I'll try to explain my setup and what I'm asking.

Take, for example, the following structure:

content/en/ (configured as content folder on nuxtent)
content/en/something/
content/en/something/articleA
content/en/something/articleB
content/en/anotherthing/
content/en/anotherthing/articleX
content/en/anotherthing/articleY

content/de/ (also configured as content folder on nuxtent)
content/de/something/
content/de/something/articleA
content/de/something/articleB
content/de/anotherthing/
content/de/anotherthing/articleX
content/de/anotherthing/articleY

So, as you can see, nuxtent is configured with 2 content folders, one for /en/ and another for /de/. I'm using nuxt-i18n so the folders are named according to the language code and represent different languages.

So now If I call:

app.$content(app.i18n.locale).getAll()

I get all articles from folders "something" and "anotherthing". for the selected language.

My question is: Is there anyway to only get the contents for one folder? For example, something like the following (which doesn't work)

app.$content(app.i18n.locale).getAll('/something')

To only get the articles from inside the "something" folder/section on the current language?

I know I can workaround this by setting up nuxtent with a configuration for each of those language/subfolders combinations, but with X number of languages and then another Y number of sections/subfolders, the configuration will quickly become huge and I believe there's probably a better way to do this.

Any other suggestions that achieves the same result are also welcome of course.

Thank you.

0
Informations
Question โ€ข Unresolved
#c143 - Created 15 days ago