From 91a45dea25552ddce39ad052f4e14e6dcc7321c4 Mon Sep 17 00:00:00 2001 From: Aivan Monceller Date: Wed, 12 Apr 2023 23:21:32 +0800 Subject: [PATCH] fix(gatsby-plugin-feed): update documentation and expose custom_namespaces --- packages/gatsby-plugin-feed/README.md | 9 +++++++-- packages/gatsby-plugin-feed/src/plugin-options.js | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/gatsby-plugin-feed/README.md b/packages/gatsby-plugin-feed/README.md index 00179ab1a4e28..70427988b65ba 100644 --- a/packages/gatsby-plugin-feed/README.md +++ b/packages/gatsby-plugin-feed/README.md @@ -48,8 +48,8 @@ module.exports = { nodes { excerpt html - fields { - slug + fields { + slug } frontmatter { title @@ -68,6 +68,10 @@ module.exports = { match: "^/blog/", // optional configuration to specify external rss feed, such as feedburner link: "https://feeds.feedburner.com/gatsby/blog", + // optional to specify custom namespace for node elements + custom_namespaces: { + media: 'http://search.yahoo.com/mrss/', + } }, ], }, @@ -75,6 +79,7 @@ module.exports = { ], } ``` +The GraphQL `query` property located directly under `options` queries `siteMetadata` from `gatsby-config` which contains the `title`, `description`, and `site_url` properties that are used to populate [the `feedOptions` of the `rss` package](https://www.npmjs.com/package/rss#feedoptions). Each feed must include `output`, `query`, `title`, and `serialize`. You'll need to write the `serialize` function in order to fit your use case. diff --git a/packages/gatsby-plugin-feed/src/plugin-options.js b/packages/gatsby-plugin-feed/src/plugin-options.js index 3e56b9ee20bf2..0e93abe0e1208 100644 --- a/packages/gatsby-plugin-feed/src/plugin-options.js +++ b/packages/gatsby-plugin-feed/src/plugin-options.js @@ -9,6 +9,7 @@ const feed = ({ Joi }) => serialize: Joi.func().required(), match: Joi.string(), link: Joi.string(), + custom_namespaces: Joi.object(), }) .unknown(true) .external(({ query }) => {