kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
925 stars 202 forks source link

site.posts collection is empty as soon as the plugin is activated #105

Open andreamoro opened 6 years ago

andreamoro commented 6 years ago

Not sure what I need to do to return the posts collection. I left the files in the _posts folder as they were before activating the plugin. Is there a generic example I can look into to start building a brand new site?

Also, is there a chance to use the language code within the file name? Or - as far as I understand - language can only be controlled via the front matter?

Thanks

alexandre1985 commented 6 years ago

My site.posts.size also returns always 0 as soon as I activate the plugin. Is this a bug? Or are the posts localized by language and there is a different way to use site.posts? My jekyll is jekyll 3.6.2 and the site.posts.size where not zero before I activated the plugin

alexandre1985 commented 6 years ago

I found the solution @andreamoro . From what I have seen in the code, you can't have general posts for all languages; all posts are localized by language. So, for you to have posts in your English language, you should put them in: _i18n/en/_posts/ directory. That is it. Its missing some documentation on that @Anthony-Gaudino .

DenisLug commented 6 years ago

Thank you alexandre. I have searched long for the reason why no posts are appearing. The readme doesn't contains any hint about creating a _posts directory in the _i18n/[LANG] folders.

alexanmtz commented 6 years ago

After several configs and trying to make this work the solution from @alexandre1985 works for me, placing the posts inside _i18n/en/_posts/

rraallvv commented 6 years ago

Does anyone know if this plugin supports having a common _posts folder. With a different _posts folders for each language it seems to me that there is going to be a lot of duplicate HTML code. It would be better to have different lists of localized strings (one per language) but only a single page for each post in HTML shared among languages. At least that's how I've been handing localization in native apps.