Thanks for the easy to use product. I have performed an initial evaluation and it seems great, just one blocking issue for me at the moment, in that I need to harness i18n in Gatsby via the i18n community plugin. Basic support for this your end should be easy though, I hope.
If you see "How it works" section of the README here you can see that I need control over the output file naming format (for blogs and pages), or at least access to a "prefix" field which would prepend the en or pt, etc. in the file name: 'filename.en.js' for example before the extension.
Hi @mccrodp, thanks for the detailed explanation. I imagine the files you're writing from Netlify CMS are markdown, just raw content, and then you pull those files into Gatsby. Have you considered altering the filename on Gatsby's side? An example of the resulting file structure that you want to achieve in your repo, and an example of the final output structure, would help clarify things a bit.
This may be directly related to https://github.com/netlify/netlify-cms/issues/445.
Hi @erquhart, thanks for your reply. Not sure what you mean by alter it on Gatsby side, like re-process it after you create and save from NetlifyCMS? I think better to do upon creation rather than at build time.
I haven't used NetlifyCMS much, but looked great. I got Contentful working with the i18n community plugin for Gatsby, so I will use that instead for now as it's got multilingual in it by default. But if writing the raw markdown files out to a file pattern as shown here: https://github.com/mccrodp/gatsby-starter-transformer-remark-i18n/tree/master/src/pages than I could have used that, expanding on that repo to fit with your netlfiyCMS folder format. If filenames like that are possible in the future w.r.t the other issue you linked, then you can close this one. Cheers!
They're talking about naming your component files under src/pages - Netlify CMS would only create markdown or data files (yaml, json, etc). Here's an example page component from the repo that shows the kind of files that require this naming: https://github.com/angeloocana/gatsby-plugin-i18n/blob/master/packages/gatsby-starter-default-i18n/src/pages/index.pt.js
Hey @erquhart, thanks for the reply. Yes, components are an option. So are markdown files, see example repo I shared: https://github.com/mccrodp/gatsby-starter-transformer-remark-i18n/blob/master/src/pages/pandas-and-bananas.en.md
See docs for plugin: https://github.com/angeloocana/gatsby-plugin-i18n#how-it-works should help get a clearer picture now to see how things might fit together 😄
Oh, great! You can do this for each collection:
extension: en.md
format: markdown
Support for extensions with periods just got merged and will be released on just a bit here.
format: markdown should be format: frontmatter, just FYI
🤦♂️
Ok, sounds great, editing existing ones is possible, thanks. But, what about say creating a new blog post with newpost.en.md and newpost.pt.md extensions, is that possible via NetlifyCMS UI?
@mccrodp Yes, if you can set them up as separate collections (one for en.md and one for pt.md). Like @erquhart said, that will be in the next release (1.3.0 probably).
Ahh, ok, thanks @tech4him1, @erquhart, that sounds great. Not sure how soon I'll get to experiment with this, perhaps the next time I need a i18n site. Would be great to have this accessible somewhere in README w.r.t i18n, as a proposed solution. A blog post, showing a PoC repo or something. In an ideal world, eh? 😛 Thanks for your help, this seems to satisfy my original requirements 👍
Only improvement on this I can see is a way to unify the en, pt etc. versions of the same content on the CMS side of things, even a "Edit pt version" link from the en version of the content and visa versa and a way to link them (could simply be identical filename initially).
@mccrodp Did you find a way to do i18n with Netlify CMS? I tried with the extension approach, but even though it creates files, they won't show up as entries in the collection page
@macs91 that shouldn't be the case, what version of the CMS are you using? It prints in the console on load.
@erquhart 1.9.3.. I was waiting for Gatsby JS v2 official release before updating Netlify CMS too.. meanwhile I've adopted another strategy to localize content in the CMS
Gotcha - the fix was released in 1.9.4 if you're still interested.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing in favour of https://github.com/netlify/netlify-cms/issues/716
Most helpful comment
Only improvement on this I can see is a way to unify the
en,ptetc. versions of the same content on the CMS side of things, even a "Editptversion" link from theenversion of the content and visa versa and a way to link them (could simply be identical filename initially).