diff --git a/packages/gatsby-theme-adr/gatsby-node.js b/packages/gatsby-theme-adr/gatsby-node.js index f894a8f..5d11800 100644 --- a/packages/gatsby-theme-adr/gatsby-node.js +++ b/packages/gatsby-theme-adr/gatsby-node.js @@ -145,3 +145,27 @@ exports.createPages = async ({ graphql, actions, reporter }) => { createAdrDetail(createPage, graphql, reporter), ]); }; + +// Define SiteMetadata type schema to allow for optional socialLinks. +exports.createSchemaCustomization = ({ actions }) => { + actions.createTypes(` + type Site { + siteMetadata: SiteMetadata! + } + + type SiteMetadata { + siteUrl: String! + title: String! + description: String! + image: String! + menuLinks: [IconLink!]! + socialLinks: [IconLink!] + } + + type IconLink { + name: String! + uri: String! + iconName: String + } + `); +}; diff --git a/packages/gatsby-theme-adr/src/components/layout/Footer.tsx b/packages/gatsby-theme-adr/src/components/layout/Footer.tsx index b61c737..66f281c 100644 --- a/packages/gatsby-theme-adr/src/components/layout/Footer.tsx +++ b/packages/gatsby-theme-adr/src/components/layout/Footer.tsx @@ -26,7 +26,7 @@ const Footer = ({ links, socialLinks }: FooterProps): ReactElement => { ))}
- {socialLinks.map(({ name, uri, iconName }) => { + {socialLinks?.map(({ name, uri, iconName }) => { return ( {name}