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

[gatsby-plugin-sitemap] Documentation and DX improvements #29810

Closed
jevenson opened this issue Feb 26, 2021 · 7 comments
Closed

[gatsby-plugin-sitemap] Documentation and DX improvements #29810

jevenson opened this issue Feb 26, 2021 · 7 comments
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@jevenson
Copy link
Contributor

Summary

I implemented gatsby-plugin-sitemap onto my site just now, and I ran into a few problems that I think could've been prevented by improving documentation and adding some error handling with logging in the plugin.

First, I was unclear that it is required to query allSitePage with a path property. The docs do state this, however as devs do, we typically skim documentation. Would be good to add error handling/logging when the allSitePage option is missing.

Second, I forgot to return from the serialize function, which led to this error. I think this could be improved with some error handling. If urls is undefined, throw an error with a message "gatsby-plugin-sitemap did not recieve sitemap entries. Did you forget to return from your serialize function". Or something of that nature.

 ERROR #11321  PLUGIN

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

Cannot read property 'forEach' of undefined

  79 | 
  80 |             map = _sitemap.default.createSitemap(rest);
> 81 |             urls.forEach(function (u) {
     |                  ^
  82 |               return map.add(u);
  83 |             });
  84 |             return _context.abrupt("return", (0, _internals.writeFile)(saved,
map.toString()));

File: node_modules\gatsby-plugin-sitemap\gatsby-node.js:81:18

Motivation

To improve DX when implementing the sitemap plugin

Steps to resolve this issue

I will be cooking up a pull request for your consideration to resolve these issues 👍

@jevenson jevenson added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Feb 26, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 26, 2021
@vladar vladar added topic: sitemap and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 26, 2021
@vladar
Copy link
Contributor

vladar commented Feb 26, 2021

Sounds great 👍 Thanks for tackling this and a PR is welcome!

But you should also know that we have a pending PR for this plugin rewrite: #25670
We will likely publish a new major version of the plugin somewhere in the next month.

@jevenson
Copy link
Contributor Author

Ahhh, thanks for letting me know. I'll watch out for the release and check it out. Thanks!

@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Mar 19, 2021
@jevenson
Copy link
Contributor Author

I've still got my eye on this, waiting for the next version to be published

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Mar 23, 2021
@arun-is
Copy link
Contributor

arun-is commented Apr 14, 2021

looks like that PR you were waiting on is stale? #25670

@jevenson
Copy link
Contributor Author

@arun-is It looks like they're still working on getting it through

@LekoArts
Copy link
Contributor

#25670 was merged and currently published under the @next tag. If you have any additional improvements to the docs please open a PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

No branches or pull requests

4 participants