Skip to content

Commit 87927a8

Browse files
authored
Update gatsby-config.js
Signed-off-by: Lee Calcote <leecalcote@gmail.com>
1 parent f6520f3 commit 87927a8

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

gatsby-config.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = {
9595
{
9696
resolve: "gatsby-plugin-feed",
9797
options: {
98-
// 1. GLOBAL QUERY: Runs once. Fetches enough items (1000) to cover all categories.
98+
// 1. GLOBAL QUERY: Runs ONCE. Fetches all heavy data (allMdx).
9999
query: `
100100
{
101101
site {
@@ -112,7 +112,6 @@ module.exports = {
112112
filter: { frontmatter: { published: { eq: true } } }
113113
) {
114114
nodes {
115-
# We fetch HTML instead of body to save memory (assuming your serializer uses html)
116115
html
117116
frontmatter {
118117
title
@@ -143,13 +142,17 @@ module.exports = {
143142
{
144143
output: "/rss.xml",
145144
title: "Layer5 Technical Posts",
145+
// REQUIRED: We add this lightweight query to satisfy the plugin validator.
146+
// The 'allMdx' data from the global query above is merged into this,
147+
// so 'serialize' can still access it.
148+
query: "{ site { siteMetadata { title } } }",
146149
serialize: ({ query: { site, allMdx } }) => {
147150
return allMdx.nodes
148151
.filter((node) =>
149152
["blog", "resources", "news"].includes(node.fields.collection) &&
150153
!["Programs", "Community", "Events", "FAQ"].includes(node.frontmatter.category)
151154
)
152-
.slice(0, 20) // Limit to 20 for the feed
155+
.slice(0, 20)
153156
.map((node) => {
154157
return Object.assign({}, node.frontmatter, {
155158
title: node.frontmatter.title,
@@ -170,6 +173,7 @@ module.exports = {
170173
{
171174
output: "/news/feed.xml",
172175
title: "Layer5 News",
176+
query: "{ site { siteMetadata { title } } }", // Lightweight query
173177
serialize: ({ query: { site, allMdx } }) => {
174178
return allMdx.nodes
175179
.filter((node) => node.fields.collection === "news")
@@ -178,7 +182,7 @@ module.exports = {
178182
return Object.assign({}, node.frontmatter, {
179183
title: node.frontmatter.title,
180184
author: node.frontmatter.author,
181-
description: node.frontmatter.description, // Replaced body with description to save memory, or use node.html
185+
description: node.frontmatter.description,
182186
date: node.frontmatter.date,
183187
url: site.siteMetadata.siteUrl + node.fields.slug,
184188
guid: site.siteMetadata.siteUrl + node.fields.slug,
@@ -194,6 +198,7 @@ module.exports = {
194198
{
195199
output: "/resources/feed.xml",
196200
title: "Layer5 Resources",
201+
query: "{ site { siteMetadata { title } } }", // Lightweight query
197202
serialize: ({ query: { site, allMdx } }) => {
198203
return allMdx.nodes
199204
.filter((node) => node.fields.collection === "resources")
@@ -218,6 +223,7 @@ module.exports = {
218223
{
219224
output: "/rss-contributors.xml",
220225
title: "Layer5 Contributor Feed",
226+
query: "{ site { siteMetadata { title } } }", // Lightweight query
221227
serialize: ({ query: { site, allMdx } }) => {
222228
return allMdx.nodes
223229
.filter((node) => ["blog", "news"].includes(node.fields.collection))
@@ -242,6 +248,7 @@ module.exports = {
242248
{
243249
output: "/meshery-community-feed.xml",
244250
title: "Meshery RSSFeed",
251+
query: "{ site { siteMetadata { title } } }", // Lightweight query
245252
serialize: ({ query: { site, allMdx } }) => {
246253
const targetCategories = ["Meshery", "Announcements", "Events"];
247254
const targetTags = ["Community", "Meshery", "mesheryctl"];
@@ -279,6 +286,7 @@ module.exports = {
279286
{
280287
output: "/blog/feed.xml",
281288
title: "Layer5 Blog",
289+
query: "{ site { siteMetadata { title } } }", // Lightweight query
282290
serialize: ({ query: { site, allMdx } }) => {
283291
return allMdx.nodes
284292
.filter((node) => node.fields.collection === "blog")
@@ -303,6 +311,7 @@ module.exports = {
303311
{
304312
output: "/events/feed.xml",
305313
title: "Layer5 Events",
314+
query: "{ site { siteMetadata { title } } }", // Lightweight query
306315
serialize: ({ query: { site, allMdx } }) => {
307316
return allMdx.nodes
308317
.filter((node) => node.fields.collection === "events")

0 commit comments

Comments
 (0)