Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
run checkIsPageOutdated on pages-conditional
  • Loading branch information
wackerow committed Dec 21, 2021
commit 32e7ef2de8c9eef5933a475c9550d9a168889982
11 changes: 7 additions & 4 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,15 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
// we can remove this logic and the `/pages-conditional/` directory.
const outdatedMarkdown = [`eth`, `dapps`, `wallets`, `what-is-ethereum`]
outdatedMarkdown.forEach((page) => {
supportedLanguages.forEach((lang) => {
supportedLanguages.forEach(async (lang) => {
const markdownPath = `${__dirname}/src/content/translations/${lang}/${page}/index.md`
const langHasOutdatedMarkdown = fs.existsSync(markdownPath)
if (!langHasOutdatedMarkdown) {
// Check if json strings exists for language, if not mark `isContentEnglish` as true
const jsonPath = `${__dirname}/src/intl/${lang}/page-${page}.json`
const langHasIntlJson = fs.existsSync(jsonPath)
const { isOutdated, isContentEnglish } = await checkIsPageOutdated(
page,
lang
)
createPage({
path: `/${lang}/${page}/`,
component: path.resolve(
Expand All @@ -355,7 +357,8 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
originalPath: `/${page}/`,
redirect: false,
},
isContentEnglish: !langHasIntlJson,
isContentEnglish,
isOutdated,
},
})
}
Expand Down