Skip to content

Refactor gatsby-config.js for improved configuration#7601

Merged
leecalcote merged 1 commit intomasterfrom
leecalcote-patch-1
Apr 8, 2026
Merged

Refactor gatsby-config.js for improved configuration#7601
leecalcote merged 1 commit intomasterfrom
leecalcote-patch-1

Conversation

@leecalcote
Copy link
Copy Markdown
Member

Updated site metadata and plugin configurations for Gatsby setup. Removed unused code and adjusted feed settings for better performance.

Description

This PR fixes #

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Updated site metadata and plugin configurations for Gatsby setup. Removed unused code and adjusted feed settings for better performance.

Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Copilot AI review requested due to automatic review settings April 8, 2026 18:18
@leecalcote leecalcote merged commit 133d680 into master Apr 8, 2026
3 of 4 checks passed
@leecalcote leecalcote deleted the leecalcote-patch-1 branch April 8, 2026 18:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Refactors gatsby-config.js by simplifying build profile logic, revising plugin configuration, and expanding RSS feed definitions.

Changes:

  • Removed previous “lite build” collection-exclusion logic and added a new blog-only dev profile driven by env vars.
  • Reworked RSS feed setup with multiple feeds + updated GraphQL queries/serialization.
  • Restructured filesystem sourcing to explicitly list collections and adjusted several plugin/flag settings.

Comment on lines +111 to +136
serialize: ({ query: { site, allPosts } }) => {
return allPosts.nodes.map((node) => {
return Object.assign({}, node.frontmatter, {
title: node.frontmatter.title,
author: node.frontmatter.author,
description: node.frontmatter.description,
date: node.frontmatter.date,
url: site.siteMetadata.siteUrl + node.fields.slug,
guid: site.siteMetadata.siteUrl + node.fields.slug,
enclosure: node.frontmatter.thumbnail && {
url:
site.siteMetadata.siteUrl +
node.frontmatter.thumbnail.publicURL,
},
custom_elements: [{ "content:encoded": node.html }],
});
});
},
query: `{
allPosts: allMdx(
sort: {frontmatter: {date: DESC}}
filter: {fields: {collection: {in: ["blog", "resources", "news"]}}, frontmatter: {published: {eq: true}, category: {nin: ["Programs", "Community", "Events", "FAQ"]}}}
limit: 20
) {
nodes {
body
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The feed serializer uses node.html, but the query only selects body (and MDX nodes typically don’t expose an html field). This will likely produce empty/undefined content:encoded in the RSS output. Fix by either selecting the correct field that exists on your MDX nodes for RSS content (and using that consistently), or changing custom_elements to use the queried field (body/excerpt) and ensuring it’s in the desired format for RSS readers.

Copilot uses AI. Check for mistakes.
site.siteMetadata.siteUrl +
node.frontmatter.thumbnail.publicURL,
},
custom_elements: [{ "content:encoded": node.html }],
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

This feed mixes description: node.body with content:encoded: node.html, but node.html is not queried (and may not exist for MDX). Unify on a single, valid field for both description and content:encoded (and make sure the GraphQL query selects that field). As-is, content:encoded is likely undefined.

Suggested change
custom_elements: [{ "content:encoded": node.html }],
custom_elements: [{ "content:encoded": node.body }],

Copilot uses AI. Check for mistakes.
overrides: {
// or disable plugins
inlineStyles: false,
cleanupIds: false,
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The previous config explicitly disabled SVGO’s removeViewBox which prevents responsive SVGs from breaking. With that override removed, preset-default may strip viewBox again, which can break scaling/responsiveness of icons/logos. Re-add an override to keep viewBox (e.g., removeViewBox: false) if the site relies on responsive SVG sizing.

Suggested change
cleanupIds: false,
cleanupIds: false,
removeViewBox: false,

Copilot uses AI. Check for mistakes.
{
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
options: {
disable: true,
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The bundle analyzer plugin is now always present but permanently disabled, which makes it unusable even when you want to analyze a build. Recommend wiring disable to an env flag (e.g., disabled unless process.env.ANALYZE_BUNDLE is set) or restoring the prior conditional plugin inclusion so the analyzer can be enabled on-demand without modifying config.

Suggested change
disable: true,
disable: !process.env.ANALYZE_BUNDLE,

Copilot uses AI. Check for mistakes.
resolve: "gatsby-plugin-styled-components",
options: {
minify: true,
minify: false,
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

Disabling styled-components minification can increase JS/CSS payload size in production and negatively impact Core Web Vitals. If this is intended only for development/debugging, consider toggling minify based on environment (e.g., enabled in production).

Suggested change
minify: false,
minify: process.env.NODE_ENV === "production",

Copilot uses AI. Check for mistakes.
Comment on lines +476 to +477
"gatsby-plugin-sharp",
"gatsby-transformer-sharp",
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

gatsby-plugin-sharp / gatsby-transformer-sharp are included here as string plugins, but later in the file they’re also added again with explicit options. Including the same plugin twice can lead to duplicate work and confusing/undefined option precedence. Keep only the configured instances (or only the string entries), but not both.

Suggested change
"gatsby-plugin-sharp",
"gatsby-transformer-sharp",

Copilot uses AI. Check for mistakes.
name: "collections",
ignore: collectionIgnoreGlobs,
name: "images",
path: `${__dirname}/src/assets/images`,
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The prior images filesystem source had an ignore list to avoid ingesting heavy/unneeded directories and file types (notably **/*.svg and several large subtrees). Removing those ignores can significantly increase node creation time and memory usage during builds. Consider restoring the previous ignore patterns (or an equivalent scoped set) to keep sourcing performant.

Suggested change
path: `${__dirname}/src/assets/images`,
path: `${__dirname}/src/assets/images`,
ignore: ["**/*.svg"],

Copilot uses AI. Check for mistakes.
Comment on lines +631 to +636
{
resolve: "gatsby-plugin-purgecss",
options: {
printRejected: true,
}
},
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

gatsby-plugin-purgecss is now always enabled (it was previously production-only). Running PurgeCSS during development commonly causes confusing styling issues with dynamic class names and slows dev builds. Consider restricting it to production builds (or using a config that disables it in development) to avoid dev-time regressions.

Suggested change
{
resolve: "gatsby-plugin-purgecss",
options: {
printRejected: true,
}
},
...(process.env.NODE_ENV === "production"
? [
{
resolve: "gatsby-plugin-purgecss",
options: {
printRejected: true,
},
},
]
: []),

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants