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

Generate sitemap if any blog post or page exists #610

Merged
merged 3 commits into from
Apr 28, 2018

Conversation

balloob
Copy link
Contributor

@balloob balloob commented Apr 27, 2018

Motivation

We launched https://developers.home-assistant.io based on Docusaurus yesterday. After trying to add it to Google Search Console I realized that sitemap.xml is not being generated. Digging into the code, I realized that Docusaurus only generates the sitemap if there is at least 1 page and 1 blog post.

I don't see a technical reason to restrict it to sites having at least 1 blog post and 1 page. Sitemap generates just fine without a blog post. I think that this is a bug, but maybe it's a feature and I am missing something.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

I tested it on https://github.com/home-assistant/developers.home-assistant (a Docusaurus website without blogs).

Related PRs

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@balloob
Copy link
Contributor Author

balloob commented Apr 27, 2018

Signed the CLA

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 27, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@yangshun
Copy link
Contributor

@JoelMarcey @ericnakagawa Do you guys have more context on why n && was used instead of a ||? Changing to || seems reasonable to me but I'm wondering if making it && was intentional.

Copy link
Contributor

@JoelMarcey JoelMarcey left a comment

Choose a reason for hiding this comment

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

I don't think there was any particular reason here for that other than maybe an initial expectation that we were going to have both docs and blogs when we first started this.

Or it was just a mistake 😛

Also, not that it really matters, but the check for Object.keys(Metadata).length > 0 would be better to come first since that is more likely to be true than the blog length.

@yangshun yangshun merged commit 6c9c7e5 into facebook:master Apr 28, 2018
@balloob balloob deleted the patch-1 branch April 28, 2018 21:16
@balloob
Copy link
Contributor Author

balloob commented Apr 28, 2018

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants