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

RSS Feed #3

Open
ganevdev opened this issue Nov 19, 2019 · 2 comments
Open

RSS Feed #3

ganevdev opened this issue Nov 19, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@ganevdev
Copy link
Member

With https://www.npmjs.com/package/gatsby-plugin-feed

@ganevdev ganevdev added the enhancement New feature or request label Nov 19, 2019
@reallymello
Copy link
Collaborator

reallymello commented Feb 18, 2020

I think I got it working with gatsby-plugin-feed-mdx though I am not sure if I am misusing it. The only issue is that the plugin creates entries for "Ghost Post" and creates untitled entries based on some of the other layout pages.

{
        resolve: `gatsby-plugin-feed-mdx`,
        options: {
          query: `
            {
              site {
                siteMetadata {
                  siteTitle
                  siteDescription
                  siteUrl
                  site_url: siteUrl
                }
              }
            }
          `,
          feeds: [
            {
              serialize: ({ query: { site, allMdx } }) => {
                return allMdx.edges.map(edge => {
                  return Object.assign({}, edge.node.frontmatter, {
                    description: edge.node.excerpt,
                    date: edge.node.frontmatter.date,
                    url: site.siteMetadata.siteUrl + edge.node.fields.slug
                  });
                });
              },
              query: `
                {
                  allMdx(
                    sort: { order: DESC, fields: [frontmatter___date] },
                  ) {
                    edges {
                      node {
                        excerpt
                        html
                        fields { slug }
                        frontmatter {
                          title
                          date
                        }
                      }
                    }
                  }
                }
              `,
              output: "/rss.xml",
              title: "Site title here"
            }
          ]
        }
      }

@sigstart
Copy link

sigstart commented Jul 5, 2020

I think I got it working with gatsby-plugin-feed-mdx though I am not sure if I am misusing it. The only issue is that the plugin creates entries for "Ghost Post" and creates untitled entries based on some of the other layout pages.

This is something I want to add to my site as well. Is it possible to filter on the draft and hide fields of frontmatter so that the query doesn't return any posts if either field is false?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants