Git Product home page Git Product logo

Comments (8)

brandonweiss avatar brandonweiss commented on June 16, 2024

I just tried this plugin and I think I ran into this bug. My siteUrl is "https://anti-pattern.com" but the URL is mangled in two places (that I can see).

In the JSON feed the feed_url is "https:/anti-pattern.com/feed.json/.json".

In the XML feed the image.url is "https:/anti-pattern.com/image.png".

from gatsby-plugin-feed-generator.

markmichon avatar markmichon commented on June 16, 2024

@brandonweiss Any chance you could provide the config that is causing this?

from gatsby-plugin-feed-generator.

brandonweiss avatar brandonweiss commented on June 16, 2024

@markmichon Of course!

siteMetadata: {
  author: "Brandon Weiss",
  description: "description",
  title: "Anti-pattern",
  siteUrl: "https://anti-pattern.com",
},
plugins: [
  {
    resolve: "gatsby-plugin-feed-generator",
    options: {
      rss: true,
      json: true,
      siteQuery: `
        {
          site {
            siteMetadata {
              author
              description
              title
              siteUrl
            }
          }
        }
      `,
      feeds: [
        {
          name: "feed",
          query: `
          {
            allMdx(sort: { fields: [frontmatter___date], order: DESC }) {
              edges {
                node {
                  html
                  fields {
                    slug
                  }
                  frontmatter {
                    date
                    title
                    description
                  }
                }
              }
            }
          }
        `,
          normalize: ({ query: { site, allMdx } }) => {
            return allMdx.edges.map(({ node: post }) => {
              return {
                date: post.frontmatter.date,
                html: post.html,
                title: post.frontmatter.title,
                url: site.siteMetadata.siteUrl + post.fields.slug,
              }
            })
          },
        },
      ],
    },
  },
],

I didn’t think to include it because it seemed like a standard/default config, but maybe there’s something unusual I’m doing.

from gatsby-plugin-feed-generator.

markmichon avatar markmichon commented on June 16, 2024

@brandonweiss Thanks! Yeah nothing looks out of the ordinary there.

Should be resolved now. Let me know if you run into any issues. I couldn't duplicate it, but I suspect it had to do with trailing slashes. 2.0.1 handles that issue.

from gatsby-plugin-feed-generator.

brandonweiss avatar brandonweiss commented on June 16, 2024

@markmichon Thanks! The backslash issue seems to be fixed, although the extension on feed_url still seems to be doubled. It’s showing as "https://anti-pattern.com/feed.json.json".

from gatsby-plugin-feed-generator.

brandonweiss avatar brandonweiss commented on June 16, 2024

Ah yeah, the extension is being added in two places.

name: `${feed.name}.json`,

json: urlJoin(siteUrl, name).replace(/\/+$/, '') + '.json',
rss: urlJoin(siteUrl, name).replace(/\/+$/, '') + '.xml',

I’d normally open a PR but I’m not sure exactly where you’d prefer to do the appending.

from gatsby-plugin-feed-generator.

markmichon avatar markmichon commented on June 16, 2024

Alright. Latest release on npm has it taken care of. Thanks for keeping things in check 👍

from gatsby-plugin-feed-generator.

brandonweiss avatar brandonweiss commented on June 16, 2024

Thanks for fixing it so quickly! ❤️

from gatsby-plugin-feed-generator.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.