I’m trying to add more information for dynamic page in my sitemap. Currently, the sitemap is accessed through domain.com/dynamic-dynamicPage-sitemap.xml , but it lacks sitemap information.
Through the Velo Developer sidebar, I have added a hook for afterSitemap, however, looking at the logs, it is never called. I’ve visited /sitemap.xml, /dynamic-dynamicPage-sitemap.xml, /dynamicPage/sitemap.xml, but nothing is changed/exists, and my function isn’t called. None of the examples on Wix’s support pages have modified the sitemap.
Does this even work??? I’ve spent many hours on this and am starting to have my doubts…
I believe the function afterSitemap
is called once the site is published.
Have you try to publish and look at your site events for logs?
I really appreciate the response! You led me in the right direction.
I had published the site and looked at the logs, but it wasn’t triggering afterSitemap.
HOWEVER, I have found that it seems to trigger when the sitemap changes, i.e., when you add or remove items from your dynamic collection. Even more specifically, opening and then closing the content manager seems to trigger this hook.
Another issue appears to be that large json items, such as sitemapEntries, are not logged in the event console. You have to break them up into smaller thing (e.g., iterate through the array) and print them.
I’m still running into an issue where the returned structure is not reflected in the sitemap, but this is major progress! Thank you!!!