-
Notifications
You must be signed in to change notification settings - Fork 2.2k
#4353 Plugin for auto-generated sitemaps #4413
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
#4353 Plugin for auto-generated sitemaps #4413
Conversation
|
@dancastellon You've got some lint problems here. Make sure it passes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty good. Couple of questions and that's all.
| import { Meteor } from "meteor/meteor"; | ||
| import { check, Match } from "meteor/check"; | ||
| import Hooks from "@reactioncommerce/hooks"; | ||
| import Reaction from "/imports/plugins/core/core/server/Reaction"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be imported from /server/api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zenweasel Release 1.14 changes that. It looks like all references to /server/api have been moved to /imports/plugins/core/core/server/Reaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as @dancastellon mentioned, there is no more /server/api in release 1.14
| <lastmod>LAST_MOD</lastmod> | ||
| <changefreq>daily</changefreq> | ||
| <priority>0.8</priority> | ||
| </url>`.replace("URL", url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we replacing LAST_MOD somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zenweasel Yes, see getSitemapXML below.
| * @param {Array} [shopIds] - _id of shops to generate sitemaps for. Defaults to primary shop _id | ||
| * @param {Number} [urlsPerSitemap] - Max # of URLs per sitemap | ||
| */ | ||
| export default function generateSitemaps (shopIds = [], urlsPerSitemap = DEFAULT_URLS_PER_SITEMAP) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods could definitely use some tests
3afad21 to
db2d035
Compare
…or manual regeneration method
|
@zenweasel, @spencern This is ready for a review, but let's not merge yet - I need to test against the miderprise dataset, which Grigg will be setting up on a hosted DB, likely next week. |
|
@zenweasel Today I was able to test the sitemap generator with the miderprise dataset. It took roughly 3.5 minutes, but the app was useable while it was generating. I believe this one's ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some style things to take care of. Have not tested yet.
| type: String, | ||
| label: "Open Exchange Rates App Id" | ||
| label: "Open Exchange Rates App Id", | ||
| optional: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you needed to make this change since it doesn't appear related to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zenweasel Without making this field optional I'm unable to save the shop options form, unless I add an App ID for Open Exchange Rates. Shop options is where I added the sitemap refresh setting & regenerate button. I just noticed that on a fresh install, I also had to make settings.cart in the same schema optional. Does it make sense to have the sitemap settings be in a separate form? Or perhaps somewhere else, like the Shop -> General form?
| @@ -0,0 +1,32 @@ | |||
| import { Meteor } from "meteor/meteor"; | |||
| import React, { Component } from "react"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React import should always go before Meteor import: https://docs.reactioncommerce.com/docs/styleguide#syntax-and-style-conventions
| @@ -0,0 +1,29 @@ | |||
| import Random from "@reactioncommerce/random"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filename should use hyphens rather than camel-casing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zenweasel - updated all filenames to be hyphenated
| @@ -0,0 +1,23 @@ | |||
| import { Meteor } from "meteor/meteor"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a pattern you see elsewhere as I am not a big fan of putting much besides imports into index.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zenweasel I updated this to follow the core plugin's pattern for defining methods. Method itself in a separate file, that is simply imported in methods/index.js and exported.
|
@dancastellon Also, you still have lint errors |
|
@dancastellon Following up on the notes from the call, if I click on "Refresh Sitemaps Now" I don't see any visual feedback that anything has started, much less completed in either the server console or the UI. I should get at least some sort of "started regenerating sitemap" message or something. |
…reaction into feat-4353-dancastellon-sitemap-generator
|
Thanks @rymorgan, I've made the changes you suggested, see below: |
|
@rymorgan Also, the notification. Let me know if I should change the text: |
|
@dancastellon I think the notification should say 'Sitemap refresh is complete' to match the language in the toast Other than that it LGTM. The toast alert was coming up for me but could very well be something wrong with my local reaction instance so as long as @zenweasel can confirm that is working then I'm good with this. |
|
@rymorgan Done, thanks. I have seen times previously where the toast doesn't show up sometimes. @zenweasel Let me know if you still don't see the toast. Might be a core bug. |
|
If I put in an invalid interval I don't get any validation but it throws this error in the server console: I don't know that we do a good job validating any of those values in that screen. Maybe it might make sense to just do a dropdown there? Every 24 hours/Every 12 hours/Every 1 hour? Or maybe the |
|
When I click on "Refresh sitemap" I get the translation key instead of the message. |
|
This is a nitpick probably but: If I click on "View All" for notifications, each of the notifications is a link but that link just takes you to the home page. Maybe it should take you to the XML file instead? |
|
@dancastellon Found a few little things to fix but it's getting pretty close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few issues left to address
…reaction into feat-4353-dancastellon-sitemap-generator
|
@zenweasel I've made the changes you suggested. Tagging @rymorgan as I've switched out some form fields with their new Reaction Components counterparts
|
|
@dancastellon Is this still under shops/options? I'm not seeing it anymore on your branch (might be user error ?). From your screenshot though I think this approach is good. And every place where we convert to components in our component library is a win. 👍 |
|
@rymorgan Yes, it's still under Shop -> Options. I did rename the React component behind the sitemap settings, so maybe try a hard refresh? Are you seeing any browser console errors? |
|
Ok, I got it working. From a UI/UX perspective, it looks good to me 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍
Resolves #4353
Impact: minor
Type: feature
Issue
Reaction currently has no sitemap.xml - a file that allows search engines visibility into a website's pages. Without it, search engines must manually crawl and find pages through links.
Solution
A sitemap generator plugin that creates and stores XML for a sitemap index, as well as sitemaps for tag pages, PDPs, and arbitrary URLs that can be added via an event hook.
There is a recurring job that runs every 24 hours (can be changed) that generates the sitemaps. There is also a button to manually trigger a refresh, at Dashboard -> Shop -> Options - along with a notification that appears when it's completed.
GraphQL TBD (separate issue)
Breaking changes
None
Testing
reaction-data-loaderto load the dev dataset