From f5e1191fa01a3406db687aa197dc53e576c504f0 Mon Sep 17 00:00:00 2001 From: Olivier Lacroix Date: Thu, 27 May 2021 19:24:14 +1000 Subject: [PATCH] Prefix alternate links based on theme option --- packages/gatsby-theme-i18n/src/components/seo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gatsby-theme-i18n/src/components/seo.js b/packages/gatsby-theme-i18n/src/components/seo.js index edb6769a..3ab94adb 100644 --- a/packages/gatsby-theme-i18n/src/components/seo.js +++ b/packages/gatsby-theme-i18n/src/components/seo.js @@ -4,7 +4,7 @@ import { useStaticQuery, graphql, withPrefix } from "gatsby" import { useLocalization } from "../hooks/use-localization" const SEO = ({ location, pageContext }) => { - const { locale, config, defaultLang } = useLocalization() + const { locale, config, prefixDefault, defaultLang } = useLocalization() const data = useStaticQuery(graphql` query LocalizationSEOQuery { site { @@ -33,7 +33,7 @@ const SEO = ({ location, pageContext }) => { if (l.code === locale) return null - if (l.code === defaultLang) { + if (l.code === defaultLang && !prefixDefault) { href = `${defaultSiteUrl}${ pageContext.originalPath === withPrefix(`/`) ? ``