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

working with md files #128

Closed
Amereyeu opened this issue Feb 23, 2023 · 4 comments
Closed

working with md files #128

Amereyeu opened this issue Feb 23, 2023 · 4 comments

Comments

@Amereyeu
Copy link

I have updated to Astro 2.0 and Content Collections. Is there some documentation on how to work with md files? Fe. if I switch from english to spanish I want my posts (md files) to switch to spanish as well. Hope it makes sense.
thanks

@Foxandxss
Copy link

I second this. I am going to need this as well.

@AZagatti
Copy link

I created two folders for the blog for the languages and changed the spread of the slug for the route itself, it worked fine, so I don't even need to generate the pages with the cli of this project, example.
I wish there was something of its own in this project for that.

@dmitryuck
Copy link

actually we do not need to generate in content folder
there your files with different translations, try structure like this

content/blog/en/
content/blog/fr/

then you can filter blog content like this

import i18next from "i18next";

const currentLang = i18next.language;

const blogEntries = await getCollection("blog", ({ data, id }) => {
  return id.startsWith(`${currentLang}/`);
});

when you open site.com/en/blog it should take posts from blog with English translation

@Foxandxss
Copy link

That is the idea I had in mind, yes.

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

4 participants