Localised Global SEO on Gatsby

Hi there,

I have Global SEO specifically defined for all of my locales in DatoCMS.

How can I access these global localised values in Gatsby?

I have tried something in the lines of:

    query HomePageMetaData {
        datoCmsSite {
          _allGlobalSeoLocales {
            value {
              siteName
              fallbackSeo {
                title
                description
              }
            }
            locale
          }
         }
        datoCmsHome {
          _allSeoSettingsLocales {
            value {
              description
              title
            }
            locale
          }
        }
      }

But that wouldn’t work…

Any help appreciated!

hi @jb if you want to get all Global Seo settings for all locales, than you should use allDatoCmsSite query, otherwise you can use datoCmsSite, but you need to filter by locale. Here is two examples:

query MyQuery {
  allDatoCmsSite {
    nodes {
      globalSeo {
        twitterAccount
        titleSuffix
        siteName
        facebookPageUrl
        fallbackSeo {
          description
          title
          twitterCard
          image {
            url
          }
        }
      }
      locale
    }
  }
  datoCmsSite(locale: {eq: "it"}) {
    globalSeo {
      siteName
      titleSuffix
      twitterAccount
      fallbackSeo {
        description
        title
        twitterCard
      }
    }
  }
}

Hope this help :slight_smile:

1 Like