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

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

Open
RenatoCesarF opened this issue Jan 13, 2022 · 6 comments
Open

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

RenatoCesarF opened this issue Jan 13, 2022 · 6 comments

Comments

@RenatoCesarF
Copy link

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
Copy link

bitdom8 commented Apr 6, 2022

Same here

@auroraanna
Copy link

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
Copy link

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

@auroraanna
Copy link

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
Copy link

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

for me it happens with rss, atom and json feed

@ZackBoe
Copy link

ZackBoe commented Jun 1, 2023

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.

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

No branches or pull requests

4 participants