mbanting / metalsmith-prismic

A Metalsmith.io plugin to pull in content from Prismic.io
MIT License
48 stars 19 forks source link

Alternate Languages support #36

Open MadsMadsDk opened 7 years ago

MadsMadsDk commented 7 years ago

Hello,

Prismic.io now supports multiple language version of content types. This is really nice, as opposed to using tags for i18n purposes.

Using the prismic.io API browser, I can now retrieve content with a new alternate_languages property. It returns an array that looks like this:

[{
id: "WctSGysAAOoD5b77"
type: "frontpage"
lang: "da-dk"
},
{
id: "WctR9SsAAOoD5b5P"
type: "frontpage"
lang: "sv-se"
}]

I would like to be able to retrieve this array, loop over each language, and retrieve the document for each language version, so I can generate multiple language versions of a page.

Any suggestions as to how to do this? I've tried forking this repository and messing around with it locally, but I can't seem to locate the alternate_languages array on any results I get from Prismic.

MadsMadsDk commented 7 years ago

Just looking through package.json. The package apparently depends on prismic 1.4.0, but the current version is 3.6.1. That could be the explanation.

mbanting commented 7 years ago

Hey thanks. I haven't been using this on a project lately so unfortunately my time on this has been minimal. If you get it working on your fork feel free to submit a PR to bring it back here. Thanks @MadsMadsDk !

MadsMadsDk commented 7 years ago

I've just tried upgrading to the latest prismic.io version, and it seems to still be working, and I'm even getting the new properties on content pulled from prismic. I'll do some further testing, and submit a PR if it proves succesful. Thanks for a quick response!

mbanting commented 7 years ago

That would be awesome, thanks @MadsMadsDk

galeksic90 commented 6 years ago

I have update prismic to the newest version and it works, not sure just how to query for non-default language from .md file. :)