diff --git a/.changeset/tricky-eyes-know.md b/.changeset/tricky-eyes-know.md
new file mode 100644
index 00000000..f1270776
--- /dev/null
+++ b/.changeset/tricky-eyes-know.md
@@ -0,0 +1,7 @@
+---
+'@wpmedia/rss-feature-block': minor
+'@wpmedia/rss-google-news-feature-block': minor
+'@wpmedia/feeds-prop-types': minor
+---
+
+Added itemCredits customField
diff --git a/blocks/rss-feature-block/features/rss/__snapshots__/xml.test.js.snap b/blocks/rss-feature-block/features/rss/__snapshots__/xml.test.js.snap
index e043669e..352aeaf3 100644
--- a/blocks/rss-feature-block/features/rss/__snapshots__/xml.test.js.snap
+++ b/blocks/rss-feature-block/features/rss/__snapshots__/xml.test.js.snap
@@ -29,7 +29,7 @@ Object {
"content:encoded": Object {
"$": "
try singing the happy birthday song
be sure to wash your thumbs
",
},
- "dc:creator": "John Smith,Jane Doe",
+ "dc:creator": "john-smith,jane-doe",
"description": Object {
"$": "This is from the subheadlines",
},
diff --git a/blocks/rss-feature-block/features/rss/xml.js b/blocks/rss-feature-block/features/rss/xml.js
index a3a70a63..b22eea9f 100644
--- a/blocks/rss-feature-block/features/rss/xml.js
+++ b/blocks/rss-feature-block/features/rss/xml.js
@@ -28,6 +28,7 @@ const rssTemplate = (
itemTitle,
itemDescription,
pubDate,
+ itemCredits,
itemCategory,
includePromo,
includeContent,
@@ -91,7 +92,7 @@ const rssTemplate = (
'#': url,
'@isPermaLink': true,
},
- ...((author = jmespath.search(s, 'credits.by[].name')) &&
+ ...((author = jmespath.search(s, itemCredits)) &&
author && {
'dc:creator': author.join(','),
}),
diff --git a/blocks/rss-feature-block/features/rss/xml.test.js b/blocks/rss-feature-block/features/rss/xml.test.js
index 70a405db..ee7c7f1d 100644
--- a/blocks/rss-feature-block/features/rss/xml.test.js
+++ b/blocks/rss-feature-block/features/rss/xml.test.js
@@ -16,7 +16,12 @@ const articles = {
credits: { by: [{ name: 'Harold Hands' }] },
},
},
- credits: { by: [{ name: 'John Smith' }, { name: 'Jane Doe' }] },
+ credits: {
+ by: [
+ { name: 'John Smith', _id: 'john-smith' },
+ { name: 'Jane Doe', _id: 'jane-doe' },
+ ],
+ },
headlines: { basic: 'Tips for Safe Hand washing' },
description: { basic: 'Tips to keep you wash for 20 seconds' },
subheadlines: { basic: 'This is from the subheadlines' },
@@ -50,6 +55,7 @@ it('returns RSS template with default values', () => {
itemTitle: 'headlines.basic',
itemDescription: 'description.basic',
pubDate: 'display_date',
+ itemCredits: 'credits.by[].name',
itemCategory: '',
includePromo: true,
@@ -90,6 +96,7 @@ it('returns RSS template with custom values', () => {
itemTitle: 'headlines.seo || headlines.basic',
itemDescription: 'subheadlines.basic || description.basic',
pubDate: 'display_date',
+ itemCredits: 'credits.by[]._id',
itemCategory: 'taxonomy.primary_section.name',
includePromo: true,
diff --git a/blocks/rss-google-news-feature-block/features/google-news-rss/__snapshots__/xml.test.js.snap b/blocks/rss-google-news-feature-block/features/google-news-rss/__snapshots__/xml.test.js.snap
index a639ffa1..cb922496 100644
--- a/blocks/rss-google-news-feature-block/features/google-news-rss/__snapshots__/xml.test.js.snap
+++ b/blocks/rss-google-news-feature-block/features/google-news-rss/__snapshots__/xml.test.js.snap
@@ -88,7 +88,6 @@ Object {
"content:encoded": Object {
"$": "try singing the happy birthday song
be sure to wash your thumbs
test caption",
},
- "dc:creator": "John Smith,Jane Doe",
"description": Object {
"$": "This is from the subheadlines",
},
diff --git a/blocks/rss-google-news-feature-block/features/google-news-rss/xml.js b/blocks/rss-google-news-feature-block/features/google-news-rss/xml.js
index 9b571515..8b1bd332 100644
--- a/blocks/rss-google-news-feature-block/features/google-news-rss/xml.js
+++ b/blocks/rss-google-news-feature-block/features/google-news-rss/xml.js
@@ -28,6 +28,7 @@ const rssTemplate = (
itemTitle,
itemDescription,
pubDate,
+ itemCredits,
itemCategory,
includeContent,
resizerURL,
@@ -88,7 +89,7 @@ const rssTemplate = (
'#': url,
'@isPermaLink': true,
},
- ...((author = jmespath.search(s, 'credits.by[].name')) &&
+ ...((author = jmespath.search(s, itemCredits)) &&
author && {
'dc:creator': author.join(','),
}),
diff --git a/blocks/rss-google-news-feature-block/features/google-news-rss/xml.test.js b/blocks/rss-google-news-feature-block/features/google-news-rss/xml.test.js
index 7700c5c8..e64a0454 100644
--- a/blocks/rss-google-news-feature-block/features/google-news-rss/xml.test.js
+++ b/blocks/rss-google-news-feature-block/features/google-news-rss/xml.test.js
@@ -16,7 +16,12 @@ const articles = {
credits: { by: [{ name: 'Harold Hands' }] },
},
},
- credits: { by: [{ name: 'John Smith' }, { name: 'Jane Doe' }] },
+ credits: {
+ by: [
+ { _id: 'john-smith', name: 'John Smith' },
+ { _id: 'jane-doe', name: 'Jane Doe' },
+ ],
+ },
headlines: { basic: 'Tips for Safe Hand washing' },
description: { basic: 'Tips to keep you wash for 20 seconds' },
subheadlines: { basic: 'This is from the subheadlines' },
@@ -58,6 +63,7 @@ it('returns Google News template with default values', () => {
itemTitle: 'headlines.basic',
itemDescription: 'description.basic',
pubDate: 'display_date',
+ itemCredits: 'credits.by[].name',
itemCategory: '',
imageTitle: 'title',
@@ -97,6 +103,7 @@ it('returns RSS template with custom values', () => {
itemTitle: 'headlines.seo || headlines.basic',
itemDescription: 'subheadlines.basic || description.basic',
pubDate: 'display_date',
+ itemCredits: 'credits.by._id',
itemCategory: 'taxonomy.primary_section.name',
includePromo: true,
diff --git a/utils/prop-types/src/__snapshots__/props.test.js.snap b/utils/prop-types/src/__snapshots__/props.test.js.snap
index 35438ff9..94b95e16 100644
--- a/utils/prop-types/src/__snapshots__/props.test.js.snap
+++ b/utils/prop-types/src/__snapshots__/props.test.js.snap
@@ -149,6 +149,15 @@ Object {
},
"type": "string",
},
+ "itemCredits": Object {
+ "tags": Object {
+ "defaultValue": "credits.by[].name",
+ "description": "ANS value for credits in the tag, will join multiple names with a comma. defaults to credits.by[].name",
+ "group": "Item",
+ "label": "ANS credits key",
+ },
+ "type": "string",
+ },
"itemDescription": Object {
"tags": Object {
"defaultValue": "description.basic",
diff --git a/utils/prop-types/src/propInfo.js b/utils/prop-types/src/propInfo.js
index 491a1252..9d42c8b0 100644
--- a/utils/prop-types/src/propInfo.js
+++ b/utils/prop-types/src/propInfo.js
@@ -195,6 +195,16 @@ export const propInfo = {
defaultValue: 'display_date',
},
},
+ itemCredits: {
+ type: 'string',
+ tag: {
+ label: 'ANS credits key',
+ group: 'Item',
+ description:
+ 'ANS value for credits in the tag, will join multiple names with a comma. defaults to credits.by[].name',
+ defaultValue: 'credits.by[].name',
+ },
+ },
itemCategory: {
type: 'string',
tag: {