From dad03173777227ca355d38c09f8d1678e550ac62 Mon Sep 17 00:00:00 2001 From: Cameron Corda Date: Fri, 26 Nov 2021 11:30:46 -0800 Subject: [PATCH] favicon from config. closes #183 --- docs/seo.md | 2 +- website/src/components/Meta.js | 26 ++++++++++++++------------ website/src/lib/constants.js | 2 ++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/seo.md b/docs/seo.md index 19b598a..f018a5c 100644 --- a/docs/seo.md +++ b/docs/seo.md @@ -15,7 +15,7 @@ The primary way we tackle this is to combine the [WordPress Yoast SEO plugin](ht Inside of our [Meta component](../website/src/components/Meta.js), we merge together defaults defined in `lib/constants.js` and merge in passed in yoast data pulled from graphql via globals context. -An important variable to set is the `META.url` to the production domain. This is used to rewrite relative images and relative links from sitemaps and feeds so that those are only indexed from your production URL. +Inside of the constants file, you'll want to set per site values like site name and favicons. An important variable to set is the `META.url` to the production domain. This is used to rewrite relative images and relative links from sitemaps and feeds so that those are only indexed from your production URL. ## Sitemaps and RSS Feeds diff --git a/website/src/components/Meta.js b/website/src/components/Meta.js index 0f86ede..eba9b22 100644 --- a/website/src/components/Meta.js +++ b/website/src/components/Meta.js @@ -1,5 +1,5 @@ import GlobalsContext from 'contexts/GlobalsContext'; -import { META, WORDPRESS_DOMAIN, WORDPRESS_URL } from 'lib/constants'; +import { META, WORDPRESS_URL } from 'lib/constants'; import { trimTrailingSlash } from 'lib/utils'; import { NextSeo } from 'next-seo'; import Head from 'next/head'; @@ -61,7 +61,7 @@ export default function Meta({ title, description, image, seo }) { ]; } - // defaults are fine, only set noindex or nofollow if explicit + // set noindex or nofollow if explicitly defined in Yoast if (seo?.metaRobotsNoindex == 'noindex') { seoSettings.noindex = true; } @@ -69,9 +69,6 @@ export default function Meta({ title, description, image, seo }) { seoSettings.nofollow = true; } - // console.log('seoSettings', JSON.stringify(seoSettings, null, 2)); - // console.log('seo', JSON.stringify(seo, null, 2)); - return ( <> @@ -82,13 +79,17 @@ export default function Meta({ title, description, image, seo }) { /> {/* favicons */} - {/* */} - - + {META.icon32 && ( + + )} + {META.iconApple && ( + + )} + {/* twitter specific meta if defined */} {seo?.twitterTitle && ( )} + {/* pass customized SEO object to NextSeo to render all other tags */} ); diff --git a/website/src/lib/constants.js b/website/src/lib/constants.js index 0b16cbd..844f03c 100644 --- a/website/src/lib/constants.js +++ b/website/src/lib/constants.js @@ -27,4 +27,6 @@ export const META = { twitterHandle: '@patronageorg', siteName: 'Bubs by Patronage', proxyWordPressImages: true, + icon32: '', + iconApple: '/apple-touch-icon.png', };