feat(core): add summary field support for atom and json feed (#22758)
* fix(core): summary field in json feed * feat(core): add summary field to atom * test: update json view test to match the new summary field
This commit is contained in:
@@ -50,6 +50,7 @@ export type DataItem = {
|
||||
html: string;
|
||||
text: string;
|
||||
};
|
||||
summary?: string;
|
||||
image?: string;
|
||||
banner?: string;
|
||||
updated?: number | string | Date;
|
||||
|
||||
@@ -22,6 +22,7 @@ describe('Atom view', () => {
|
||||
description: 'Entry One',
|
||||
pubDate: '2024-01-01T00:00:00Z',
|
||||
updated: '2024-01-02T00:00:00Z',
|
||||
summary: 'Entry One',
|
||||
author: 'Author One',
|
||||
category: 'News',
|
||||
media: {
|
||||
|
||||
@@ -25,6 +25,7 @@ const RSS: FC<{ data: Data }> = ({ data }) => (
|
||||
<id>{item.guid || item.link || item.title}</id>
|
||||
{item.pubDate && <published>{new Date(item.pubDate).toISOString()}</published>}
|
||||
<updated>{new Date(item.updated || item.pubDate || new Date()).toISOString()}</updated>
|
||||
{item.summary && <summary>{item.summary}</summary>}
|
||||
{item.author && (
|
||||
<author>
|
||||
<name>{item.author}</name>
|
||||
|
||||
@@ -16,7 +16,7 @@ describe('JSON view', () => {
|
||||
{
|
||||
title: 'Item One',
|
||||
link: 'https://example.com/one',
|
||||
description: 'Entry One',
|
||||
summary: 'Entry One',
|
||||
guid: 'guid-1',
|
||||
content: {
|
||||
html: '<p>hello</p>',
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ const json = (data: Data) => {
|
||||
// content_html and content_text are each optional strings — but one or both must be present
|
||||
content_html: (item.content && item.content.html) || item.description || item.title,
|
||||
content_text: item.content && item.content.text,
|
||||
summary: item.description,
|
||||
summary: item.summary,
|
||||
image: item.image || item.itunes_item_image,
|
||||
banner_image: item.banner,
|
||||
date_published: item.pubDate,
|
||||
|
||||
Reference in New Issue
Block a user