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

Missing atom:link with rel="self" #172

Open SiqueiraX opened 2 years ago

SiqueiraX commented 2 years ago

image

My code

` //feed const feed = new Feed ({ title: "Semente Feed", description: "O Feed RSS da Semente da Liberdade!", id: "https://sementedaliberdade.com.br/", link: "https:sementedaliberdade.com.br/", language: "pt-BR", image: "https://sementedaliberdade.com.br/images/SDL-05.png", favicon: "https://sementedaliberdade.com.br/images/SDL-05.png", update: new Date(), generator: "awesome", feedLinks: { json: "https://sementedaliberdade.com.br/json", atom: "https://sementedaliberdade.com.br/atom" } })

app.get("/feed", (req, res) => { Post.find({approved: true}).lean().then((posts) => { posts.forEach(post => { feed.addItem({ title: post.title, id: "https://sementedaliberdade.com.br/article/" + post.slug, link: "https://sementedaliberdade.com.br/article/" + post.slug, description: "Mais um artigo da Semente da Liberdade!", content: post.content, date: post.date, image: "https://sementedaliberdade.com.br/uploads/images/" + post.img }) }) res.set('Content-Type', 'text/xml') res.send(feed.rss2()) })

app.get("/atom", (req, res) => { res.set('Content-Type', 'text/xml') res.send(feed.atom1()); });

app.get("/json", (req, res) => { res.set('Content-Type', 'text/xml') res.send(feed.json1()); }); `

sking-cais commented 2 years ago

I was looking for this as well and discovered that it's derived from using either feed or feedLinks.rss.

Example:

const feed = new Feed({
  ...
  feedLinks: {
    rss: 'https://....'
  },
  feed: 'https://....'
})

See https://github.com/jpmonette/feed/blob/34dbde9aa47b85ae207ba4fefe4c5794b8ca43e2/src/rss2.ts#L81