import * as React from "react"; import { graphql } from "gatsby"; import { Section, SectionTitle, Label } from "../components/Layout"; import { NewsSummary } from "../components/News"; import Seo from "../components/seo"; import Link from "../components/Link"; import { TwitterShareButton, LinkedinShareButton, FacebookShareButton } from "react-share"; import { TwitterSmall, LinkedinSmall, FacebookSmall, ArrowUpCircle } from "../components/Icons"; const BlogPostTemplate = ({ data, location }) => { const post = data.markdownRemark; // const siteTitle = data.site.siteMetadata?.title || `Title`; // const { previous, next } = data; // console.log(post); return ( <>
Go back
{post.frontmatter.categories && (
{post.frontmatter.categories.map((category) => ( ))}
)} {post.frontmatter.title}
{post.frontmatter.description &&

{post.frontmatter.description}

}
Go back
); }; export default BlogPostTemplate; export const pageQuery = graphql` query BlogPostBySlug($id: String!, $previousPostId: String, $nextPostId: String) { site { siteMetadata { title } } markdownRemark(id: { eq: $id }) { id excerpt(pruneLength: 160) html frontmatter { title date(formatString: "MMMM DD, YYYY") description categories author avatar { childImageSharp { gatsbyImageData(width: 40, placeholder: BLURRED, formats: [AUTO, WEBP, AVIF]) } } } } previous: markdownRemark(id: { eq: $previousPostId }) { fields { slug } frontmatter { title } } next: markdownRemark(id: { eq: $nextPostId }) { fields { slug } frontmatter { title } } } `;