RSS Feed Generation Implementation for Website Blog

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Blog RSS Feed Generation

Blog RSS feed allows readers to subscribe to new publications. Properly configured feed accelerates search engine indexing and increases audience reach.

Node.js: feed Package

import { Feed } from 'feed';

export async function generateBlogRss(): Promise<string> {
  const feed = new Feed({
    title: 'MyApp Blog',
    description: 'Articles about development and technologies',
    id: 'https://example.com',
    link: 'https://example.com',
    language: 'en',
    image: 'https://example.com/logo.png',
    favicon: 'https://example.com/favicon.ico',
    copyright: `© ${new Date().getFullYear()} MyApp`,
    generator: 'MyApp',
    feedLinks: {
      rss: 'https://example.com/feed',
      atom: 'https://example.com/feed/atom',
      json: 'https://example.com/feed/json',
    },
    author: {
      name: 'MyApp Editorial',
      email: '[email protected]',
      link: 'https://example.com/about',
    },
  });

  const posts = await prisma.post.findMany({
    where: { published: true },
    orderBy: { publishedAt: 'desc' },
    take: 50,
    include: { author: true, tags: true },
  });

  posts.forEach(post => {
    feed.addItem({
      title: post.title,
      id: `https://example.com/blog/${post.slug}`,
      link: `https://example.com/blog/${post.slug}`,
      description: post.excerpt,
      content: post.htmlContent,
      author: [{ name: post.author.name, email: post.author.email }],
      date: post.publishedAt,
      image: post.coverImage || undefined,
      category: post.tags.map(t => ({ name: t.name })),
    });
  });

  return feed.rss2();  // or feed.atom1(), feed.json1()
}

// Express route
app.get('/feed', async (_req, res) => {
  const rss = await generateBlogRss();
  res
    .type('application/rss+xml')
    .set('Cache-Control', 'public, max-age=900')
    .send(rss);
});

Next.js: Static RSS on Build

// scripts/generate-rss.ts
import { writeFileSync } from 'fs';
import { generateBlogRss } from '../lib/rss';

async function main() {
  const rss = await generateBlogRss();
  writeFileSync('./public/feed.xml', rss);
  console.log('RSS generated: public/feed.xml');
}

main();
// package.json
{
  "scripts": {
    "build": "next build && ts-node scripts/generate-rss.ts"
  }
}

Feed Validation

Check feed correctness: validator.w3.org/feed. Tool indicates encoding errors, missing required fields, incorrect dates.

Implementation Timeline

RSS feed for blog on Node.js or Laravel: 0.5 days. With JSON Feed, Atom, caching, and autodiscovery: 1 day.