venus
venus3y ago

✅ – venus – 11-48 Jun 9

Hey, I want to extract which locale is being used in that specific article. _raw is an output where should be that locale taken from. What is the best way to extract it? In this case it's en.
const _raw = {
sourceFilePath: 'articles/en/new-web.mdx',
sourceFileName: 'new-web.mdx',
sourceFileDir: 'articles/en',
contentType: 'mdx',
flattenedPath: 'articles/en/new-web'
};
const _raw = {
sourceFilePath: 'articles/en/new-web.mdx',
sourceFileName: 'new-web.mdx',
sourceFileDir: 'articles/en',
contentType: 'mdx',
flattenedPath: 'articles/en/new-web'
};
7 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
venus
venus3y ago
Yeah something like so?
const pathArray = path.split("/");
const locale = pathArray[1];
const pathArray = path.split("/");
const locale = pathArray[1];
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
reactibot
reactibot3y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/984423790467497994
venus
venus3y ago
Okay, thanks
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/984423790467497994