feat: add "enclosure" and "author" attributes for the RSS feed
This commit is contained in:
parent
ae6cc2ff44
commit
489dbaaf63
1 changed files with 8 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import RSS from "rss";
|
import RSS from "rss";
|
||||||
import { client } from "@/lib/sanity";
|
import { client, urlFor } from "@/lib/sanity";
|
||||||
import { toHTML } from "@portabletext/to-html";
|
import { toHTML } from "@portabletext/to-html";
|
||||||
|
|
||||||
export const dynamic = "force-static";
|
export const dynamic = "force-static";
|
||||||
|
@ -37,10 +37,13 @@ export async function GET() {
|
||||||
title: post.title,
|
title: post.title,
|
||||||
description: toHTML(post.content),
|
description: toHTML(post.content),
|
||||||
url: `${SITE_URL}/blog/${post.slug}`,
|
url: `${SITE_URL}/blog/${post.slug}`,
|
||||||
date: new Date(post._createdAt).toUTCString()
|
date: new Date(post._createdAt).toUTCString(),
|
||||||
// uncomment this if u want to
|
enclosure: {
|
||||||
// enclosure: { url: urlFor(post.titleImage).url() },
|
url: post.titleImage
|
||||||
// author: "SVR.JS",
|
? urlFor(post.titleImage).url()
|
||||||
|
: `${SITE_URL}/blog-missing.png`
|
||||||
|
},
|
||||||
|
author: "SVR.JS"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue