Jump to content
usualCommission

Automatic Sitemap Submission - New module that would benefit from feedback

Recommended Posts

Hey everyone-

We recently had a need come up for a website. After launching our website the company hired an SEO specialist who is doing some significant work revising and optimizing content. To help enhance this process I wrote a very simple module that automatically submits the website's sitemap.xml file to Bing and Google when a page is published, or when a page is saved that was already published.

As for our reasoning- there's a lot of information available as to why submitting your sitemap regularly can be beneficial. In classic Google style their official documentation says that there "is no guarantee" that submitting a sitemap alone will trigger a re-indexing by Google's bots. That said, devs have done tests where there is a strong coincidence between a sitemap submission and activity by Google bots on that website. Google has stated that there is no limit or cap on the number of times you can submit a sitemap so there is no penalty for triggering this for every change. For more details and the hard science visit this excellent article https://trevorfox.com/2018/09/ping-sitemaps-search-engines/

This module does the following:

  • Hooks into save/publish
  • Checks that the sitemap.xml URL is valid and a sitemap is available. This is done through a cURL request instead of file checking to account for plugins such as MarkupSitemapXML that generate the sitemap dynamically on demand.
  • Submits sitemap ping to Google and Bing
  • Logs activity
  • Shows a warning if the sitemap was not submitted after a page save/publish. Which could help a user notify the site developer if something isn't working.

My primary question is quality of code and using hooks correctly. I used two addHookAfter published and saved to trigger pings in the init() function. Is there a better way to hook into multiple events or is defining the hooks separately the way to go? I haven't created a lot of modules and wanted to give the community a chance to critique it before considering adding it to the module directory.

Source is located at: https://github.com/skylundy/ProcessAutoSitemapSubmit

Thanks for any feedback or critique!

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Just to let you know that the idea is brillant and your module come in handy. I am sure we will have some feedback and pull-requests in the next weeks. To give some more visibility to the module, you could show us how/why to use it in conjunction with the others SEO modules existing here.

Thanks again mate 🙂 👏

Share this post


Link to post
Share on other sites
9 hours ago, flydev said:

Just to let you know that the idea is brillant and your module come in handy. I am sure we will have some feedback and pull-requests in the next weeks. To give some more visibility to the module, you could show us how/why to use it in conjunction with the others SEO modules existing here.

Thanks again mate 🙂 👏

That's a great idea. I'm going to add some information to the configuration screen with recommendations and information on that as well.

Would this benefit from creating a post in the Modules/Plugins forum since this one is in the Module/Plugin Development forum? I initially wanted to see if there's any critiques or feedback that showed it wasn't ready for primetime but I think it is.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...