Как использовать данные из frontmatter в запросе graphql - PullRequest
0 голосов
/ 02 мая 2019

Я хочу использовать данные frontmatter, такие как переменные, в запросе graphql.

>>>frontmatter image width<<< и >>>frontmatter images extra width<<< - это место, куда я хочу, чтобы мои width от frontmatter пошли.

images_extra - это массив, который, я думаю, усложняет проблему

export const imageQuery = graphql`
  query($id: String!) {
    markdownRemark(id: { eq: $id }) {
      frontmatter {
        image {
          source {
            childImageSharp {
              fluid(maxWidth: >>>frontmatter image width<<<, quality: 90) {
                ...GatsbyImageSharpFluid_withWebp
              }
            }
          }
          description
          width
        }
        images_extra {
          source {
            childImageSharp {
              fluid(maxWidth: >>>frontmatter images extra width<<<, quality: 90) {
                ...GatsbyImageSharpFluid_withWebp
              }
            }
          }
          description
          width
        }
        date
        title
      }
    }
  }
`
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...