Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e9737be
chore: update packages patch version and fix eslint failures
seanho96 Jan 3, 2022
e91afb6
chore: update directus source plugin patch version
seanho96 Jan 3, 2022
f60b49d
chore: update all minor package versions
seanho96 Jan 3, 2022
f6ea933
chore: update all gatsby packages
seanho96 Jan 3, 2022
980ec24
Revert "chore: update all gatsby packages"
seanho96 Jan 3, 2022
9094244
chore: update svgr major version
seanho96 Jan 3, 2022
b8c85be
chore: update commander & i18next major version
seanho96 Jan 3, 2022
0518984
chore: update to Gatsby 4
seanho96 Jan 4, 2022
82f688e
chore: update sitemap to support Gatsby 4
seanho96 Jan 4, 2022
ebc13e4
chore: update types and typescript related packages major version
seanho96 Jan 4, 2022
a269f9d
chore: update stylelint related packages major version
seanho96 Jan 4, 2022
256f814
chore: remove unused flags
seanho96 Jan 4, 2022
64c0734
chore: update babel styled components major version
seanho96 Jan 4, 2022
da215ea
chore: update husky and lint staged major version
seanho96 Jan 4, 2022
cb20f04
chore: update fresnel major version
seanho96 Jan 4, 2022
0b2d22f
chore: remove comments
seanho96 Jan 4, 2022
ef00920
refactor: add quality 100
seanho96 Jan 4, 2022
6c6c07c
fix: og images
seanho96 Jan 4, 2022
6734b5d
fix: og images
seanho96 Jan 5, 2022
0c6f20c
chore: remove priority from sitemap
seanho96 Jan 5, 2022
59526bc
chore: update latest patch versions
seanho96 Jan 5, 2022
229b12c
chore: update embla to latest major version
seanho96 Jan 5, 2022
e5c5285
chore: remove commented lines
seanho96 Jan 6, 2022
29390bd
fix: merge conflict
seanho96 Jan 14, 2022
05bf99a
Apply code suggestion
Jan 14, 2022
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
96 changes: 47 additions & 49 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
})

const site_url = 'https://deriv.com'

module.exports = {
// pathPrefix: process.env.PATH_PREFIX || '/deriv-com/', // For non CNAME GH-pages deployment
flags: {
FAST_DEV: true,
PRESERVE_WEBPACK_CACHE: true,
},
siteMetadata: {
title: 'Deriv',
description:
'Deriv.com gives everyone an easy way to participate in the financial markets. Trade with as little as $1 USD on major currencies, stocks, indices, and commodities.',
author: 'Deriv.com',
siteUrl: 'https://deriv.com',
siteUrl: site_url,
},
plugins: [
'gatsby-plugin-react-helmet',
Expand All @@ -41,7 +42,7 @@ module.exports = {
{
resolve: 'gatsby-plugin-sitemap',
options: {
exclude: [
excludes: [
'/404',
'/**/404.html',
'/**/404',
Expand Down Expand Up @@ -74,54 +75,53 @@ module.exports = {
'/signup-success',
'/**/signup-success',
],
serialize: ({ site, allSitePage }) =>
allSitePage.edges.map((edge) => {
const ignore_localized_regex = /careers|besquare|livechat|academy/
const path = edge.node.path
let priority = 0.7
const languages = Object.keys(language_config)
if (path === '/') {
priority = 1.0
} else if (path.match(/dbot|dtrader|dmt5|story/)) {
priority = 1.0
} else {
languages.forEach((lang) => {
if (path === `/${lang}/`) {
priority = 1.0
}
})
}
query: `
{
allSitePage {
nodes {
path
}
}
}
`,
resolveSiteUrl: () => site_url,
resolvePages: ({ allSitePage: { nodes: allPages } }) => {
return allPages.map((page) => {
return { ...page }
})
},
serialize: ({ path }) => {
const ignore_localized_regex = /careers|besquare|livechat|academy/
const languages = Object.keys(language_config)

const path_array = path.split('/')
const current_lang = path_array[1]
const check_lang = current_lang.replace('-', '_')
let current_page = path
const path_array = path.split('/')
const current_lang = path_array[1]
const check_lang = current_lang.replace('-', '_')
let current_page = path

if (languages.includes(check_lang)) {
path_array.splice(1, 1)
current_page = path_array.join('/')
}
if (languages.includes(check_lang)) {
path_array.splice(1, 1)
current_page = path_array.join('/')
}

languages.push('x-default')
languages.splice(languages.indexOf('ach'), 1)
const ignore_localized = current_page.match(ignore_localized_regex)
const links = languages.map((locale) => {
if (locale !== 'ach' && locale) {
const replaced_locale = locale.replace('_', '-')
const is_default = locale === 'en' || locale === 'x-default'
const href_locale = is_default ? '' : `/${replaced_locale}`
const href = `${site.siteMetadata.siteUrl}${href_locale}${current_page}`
return { lang: replaced_locale, url: href }
}
})

return {
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: `monthly`,
priority,
links: !ignore_localized ? links : null,
languages.push('x-default')
languages.splice(languages.indexOf('ach'), 1)
const ignore_localized = current_page.match(ignore_localized_regex)
const links = languages.map((locale) => {
if (locale !== 'ach' && locale) {
const replaced_locale = locale.replace('_', '-')
const is_default = ['en', 'x-default'].includes(locale)
const href_locale = is_default ? '' : `/${replaced_locale}`
const href = `${site_url}/${href_locale}${current_page}`
return { lang: replaced_locale, url: href }
}
}),
})

return {
url: path,
links: !ignore_localized ? links : null,
}
},
},
},
{
Expand Down Expand Up @@ -149,8 +149,6 @@ module.exports = {
type: `image/png`,
},
],
gcm_sender_id: '370236002280',
gcm_user_visible_only: true,
crossOrigin: `use-credentials`,
// TODO: add translations and support for language routes e.g:
// localize: [
Expand Down
Loading