and Static Site Generators
JaxNode April 2021
public
src
--pages
gatsby-config.js
gatsby-node.js
gatsby-browser.js
package.json
// src/pages/index.js
import React from "react"
export default () => <div>Hello world!</div>
// src/pages/index.js
import React from "react"
import { Link } from "gatsby"
import Header from "../components/header"
export default () => (
<div style={{ color: `purple` }}>
<Link to="/contact/">Contact</Link>
<Header headerText="Hello Gatsby!" />
<p>What a world.</p>
<img src="https://source.unsplash.com/random/400x200" alt="" />
</div>
)
// src/pages/index.js
import React from 'react'
import { graphql } from 'gatsby'
const HomePage = ({data}) => {
return (
<div>
{data.site.siteMetadata.description}
</div>
)
}
export const query = graphql`
query HomePageQuery {
site {
siteMetadata {
description
}
}
}
`
export default HomePage
query {
markdownRemark(id: { eq: "e16204e2-d882-50dd-a24d-316d166251e0" }) {
excerpt
frontmatter {
title
date
category
}
}
}
query($id: String!) {
markdownRemark(id: { eq: $id }) {
excerpt
frontmatter {
title
date
category
}
}
}
With parameters
---
title: "Pandas and Bananas"
date: "2017-08-21"
---
# This is a H1 tagged line
This will be in a p tag. Do Pandas eat bananas? Check out this short video that shows that yes! pandas do
seem to really enjoy bananas!
* This will create a bullet point in ul -> li.
This will be a link to [jaxnode.com](https://www.jaxnode.com).
<iframe width="560"
height="315"
src="https://www.youtube.com/embed/4SZl1r2O_bY"
frameborder="0"
allowfullscreen></iframe>
Scott Hanselman
//shell
> npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp
// gatsby-node.js
module.exports = {
plugins: [
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
],
}