Initial commit from gatsby: (https://github.com/gatsbyjs/gatsby-starter-blog.git)
This commit is contained in:
58
src/components/bio.js
Normal file
58
src/components/bio.js
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Bio component that queries for data
|
||||
* with Gatsby's useStaticQuery component
|
||||
*
|
||||
* See: https://www.gatsbyjs.com/docs/how-to/querying-data/use-static-query/
|
||||
*/
|
||||
|
||||
import * as React from "react"
|
||||
import { useStaticQuery, graphql } from "gatsby"
|
||||
import { StaticImage } from "gatsby-plugin-image"
|
||||
|
||||
const Bio = () => {
|
||||
const data = useStaticQuery(graphql`
|
||||
query BioQuery {
|
||||
site {
|
||||
siteMetadata {
|
||||
author {
|
||||
name
|
||||
summary
|
||||
}
|
||||
social {
|
||||
twitter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
|
||||
// Set these values by editing "siteMetadata" in gatsby-config.js
|
||||
const author = data.site.siteMetadata?.author
|
||||
const social = data.site.siteMetadata?.social
|
||||
|
||||
return (
|
||||
<div className="bio">
|
||||
<StaticImage
|
||||
className="bio-avatar"
|
||||
layout="fixed"
|
||||
formats={["auto", "webp", "avif"]}
|
||||
src="../images/profile-pic.png"
|
||||
width={50}
|
||||
height={50}
|
||||
quality={95}
|
||||
alt="Profile picture"
|
||||
/>
|
||||
{author?.name && (
|
||||
<p>
|
||||
Written by <strong>{author.name}</strong> {author?.summary || null}
|
||||
{` `}
|
||||
<a href={`https://twitter.com/${social?.twitter || ``}`}>
|
||||
You should follow them on Twitter
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Bio
|
||||
36
src/components/layout.js
Normal file
36
src/components/layout.js
Normal file
@ -0,0 +1,36 @@
|
||||
import * as React from "react"
|
||||
import { Link } from "gatsby"
|
||||
|
||||
const Layout = ({ location, title, children }) => {
|
||||
const rootPath = `${__PATH_PREFIX__}/`
|
||||
const isRootPath = location.pathname === rootPath
|
||||
let header
|
||||
|
||||
if (isRootPath) {
|
||||
header = (
|
||||
<h1 className="main-heading">
|
||||
<Link to="/">{title}</Link>
|
||||
</h1>
|
||||
)
|
||||
} else {
|
||||
header = (
|
||||
<Link className="header-link-home" to="/">
|
||||
{title}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="global-wrapper" data-is-root-path={isRootPath}>
|
||||
<header className="global-header">{header}</header>
|
||||
<main>{children}</main>
|
||||
<footer>
|
||||
© {new Date().getFullYear()}, Built with
|
||||
{` `}
|
||||
<a href="https://www.gatsbyjs.com">Gatsby</a>
|
||||
</footer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Layout
|
||||
50
src/components/seo.js
Normal file
50
src/components/seo.js
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* SEO component that queries for data with
|
||||
* Gatsby's useStaticQuery React hook
|
||||
*
|
||||
* See: https://www.gatsbyjs.com/docs/how-to/querying-data/use-static-query/
|
||||
*/
|
||||
|
||||
import * as React from "react"
|
||||
import { useStaticQuery, graphql } from "gatsby"
|
||||
|
||||
const Seo = ({ description, title, children }) => {
|
||||
const { site } = useStaticQuery(
|
||||
graphql`
|
||||
query {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
description
|
||||
social {
|
||||
twitter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
)
|
||||
|
||||
const metaDescription = description || site.siteMetadata.description
|
||||
const defaultTitle = site.siteMetadata?.title
|
||||
|
||||
return (
|
||||
<>
|
||||
<title>{defaultTitle ? `${title} | ${defaultTitle}` : title}</title>
|
||||
<meta name="description" content={metaDescription} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={metaDescription} />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta
|
||||
name="twitter:creator"
|
||||
content={site.siteMetadata?.social?.twitter || ``}
|
||||
/>
|
||||
<meta name="twitter:title" content={title} />
|
||||
<meta name="twitter:description" content={metaDescription} />
|
||||
{children}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Seo
|
||||
Reference in New Issue
Block a user