-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Allows for sourced data with invalid data shape by configuring a map from invalid to valid data shape.
- Loading branch information
Showing
16 changed files
with
1,680 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: Data Shape Tests | ||
slug: shape-tests | ||
heroImage: | ||
cloudName: lilly-labs-consulting | ||
publicId: gatsby-transformer-cloudinary-demo/photo-1631462685412-80a75dd611bc | ||
alt: A fine hero image from Cloudinary | ||
heroImageWithUnconformingShape: | ||
a_cloud_name: lilly-labs-consulting | ||
a_public_id: gatsby-transformer-cloudinary-demo/photo-1631462685412-80a75dd611bc | ||
alt: A fine hero image from Cloudinary | ||
--- |
55 changes: 55 additions & 0 deletions
55
demo/src/pages/manual-tests/{markdownRemark.frontmatter__slug}.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import * as React from 'react'; | ||
import { graphql } from 'gatsby'; | ||
import { GatsbyImage } from 'gatsby-plugin-image'; | ||
|
||
export default function BlogPostTemplate({ data }) { | ||
const { markdownRemark } = data; | ||
const { frontmatter, html } = markdownRemark; | ||
const { title, heroImage, heroImageWithUnconformingShape } = frontmatter; | ||
return ( | ||
<> | ||
<h2>{title}</h2> | ||
|
||
{heroImage?.gatsbyImageData ? ( | ||
<GatsbyImage image={heroImage.gatsbyImageData} alt={heroImage.alt} /> | ||
) : ( | ||
<p> | ||
No gatsby image for <code>heroImage</code> | ||
</p> | ||
)} | ||
|
||
{heroImageWithUnconformingShape?.gatsbyImageData ? ( | ||
<GatsbyImage | ||
image={heroImageWithUnconformingShape.gatsbyImageData} | ||
alt={heroImageWithUnconformingShape.alt} | ||
/> | ||
) : ( | ||
<p> | ||
No gatsby image for <code>heroImageWithUnconformingShape</code> | ||
</p> | ||
)} | ||
|
||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} | ||
|
||
export const pageQuery = graphql` | ||
query ($id: String!) { | ||
markdownRemark(id: { eq: $id }) { | ||
html | ||
frontmatter { | ||
slug | ||
title | ||
heroImage { | ||
gatsbyImageData(height: 200, layout: FIXED) | ||
alt | ||
} | ||
heroImageWithUnconformingShape { | ||
gatsbyImageData(height: 200, layout: FIXED) | ||
alt | ||
} | ||
} | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.