Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How i can add a prefix at the end of the markdown file in netlify-cms? #2282

Closed
kalwalt opened this issue Apr 10, 2019 · 3 comments
Closed

Comments

@kalwalt
Copy link

kalwalt commented Apr 10, 2019

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! 😄

@kalwalt
Copy link
Author

kalwalt commented Apr 10, 2019

I found this issue #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..

@erquhart
Copy link
Contributor

Yep, that's the way - please close if it works out. Thanks for sharing your solution for others!

@kalwalt
Copy link
Author

kalwalt commented Apr 10, 2019

@erquhart yes, it works perfectly, I'm closing it.

@kalwalt kalwalt closed this as completed Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants