jpmonette / feed

A RSS, Atom and JSON Feed generator for Node.js, making content syndication simple and intuitive! 🚀
https://github.com/jpmonette/feed
MIT License
1.18k stars 197 forks source link

Can't create atom1 feed because of: url.replace is not defined #169

Open RenatoCesarF opened 2 years ago

RenatoCesarF commented 2 years ago

Here's my code:

  const files = fs.readdirSync(path.join('posts'));

  files.map((filename) => {
    const slug = filename.replace('.md', '');
    const markdownWithMeta = fs.readFileSync(path.join('posts', filename), 'utf-8');
    const {data, content} = matter(markdownWithMeta);
    const maximumExcerptSize = 80
    if(data.excerpt.length > maximumExcerptSize){
        data.excerpt = data.excerpt.substr(0, maximumExcerptSize) + '...';
    } 
    const url = `${baseUrl}/${slug}`;
    const item: Item = {
      title: data.title,
      image: data.cover_image,
      link: url.toString(),
      date: new Date(),
      id: slug,
      description: data.excerpt,
      content:  data.content,
      author: [data.author],
      contributor: [author],
    }
    feed.addItem(item);
  });

All the others feeds functions work except for atom1() that returns: error - TypeError: url.replace is not a function

My first ideas was that some url paramter was in another format, so I transformed it to string, but the error continues.

If I remove the add item code the error desapears

bitdom8 commented 2 years ago

Same here

auroraanna commented 1 year ago

I don't even understand what's wrong in the code. url has to be if type string, right? So url.replace() has to exist according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace.

auroraanna commented 1 year ago

I can't even fix it myself because my fork won't build.

auroraanna commented 1 year ago

Are there any forks that fixed this issue? I feel like this package is not properly maintained anymore. The last release to npm was 2 years ago.

auroraanna commented 1 year ago

All the others feeds functions work except for atom1() that returns:

for me it happens with rss, atom and json feed

ZackBoe commented 1 year ago

Please don't leave several rapid fire comments on GitHub when they could be condensed to a single one - each one triggers an email to whoever is involved or subscribed to the issue.