Skip to content
Draft
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
Binary file added content/photographs/blue-door/blue-door.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions content/photographs/blue-door/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Blue door
date: "2020-01-21T11:00:00Z"
description: "A door"
publication_status: published
photo: ./blue-door.jpg
---
### Details
- **Location:** London, United Kingdom
- **Film:** Kodak Portra 160
- **Camera:** Zenza Bronica SQ-A

Binary file added content/photographs/door/door.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions content/photographs/door/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Raw
date: "2020-01-21T11:00:00Z"
publication_status: published
photo: ./door.jpg
---
### Details
- **Location:** Tuscany, Italy
- **Film:** Kodak 400 TX
- **Camera:** Zenza Bronica SQ-A
Binary file added content/photographs/homat-hayam /homat-hayam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions content/photographs/homat-hayam /index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Homat HaYam
date: "2020-01-21T11:00:00Z"
publication_status: published
photo: ./homat-hayam.jpg
---
### Details
- **Location:** Tel Aviv, Israel
- **Film:** Kodak Portra 160
- **Camera:** Zenza Bronica SQ-A
10 changes: 10 additions & 0 deletions content/photographs/israel/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Israel
date: "2020-01-21T11:00:00Z"
publication_status: published
photo: ./israel.jpg
---
### Details
- **Location:** Tel Aviv, Israel
- **Film:** Kodak Portra 160
- **Camera:** Zenza Bronica SQ-A
Binary file added content/photographs/israel/israel.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions content/photographs/sicily/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Sicily
date: "2020-01-21T11:00:00Z"
publication_status: published
photo: ./sicily.jpg
---

### Details
- **Location:** Sicily, Italy
- **Film:** Kodak Portra 400
- **Camera:** Nikon FM2n
Binary file added content/photographs/sicily/sicily.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions content/photographs/up-the-mountain/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Up the mountain
date: "2020-01-21T11:00:00Z"
publication_status: published
photo: ./up-the-mountain.jpg
---
### Details
- **Location:** Madeira, Portugal
- **Film:** Kodak Portra 160
- **Camera:** Zenza Bronica SQ-A
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,41 @@ const config: GatsbyConfig = {
}
}
}
photographsPages: allMarkdownRemark(
filter: {fields: {slug: {glob: "**/photographs/*"}}}
) {
nodes {
frontmatter {
date
}
fields {
slug
}
}
}
}
`,
resolveSiteUrl: () => siteUrl,
resolvePages: ({
allSitePage: { nodes: allPages },
blogPages: { nodes: blogPages },
aboutMePages: { nodes: aboutMePages },
photographsPages: { nodes: photographsPages },
}) => {
const pages = [...blogPages, ...aboutMePages].reduce((acc, node) => {
const pages = [...blogPages, ...aboutMePages, ...photographsPages].reduce((acc, node) => {
const { fields } = node;
acc[fields.slug] = node;

return acc;
}, {});

const res = allPages.map((page) => {
return { ...page, ...pages[page.path] };
});
const res = allPages
// .filter((page) => {
// return Object.keys(pages).includes(page.path)
// })
.map((page) => {
return { ...page, ...pages[page.path] };
});

// console.log(JSON.stringify(res), 'ressss')

Expand Down
59 changes: 58 additions & 1 deletion gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const createBlogPages = async ({ graphql, actions, reporter }) => {
const { createPage } = actions;

// Define a template for blog post
const blogPost = path.resolve(`./src/templates/BlogPost.tsx`);
const blogPost = path.resolve(`./src/templates/BlogPost/BlogPost.tsx`);

// Get all markdown blog posts sorted by date
const result = await graphql(
Expand Down Expand Up @@ -63,8 +63,65 @@ const createBlogPages = async ({ graphql, actions, reporter }) => {
}
};

const createPhotoPages = async ({ graphql, actions, reporter }) => {
const { createPage } = actions;

// Define a template for blog post
const photoPost = path.resolve(`./src/templates/PhotoPost/PhotoPost.tsx`);

// Get all markdown blog posts sorted by date
const result = await graphql(
`
{
allMarkdownRemark(
filter: {
fields: { slug: { glob: "**/photographs/*" } }
frontmatter: { publication_status: { eq: "published" } }
}
sort: { fields: [frontmatter___date], order: ASC }
limit: 1000
) {
nodes {
id
fields {
slug
}
}
}
}
`
);

if (result.errors) {
reporter.panicOnBuild(
`There was an error loading your photo posts`,
result.errors
);
return;
}

const posts = result.data.allMarkdownRemark.nodes;

// Create blog posts pages
// But only if there's at least one markdown file found at "content/blog" (defined in gatsby-config.js)
// `context` is available in the template as a prop and as a variable in GraphQL

if (posts.length > 0) {
posts.forEach((post, index) => {
createPage({
path: post.fields.slug,
component: photoPost,
context: {
id: post.id
},
});
});
}
}

exports.createPages = async ({ graphql, actions, reporter }) => {
await createBlogPages({ graphql, actions, reporter });
await createPhotoPages({ graphql, actions, reporter });
};

exports.onCreateNode = ({ node, actions, getNode }) => {
Expand Down
Loading