Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking(gatsby-plugin-sitemap): vNext rewrite #25670

Merged
merged 69 commits into from
Apr 19, 2021

Conversation

moonmeister
Copy link
Contributor

@moonmeister moonmeister commented Jul 10, 2020

Description

Re-write of gatsby-plugin-sitemap to fix the spaghetti and improve the API. Mostly follows #22757, has some slight deviations where the spec needed more or i realized there was a better way. I'll make more notes as it gets closer to being ready.

TODO:

  • more complete Testing before release
  • Add activity bars for sitemap
  • remove logic for disabled options schema validation now that it's shipped
  • allow serialize(or other functions) to be async
  • improve page filtering performance

Related Issues

closes #22757

@moonmeister moonmeister requested a review from a team as a code owner July 10, 2020 05:15
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 10, 2020
@moonmeister moonmeister marked this pull request as draft July 10, 2020 05:15
@gatsby-cloud-staging

This comment has been minimized.

@TylerBarnes TylerBarnes removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 10, 2020
@moonmeister moonmeister changed the title feat: initial commit of re-write (plugin-sitemap): vNext rewrite Jul 10, 2020
@gatsby-cloud

This comment has been minimized.

@gatsby-cloud

This comment has been minimized.

@gatsby-cloud

This comment has been minimized.

@gatsby-cloud-staging

This comment has been minimized.

@gatsby-cloud

This comment has been minimized.

@moonmeister
Copy link
Contributor Author

#28742 just updated the e2e runner so that's been resolved. This is ready to merge assuming all is green.

@moonmeister moonmeister added the breaking change If implemented, this proposed work would break functionality for older versions of Gatsby label Dec 29, 2020
@wardpeet
Copy link
Contributor

Thanks for waiting @moonmeister I'll merge it this week, have to do a couple of tests but code looks awesome!

@moonmeister
Copy link
Contributor Author

@wardpeet Don't mean to push, take your time for any final release, but if these tests pass could you at-least update the @next version we published previously? Thanks.

@moonmeister
Copy link
Contributor Author

Changes look good to me ward. Thanks.

* master: (183 commits)
  chore(gatsby-plugin-image): Remove version note (#30758)
  docs: retire 'How to Create Pages' stub and Recipes landing page (#30842)
  chore(docs): Fix typo (#30858)
  docs: fix invalid mailto links in 3.3 release notes (#30862)
  docs: release notes for 3.3 (#30837)
  fix(gatsby-source-wordpress): invalidate less queries during previews (#30770)
  fix(gatsby-starter-wordpress-blog): Fix altText (#30832)
  feat(contentful): warn users when using restricted content type names (#30715)
  Refactor: using-contentful to use gatsby-plugin-image exclusively (#30717)
  chore(gatsby-plugin-styled-components): Remove breaking changes section (#30806)
  fix(gatsby): webpack warnings are no longer in object format by default (#30801)
  fix(gatsby): Decode base path in runtime (#30682)
  fix(gatsby): "Cannot find module 'babel-preset-gatsby'" error (#30813)
  handle plugin parentDir resolution in resolvePlugin() (#30812)
  Port using-gatsby-image site to image plugin (#28489)
  fix(gatsby-source-contentful): De-dupe type names (#30834)
  feat(gatsby): Add aggregation resolvers (#30789)
  fix(gatsby-core-utils): fetch-remote-file download failure when missing content-length header (#30810)
  fix(renovate): add breaking minor updates to major updates list (#30676)
  chore(docs): Update migration guide for plugins that support both v2 & v3 (#30825)
  ...
@moonmeister
Copy link
Contributor Author

As shown by all the folks over at #29810 and #22757 this update is in demand, can we get this merged? thanks!

@moonmeister
Copy link
Contributor Author

@KyleAMathews what can we do to get this merged?

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

Thanks for waiting, I was on vacation. I'll merge it in and publish a @next version for it!

Thanks a bunch @moonmeister

@wardpeet wardpeet merged commit 3d65a1c into master Apr 19, 2021
@wardpeet wardpeet deleted the moonmeister/feat/sitemap-rewrite branch April 19, 2021 12:24
@moonmeister
Copy link
Contributor Author

Thanks @wardpeet!

@t2ca
Copy link
Contributor

t2ca commented Apr 28, 2021

Just want to let you know that when I tried this with just the minimal configuration, i got the following error

"gatsby-plugin-sitemap" threw an error while running the onPostBuild lifecycle:

Body must be a string. Received: undefined.

  38 |             output = _ref2.output, entryLimit = _ref2.entryLimit, query = _ref2.query, excludes =
_ref2.excludes, resolveSiteUrl = _ref2.resolveSiteUrl, resolvePagePath = _ref2.resolvePagePath, resolvePages =
 _ref2.resolvePages, filterPages = _ref2.filterPages, serialize = _ref2.serialize;
  39 |             _context.next = 4;
> 40 |             return graphql(query);
     |                    ^
  41 |
  42 |           case 4:
  43 |             _yield$graphql = _context.sent;

File: node_modules/gatsby-plugin-sitemap/gatsby-node.js:40:20

@pedrolamas
Copy link
Contributor

pedrolamas commented Apr 29, 2021

As far as I can see, the plugin is currently broken...

By default, it will generate the sitemap xml files under the "/sitemap" folder, and it does that correctly, however the sitemap index file points to "/sitemap-0.xml" instead of "/sitemap/sitemap-0.xml" as expected.

The easy fix would be to generate the sitemap on the root as before, however the plugin is not allowing to pass an empty string to the "output" option - is there a reason for not allowing this??

This issue is currently capturing some of the issues found on the 4.0.0 release of the plugin: #31095

@axe312ger
Copy link
Collaborator

Can confirm, getting the same error with v4.0.0 and v4.1.0-next.0.

"gatsby-plugin-sitemap" threw an error while running the onPostBuild lifecycle:

Body must be a string. Received: undefined.

  38 |             output = _ref2.output, entryLimit = _ref2.entryLimit, query = _ref2.query, excludes = _ref2.excludes, resolveSiteUrl = _ref2.resolveSiteUrl, resolvePagePath = _ref2.resolvePagePath, resolvePages =
_ref2.resolvePages, filterPages = _ref2.filterPages, serialize = _ref2.serialize;
  39 |             _context.next = 4;
> 40 |             return graphql(query);
     |                    ^
  41 |
  42 |           case 4:
  43 |             _yield$graphql = _context.sent;

axe312ger added a commit to hashbite/gatsby-mdx-suite that referenced this pull request May 1, 2021
@moonmeister
Copy link
Contributor Author

Hi @axe312ger !

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you open a new issue. Please include a minimal reproduction and a copy of any relevant code/config or a link to the repository.

Thanks for using Gatsby! 💜

@gatsbyjs gatsbyjs locked and limited conversation to collaborators May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change If implemented, this proposed work would break functionality for older versions of Gatsby status: needs core review Currently awaiting review from Core team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants