gatsby-starter-prismic icon indicating copy to clipboard operation
gatsby-starter-prismic copied to clipboard

Anyone know how to setup this starter with gatsby-plugin-feed properly?

Open sparklesam opened this issue 5 years ago • 2 comments

This is still work in progress, as i experience difficulties hooking up the slicezone with the feed custom content part. Great if there are anyone to help!

{
      resolve: "gatsby-plugin-feed",
      options: {
        setup(ref) {
          const ret = ref.query.site.siteMetadata;
          ret.allPrismicPost = ref.query.allPrismicPost;
          ret.generator = "GatsbyJS Material Starter";
          return ret;
        },
        query: `
        {
          site {
            siteMetadata {
              author
              siteUrl
              title
              description
            }
          }
        }
      `,
        feeds: [
          {
            serialize(ctx) {
              const { rssMetadata } = ctx.query.site.siteMetadata;
              return ctx.query.allPrismicPost.edges.map(edge => ({
                date: edge.node.data.date,
                title: edge.node.data.title.text,
                description: edge.node.data.body[0].primary.text.text,
              }));
            },
            query: `
            {
              allPrismicPost(sort: { fields: [data___date], order: DESC }) {
                edges {
                  node {
                    uid
                    data {
                      feature {
                        url
                        localFile {
                          childImageSharp {
                            sizes(maxWidth: 1280) {
                              aspectRatio
                              src
                              srcSet
                              srcWebp
                              srcSetWebp
                              sizes
                            }
                          }
                        }
                       }
                      title {
                        text
                      }
                      url {
                        url
                      }
                      body {
                        ... on PrismicPostBodyText {
                          slice_type
                          id
                          primary {
                            text {
                              html
                              text
                            }
                          }
                        }
                      }
                      date(formatString: "DD.MM.YYYY")
                    }
                  }
                }
              }
            }
          `,
            output: "/rss.xml",
            title: "Your Site's RSS Feed",
          }
        ]
      },
    },```

sparklesam avatar May 13 '19 14:05 sparklesam

Were you able to figure it out yourself or do you need guidance?

LekoArts avatar Jul 03 '19 10:07 LekoArts

I'm still stuck in mapping the slice-zone. Guidance is appreciated! much thanks!!

sparklesam avatar Jul 03 '19 13:07 sparklesam