Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed image issue #69

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
*~

# Runtime data
Expand Down
2 changes: 1 addition & 1 deletion content/news/2021-07-07/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
path: "/news/phantomQAmeetingJuly2021"
date: "2021-07-07"
title: "Phantom QA/QC open panel discussion"
cover: "../images/phantom_image.png"
cover: "./phantom_image.png"
tags: ['meeting', 'SIG-meeting', 'phantom', '2021']
published: true
---
Expand Down
Binary file added content/news/2021-07-07/phantom_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-catch-links',

{
resolve: 'gatsby-source-filesystem',
options: {
Expand Down
12 changes: 7 additions & 5 deletions src/components/NewsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ const Title = styled.h1`
margin: 0;
`;

const NewsList = ({ path, cover, title, date, excerpt, tags }) => (
<Container>
const NewsList = ({ path, cover, title, date, excerpt, tags }) => {
console.log("cover=>",cover)
return (
<Container>
<Wrapper>
{ cover ?
<Image>
<Img fluid={cover} />
<Img fluid={cover}/>
</Image>
: null }
<Information>
Expand All @@ -104,8 +106,8 @@ const NewsList = ({ path, cover, title, date, excerpt, tags }) => (
</Information>
</Wrapper>
</Container>
);

);
}
export default NewsList;

NewsList.propTypes = {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const Index = ({ data }) => {
const { edges: fragments = [] } = data.fragments || {};
const { edges: news } = data.news || {};
const { siteMetadata: site } = data.site;
console.log("edges ",news)

return (
<Layout>
<Helmet title={site.titleAlt} />
Expand All @@ -51,7 +53,7 @@ const Index = ({ data }) => {
{news.map(({ node }) => (
<NewsList
key={node.id}
cover={node.frontmatter.cover ? node.frontmatter.cover.childImageSharp.fluid : null}
cover={node.frontmatter.cover ? node.frontmatter.cover.childImageSharp.fluid : node.frontmatter.path}
path={node.frontmatter.path}
title={node.frontmatter.title}
date={node.frontmatter.date}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/news.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const News = ({ data }) => {
const { siteMetadata: { pathPrefix } } = data.site;
const realPrefix = pathPrefix === '/' ? '' : pathPrefix;
const { edges } = data.allMarkdownRemark;
console.log("news edges ",edges)

return (
<Layout>
<Helmet title={'News'} />
Expand Down