diff --git a/src/components/structure/SEO.js b/src/components/structure/SEO.js index 65e98247..97c17cb2 100644 --- a/src/components/structure/SEO.js +++ b/src/components/structure/SEO.js @@ -1,49 +1,51 @@ -import React from "react" -import { useSiteMetadata } from "../../hooks/use-site-metadata" +import React from "react"; +import { useSiteMetadata } from "../../hooks/use-site-metadata"; function createSeoImage(featured, image) { - if (featured) { - return featured?.childImageSharp.gatsbyImageData.images.fallback.src; - } - return image; + if (featured) { + return featured?.childImageSharp.gatsbyImageData.images.fallback.src; + } + return image; } const Seo = ({ title, description, pathname, children, featured }) => { - const { title: defaultTitle, description: defaultDescription, image, siteUrl, twitterHandle } = useSiteMetadata() - const featuredImage = createSeoImage(featured,image); - const seo = { - title: title || defaultTitle, - description: description || defaultDescription, - image: `${siteUrl}${featuredImage}`, - url: `${siteUrl}${pathname || ``}`, - twitterHandle, - } + const { title: defaultTitle, description: defaultDescription, image, siteUrl, twitterHandle } = useSiteMetadata(); + console.log(featured); + const featuredImage = createSeoImage(featured, image); + const seo = { + title: title || defaultTitle, + description: description || defaultDescription, + image: `${siteUrl}${featuredImage}`, + url: `${siteUrl}${pathname || ``}`, + twitterHandle + }; - return ( - <> - {seo.title} - - - - - - - - - - - - - - - - - - - - {children} - - ) -} -export default Seo \ No newline at end of file + return ( + <> + {seo.title} + + + + + + + + + + + + + + + + + + + + {children} + + ); +}; + +export default Seo; \ No newline at end of file diff --git a/src/hooks/use-site-metadata.js b/src/hooks/use-site-metadata.js index 1b5f4ae3..7ecd4d85 100644 --- a/src/hooks/use-site-metadata.js +++ b/src/hooks/use-site-metadata.js @@ -8,6 +8,7 @@ export const useSiteMetadata = () => { title description twitterHandle + image siteUrl } } diff --git a/src/templates/blog-page.js b/src/templates/blog-page.js index 2e53b92d..f00b7b4c 100644 --- a/src/templates/blog-page.js +++ b/src/templates/blog-page.js @@ -38,20 +38,33 @@ export const pageQuery = graphql` wordCount { words } + excerpt(format: PLAIN, pruneLength: 30) frontmatter { permalink date(formatString: "MMMM DD, YYYY") title author tag + featuredImage { + childImageSharp { + gatsbyImageData( + placeholder: BLURRED + height: 600 + formats: [AUTO, WEBP] + width: 600 + quality: 80 + transformOptions: { grayscale: false, fit: COVER, cropFocus: CENTER } + ) + } + } } } } `; export function Head({data: {markdownRemark}}) { - const {frontmatter} = markdownRemark; + const {frontmatter,excerpt} = markdownRemark; return ( - + ) } diff --git a/src/templates/index.js b/src/templates/index.js index 1d1ff273..7282d1c8 100644 --- a/src/templates/index.js +++ b/src/templates/index.js @@ -63,5 +63,7 @@ export const pageQuery = graphql` ` export const Head = () => ( - + ) \ No newline at end of file