Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to let sitemap.xml lastmod reflect menu changes also
#1
Hi,
I am working on a web site that has a full i18n sidebar menu on each page.

The sitemap.xml lastmod variable displays always the date (and time) the page contents changed. But when only the menu changes (e.g. when a new page was added) this will not affect lastmod.

But I would like to reflect either the content change date or the menu change date, whichever is newer.
I hope that Google will recognize web site changes and additions earlier this way.
Now I'm wondering how I can do this as easily as possible.

My current approach is getting all url+menu combined strings from pages.xml, sorting them, concatenating them, and write this "footprint" to a file in GSDATAOTHERPATH.
This will be done once, and then each time the "footprint" changed (I am still not sure about the perfect hook for this). So the file date will always reflect the last change of either any slug or any menu name. The assumption is that when one of the slugs or menu descriptions change, probably the menu on the front-end has also changed.

When building the sitemap, lastmod will then be filled either from the individual pubDate of the respective page, or from the footprint file date, whichever is newer.


Perhaps someone has an idea for a better approach, or just for a suitable hook for my purpose?
Thank you very much!
Reply


Messages In This Thread
Trying to let sitemap.xml lastmod reflect menu changes also - by Knobbles - 2022-04-26, 03:30:41



Users browsing this thread: 1 Guest(s)