Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions content/skill-building/1-/1-.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
title: 1.-2.-3. Baking pages with Cap'n Granny Sharksby's createPages hooks
url: https://www.conferencebuddy.io/
date: 2022-07-10
city: Frankfurt
country: Germany
title: 1. Baking pages from tags with Cap'n Granny Sharksby's createPages hooks
url: https://www.olavea.com/olacast/
date: 2022-01-02
city: Oslo
country: Norway
tags: ["animals", "Chicago", "zoos", "royal_icing"]


description: Lorem Ipsum some conference text that is a lot longer than the other one so we can see how it looks.
path: /1-2-3-createPages-from-markdown-files
path: 1-2-3-createPages-from-markdown-files
---
# 1. Baking pages from tags with Cap'n Granny Sharksby's createPages hooks
## bleh bleh bleh
"bleh bleh bleh."Says 🧛‍♀️ 🏴‍☠️
14 changes: 14 additions & 0 deletions content/skill-building/2-/2-.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: 2. bleh bleh bleh
url: https://www.olavea.com/olacast/
date: 2022-01-09
city: Oslo
country: Norway
tags: ["animals", "Chicago", "zoos", "royal_icing"]


description: Lorem Ipsum some conference text that is a lot longer than the other one so we can see how it looks.
path: 2-createPages-from-markdown-files
---
# bleh bleh bleh
"bleh bleh bleh."Says 🧛‍♀️ 🏴‍☠️
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: A. «Ahoy! Cookie?!» Cap'n Fox shouts and embarks. 🦊

url: https://www.conferencebuddy.io/
url: https://www.olavea.com/olacast/
date: 2022-06-10
city: Frankfurt
country: Germany
Expand All @@ -13,7 +13,8 @@ path: /A-createPages-from-markdown-files
---

# bleh bleh bleh
bleh bleh bleh
"bleh bleh bleh."Says 🧛‍♀️ 🏴‍☠️


I added my first blog post in markdown, this one.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: E. «Ahoy! Cookie?!» Cap'n Fox shouts and embarks. 🦊

url: https://www.conferencebuddy.io/
url: https://www.olavea.com/olacast/
date: 2022-04-10
city: Frankfurt
country: Germany
Expand All @@ -11,7 +11,8 @@ tags: ["animals", "Chicago", "zoos", "royal_icing"]
description: Lorem Ipsum some conference text that is a lot longer than the other one so we can see how it looks.
path: /E-createPages-from-markdown-files
---

# bleh bleh bleh
"bleh bleh bleh."Says 🧛‍♀️ 🏴‍☠️


I added my first blog post in markdown, this one.
Expand Down
43 changes: 30 additions & 13 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require('dotenv').config({
module.exports = {
siteMetadata: {
siteUrl: "https://timeship1.gatsbyjs.io/",
url: "https://www.olavea.com/",
title: `TimeShip1`,
description: "Lillian and Friends Building Skill",
},
Expand All @@ -18,24 +19,18 @@ module.exports = {
// or gatsby-transformer-sharp in SSR or DSG pages. The best workaround is to use an image CDN such as Cloudinary or imgix to host your images. This will give you faster builds and rendering too.
`gatsby-transformer-sharp`,
`gatsby-transformer-remark`,
// In your gatsby-config.js

// {
// resolve: `gatsby-transformer-remark`,
// options: {
// plugins: [
// {
// resolve: `gatsby-remark-prismjs`,
// },
// {
// resolve: `gatsby-remark-images`,
// options: {
// maxWidth: 800,
// linkImagesToOriginal: false,
// },
// },
// {
// resolve: `@raae/gatsby-remark-oembed`,
// options: {
// // usePrefix defaults to false
// // usePrefix: true is the same as ["oembed"]
// usePrefix: ["oembed", "video"],
// providers: {
// // Important to exclude providers
// // that adds js to the page.
Expand All @@ -45,18 +40,40 @@ module.exports = {
// "Instagram",
// "Twitter",
// "Flickr",
// "YouTube",
// ],
// },
// },
// },
// ],
// },
// },
// {
// resolve: `gatsby-transformer-remark`,
// options: {
// plugins: [
// {
// resolve: `@raae/gatsby-remark-oembed`,
// options: {
// providers: {
// // Important to exclude providers
// // that adds js to the page.
// // If you do not need them.
// exclude: [
// "Reddit",
// "Instagram",
// "Twitter",
// "Flickr",
// "YouTube",
// ],
// },
// },
// },
// {
// resolve: `gatsby-remark-responsive-iframe`,
// },
// ],
// },
// },

{
resolve: `gatsby-source-filesystem`,
options: {
Expand Down Expand Up @@ -96,7 +113,7 @@ module.exports = {
options: {
projectId: 'fr5nacyp',
dataset: 'production',
watchMode: true,
watchMode: false,
token: process.env.SANITY_TOKEN,
},
},
Expand Down
130 changes: 99 additions & 31 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,63 @@
// Baking pages
// with Cap'n Granny Sharksby's
// createPages hook
async function bakePodcastsIntoPages({ graphql,actions }) {
// console.log('💀 Captain Granny Sharksbys createPages hook 💀');
// 1.
const bakingSong = require.resolve('./src/templates/bake-podcast-song.js')
// Look for _ _ _ in http://localhost:8000/topping/Duct-Tape 👻
// 2.
const { data } = await graphql(`{
supplies: allMarkdownRemark(sort: {
order: ASC,
fields: frontmatter___title
}) {
nodes {
id
strawberry: frontmatter {
path
title
}
}
}
}
`)
// 3.
data.supplies.nodes.forEach((ahoyGoodie, index) => {
// console.log('Defer index:', index, ahoyGoodie);
// A. – B. – C. – DSG 🎩
actions.createPage({
// A. «Ahoy! Goodie?!»
// Cap'n Fox shouts and embarks. 🦊
path: `/olacast/${ahoyGoodie.strawberry.path}`,
// B. Owlsby sings badly
// and bakes baby sharks. 🦈
component: bakingSong,
// C. Catsby looks tasty
// Fox gets hungry for kitten. 🐯
context: {
catsbySlug: ahoyGoodie.strawberry.path,
fox: 'Catsby looks tasty I getz hungry for kitten',
},
// D. Don't Show Goodies to Fox
// and maybe get bitten. DSG–🎩
// catsby build and look for _ _ _ in terminal 💀
defer: index + 1 > 2,
// D. Data tree 🤖🌲
// E. Every node you must sort 💰
// F. Fields Forever `fields: ,` 🍓
// E. forEach index
// R. RRR! defer: index + 1 > 2 🎩

// How does Catsby help Lilly make an index of all the toppings?
// What is the way Lilly makes index travel from
// D. Data tree 🤖🌲
// R. RRR! defer: index + 1 > 2 🎩
})
});

}
//3.
async function bakeMarkdownIntoGoodies({ graphql, actions }) {
// console.log('Captain Granny Sharksbys createPages hook'); 💀
// 1. bakingSong = Lilly the Bunny sings like a 🦢
Expand Down Expand Up @@ -59,58 +116,68 @@ async function bakeMarkdownIntoGoodies({ graphql, actions }) {
})
});
}
// We don't use this yet
// Captain Granny Sharksby createPages hook ↩️
async function turnTagzIntoPages({ graphql, actions }) {
async function bakePeopleIntoPages({ graphql, actions }) {
// console.log('createPages hook from Captain Sharksby ↩️ 💀');
// 1. bakingSong = Lilly the Bunny require the bakingSong from granny Shark's gingerbread Recipe
const bakingSong = require.resolve('./src/pages/pizzaTags.js')
const bakingSong = require.resolve('./src/pages/bake-podcasts-song.js')
// Look for _ _ _ in http://localhost:8000/tag/eminem 👻
// 2. supplies: tags in markdown files
const { data } = await graphql(`{
postsRemark: allMarkdownRemark(
sort: {order: DESC, fields: frontmatter___date}
limit: 10
) {
edges {
node {
frontmatter {
url
tags
}
pirates: allSanityPerson {
totalCount
nodes {
name
id
slug {
current
}
}
}
tagsGroup: allMarkdownRemark(limit: 20) {
group(field: frontmatter___tags) {
totalCount
fieldValue
}
}
}`)
// 3. turn toppings into pages with
// createPage method from Captain Sharksby
data.tagsGroup.group.forEach((ahoyGoodie, index) => {
data.pirates.nodes.forEach((ahoyGoodie) => {
// console.log('Defer index:', ahoyGoodie);
actions.createPage({
// A. «Ahoy! Cookie?!»
// Cap'n Fox shouts and embarks. 🦊
path: `/tag/${ahoyGoodie.fieldValue}`,
path: `/pirate/${ahoyGoodie.slug.current}`,
// B. Bunny sings badly
// and bakes baby sharks. 🐰
component: bakingSong,
// C. Catsby looks tasty
// Fox gets hungry for kitten. 🐯
// context: {
// catsby: ahoyGoodie.toppings.tags ,
// //toppingRegex: `/${ahoyCookie}/`,
// // TODO Regex for Topping
// // toppingRegex: `/${ahoyCookie.frontmatter.tags}/i`,
// },
defer: index + 1 > 2
context: {
catsby: ahoyGoodie.slug.current,
//name: `/${ahoyCookie}/`,
// TODO Regex for Topping
// toppingRegex: `/${ahoyCookie.frontmatter.tags}/i`,
},
// defer: index + 1 > 2,
ownerNodeId: ahoyGoodie.id,
})
});
// 5. Pass tag data to pizzaTags.js
});
// // 3. Figure out how many pages there are based on how many slicemasters there are, and how many per page!
// const pageSize = parseInt(process.env.GATSBY_PAGE_SIZE);
// const pageCount = Math.ceil(data.slicemasters.totalCount / pageSize);
// console.log(
// `There are ${data.slicemasters.totalCount} total people. And we have ${pageCount} pages with ${pageSize} per page`
// );
// // 4. Loop from 1 to n and create the pages for them
// Array.from({ length: pageCount }).forEach((_, i) => {
// console.log(`Creating page ${i}`);
// actions.createPage({
// path: `/slicemasters/${i + 1}`,
// component: path.resolve('./src/pages/slicemasters.js'),
// // This data is pass to the template when we create it
// context: {
// skip: i * pageSize,
// currentPage: i + 1,
// pageSize,
// },
// });
// });
}
// Troya Catsby and Lilly Owlsby Baking pages
// with Cap'n Granny Sharksby's
Expand Down Expand Up @@ -312,8 +379,9 @@ exports.createPages = async (params) => {
// wait for all promises to be resolved before finishing this function
await Promise.all([
bakeMarkdownIntoGoodies(params),
turnTagzIntoPages(params),
bakePodcastsIntoPages(params),

bakePeopleIntoPages(params),
turnToolsIntoPages(params),
bakingPhotosIntoPages(params),

Expand Down
2 changes: 1 addition & 1 deletion src/components/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function Nav() {
<Link to="/slicemasters">💜 & Friends</Link>
</li>
<li>
<Link to="/order">💸 order</Link>
<Link to="/olacast"> 🎤🔧 OlaCast: skill- builders 🔧 🔧🎤</Link>
</li>
</ul>
</NavStyles>
Expand Down
41 changes: 41 additions & 0 deletions src/pages/bake-podcasts-song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// pages / pizzaTags.js
import { graphql } from "gatsby";
import { GatsbyImage } from "gatsby-plugin-image";
import React from "react";

import TagList from "../components/TagList";
// import ToppingsFilter from "../components/ToppingsFilter";
// <ToppingsFilter activeTopping={pageContext.topping} />
// <TagList bakingTreasure={bakingTreasure} />
export default function bakePodcastsSong({ data, pageContext }) {
// console.log(data)
// const bakingTreasure = data.supplies.nodes;
return (
<>
<div className="center">
<GatsbyImage image={data.pirates.image.asset.gatsbyImageData} />
<h2>
<span className="mark">{data.pirates.name}</span>
</h2>
<p>{data.pirates.description}</p>


</div>
</>
);
}

export const query = graphql`
query ($catsby: String!) {
pirates: sanityPerson(slug: {current: {eq: $catsby}}) {
name
id
description
image {
asset {
gatsbyImageData(width: 800, placeholder: BLURRED, formats: AUTO)
}
}
}
}
`;
Loading