-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: nurRiyad <[email protected]>
- Loading branch information
Showing
4 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import RSS from 'rss' | ||
import { serverQueryContent } from '#content/server' | ||
|
||
export default defineEventHandler(async (event) => { | ||
const feed = new RSS({ | ||
title: 'Manjaro Linux Official', | ||
description: 'This page provides an overview of Manjaro Linux, an open source operating system designed for ease of use. Learn about its features, installation, and support options. Get the most out of Manjaro Linux with the latest news, downloads, and tips from our helpful community', | ||
site_url: 'https://manjaro.org', | ||
feed_url: `https://manjaro.org/news/feed.xml`, | ||
}) | ||
|
||
const contents = await serverQueryContent(event) | ||
.sort({ date: -1 }) | ||
.where({ _partial: false }) | ||
.find() | ||
|
||
const blogPosts = contents.filter(doc => doc?._path?.includes('/news')) | ||
for (const doc of blogPosts) { | ||
feed.item({ | ||
title: doc.title ?? '-', | ||
url: `https://manjaro.org${doc._path}`, | ||
date: doc.date, | ||
description: doc.description, | ||
enclosure: { | ||
url: `https://manjaro.org${doc._path}/${doc.image}`, | ||
type: 'image/jpeg', | ||
}, | ||
}) | ||
} | ||
|
||
const feedString = feed.xml({ indent: true }) | ||
event.node.res.setHeader('content-type', 'text/xml') | ||
event.node.res.end(feedString) | ||
}) |