import getEnv from "./getEnv"; const defaultLocale = getEnv().DEFAULT_LOCALE || null; const htmlExtensionInUrl = getEnv().HTML_EXTENSION_IN_URL === "true"; const htmlExtension = htmlExtensionInUrl ? ".html" : ""; const createPaths = { post: (locale, category, post) => { if (defaultLocale === locale) { return `${category}/${post}${htmlExtension}`; } return `${locale}/${category}/${post}${htmlExtension}`; }, category: (locale, category) => { if (defaultLocale === locale) { return `${category}/`; } return `${locale}/${category}/`; }, archive: locale => { if (defaultLocale === locale) { return `archive${htmlExtension}`; } return `${locale}/archive${htmlExtension}`; }, home: locale => { if (defaultLocale === locale) { return ""; } return locale; }, notFound: locale => { if (defaultLocale === locale) { return `not-found${htmlExtension}`; } return `${locale}/not-found${htmlExtension}`; }, getPublicUrl: () => { return getEnv().PUBLIC_URL; } }; export default createPaths;