Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions lib/views/atom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import type { FC } from 'hono/jsx';
import type { Data } from '@/types';

const RSS: FC<{ data: Data }> = ({ data }) => (
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:rsshub="http://rsshub.app/xml/schemas">
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:rsshub="http://rsshub.app/xml/schemas" xml:lang={data.language || 'en'}>
Copy link
Contributor Author

@ouuan ouuan Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should only set the attribute if it's not undefined? Perhaps also for RSS?

<title>{data.title || 'RSSHub'}</title>
<link href={data.link || 'https://docs.rsshub.app'} />
<link rel="alternate" href={data.link || 'https://docs.rsshub.app'} />
<link rel="self" href={data.atomlink} type="application/atom+xml" />
<id>{data.id || data.link}</id>
<subtitle>{data.description || data.title} - Powered by RSSHub</subtitle>
<generator>RSSHub</generator>
<webMaster>[email protected] (RSSHub)</webMaster>
<language>{data.language || 'en'}</language>
<updated>{data.lastBuildDate}</updated>
<updated>{new Date(data.lastBuildDate || new Date()).toISOString()}</updated>
<author>
<name>{data.author || 'RSSHub'}</name>
</author>
Expand All @@ -21,13 +20,11 @@ const RSS: FC<{ data: Data }> = ({ data }) => (
{data.item?.map((item) => (
<entry>
<title>{item.title}</title>
<content type="html" src={item.link}>
{item.description}
</content>
<content type="html">{item.description}</content>
<link href={item.link} />
<id>{item.guid || item.link || item.title}</id>
{item.pubDate && <published>{item.pubDate}</published>}
{item.updated && <updated>{item.updated || item.pubDate}</updated>}
{item.pubDate && <published>{new Date(item.pubDate).toISOString()}</published>}
<updated>{new Date(item.updated || item.pubDate || new Date()).toISOString()}</updated>
{item.author && (
<author>
<name>{item.author}</name>
Expand Down
Loading