Сайт для студии подкастов.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
blogbaster/lib/generateRSS.js

29 lines
832 B

import { writeFileSync } from "fs";
import { getAllPosts } from "./posts";
import RSS from "rss";
const post = [{title:'ddee', url:'dfdf', date:'12.12.22', description:'dfdf dfdf dfdf'}]
export default async function getRSS() {
const siteURL = "https://yourdomain.com";
const allBlogs = getAllPosts();
const feed = new RSS({
title: "Your Name",
description: "your description",
site_url: siteURL,
feed_url: `${siteURL}/feed.xml`,
language: "en",
pubDate: new Date(),
copyright: `All rights reserved ${new Date().getFullYear()}, Your Name`,
});
post.map((post) => {
feed.item({
title: post.title,
url: `${siteURL}/blogs/${post.slug}`,
date: post.date,
description: post.excerpt,
});
});
writeFileSync("../../public/feed.xml", feed.xml({ indent: true }));
}