Hi to all developers, my name is Walter and i am developing a Gatsby-starter with intl support: gatsby-starter-i18n-bulma It is based on Gatsby, bulma for the Css part and the super gatsby-plugin-i18n, and of course Netlify CMS.
Basically with my starter you can switch from an English page like:
/en/artworks/
to the corresponding, for example, in Italian
/it/opere/
for doing this i added a datalist of every page associated with a number id see this piece of code:
module.exports = {
'01': ['/', '/'],
'02': ['blog', 'blog'],
'03': ['about','presentazione'],
'04': ['contact','contatto'],
'05': ['artworks','opere'],
'06': ['artworks/introduction','opere/introduzione'],
'07': ['2019-02-01-my-first-gatsby-blog-post','2019-02-01-mio-primo-blog-post-gatsby'],
'08': ['2019-03-11-news-from-art-planet', '2019-03-11-notizie-dal-pianeta-arte'],
'09': ['artworks/painting','opere/pittura'],
'10': ['artworks/sculpture','opere/scultura'],
'11': ['artworks/performance','opere/performance'],
'12': ['artworks/interactivity','opere/arte-interattiva'],
'13': ['contact/thanks', 'contatto/grazie'],
};
Every page needs to be saved with the extension of the language choosen, for example:
artworks.en.md
and opere.it.md
Actually if i create a new post, the blog is saved without the .it. or .en. prefix
see this commit:
My question is : How i can add the .it.
or .en.
prefix before the .md extension?
Simple answer: i could add in the name of the title but i would to make automatic, you choose the language with the widget and automatically the language is added at the end of the file name.
Thank you for your attention and interest, any help and suggestion will be really appreciated.
Have you a nice day! :smile:
I found this issue https://github.com/netlify/netlify-cms/issues/1114 and it saved my life!
In static/admin/config.yml
i added :
extension: en.md
format: frontmatter
For anyone interested, see also this commit
and straight from the docs: https://www.netlifycms.org/docs/configuration-options/#extension-and-format
for each blog collections and it seems to save with the desired prefix, I need to test but i think it is solved..
Yep, that's the way - please close if it works out. Thanks for sharing your solution for others!
@erquhart yes, it works perfectly, I'm closing it.
Most helpful comment
I found this issue https://github.com/netlify/netlify-cms/issues/1114 and it saved my life!
In
static/admin/config.yml
i added :For anyone interested, see also this commit
and straight from the docs: https://www.netlifycms.org/docs/configuration-options/#extension-and-format
for each blog collections and it seems to save with the desired prefix, I need to test but i think it is solved..