feed
feed copied to clipboard
Can't create atom1 feed because of: url.replace is not defined
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
Same here
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.
I can't even fix it myself because my fork won't build.
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.
All the others feeds functions work except for atom1() that returns:
for me it happens with rss, atom and json feed
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.