Hi.
I'm implementing sitemap.xml update/rebuild when the Editor presses "Save and Publish" or "Publish" if document is Draft.
My code works and writes the file in the specified directory, but the document is added only if user publishes twice. On the first Save and Publish I get the new sitemap.xml without the new document, on the second Save and Publish it's added.
I have tried following the documentation and writing my code in:
the Saving and Publishing events are fired before Umbraco has done the work (they are so you can intervene maybe stop or alter things before they are done) where as saved and published happen after when everything is in the cache live on the site.
Sitemap Builder
Hi. I'm implementing sitemap.xml update/rebuild when the Editor presses "Save and Publish" or "Publish" if document is Draft.
My code works and writes the file in the specified directory, but the document is added only if user publishes twice. On the first Save and Publish I get the new sitemap.xml without the new document, on the second Save and Publish it's added.
I have tried following the documentation and writing my code in:
private void ContentService_Saving(IContentService sender, ContentSavingEventArgs e) {...}
SubscribeToPublishEventComponent : IComponent
But I get the same result. what am I doing wrong?
Thanks in advance
Hi Rene,
I think you should look at using the
Saved
andPublished
version of those events e.gthe Saving and Publishing events are fired before Umbraco has done the work (they are so you can intervene maybe stop or alter things before they are done) where as saved and published happen after when everything is in the cache live on the site.
Thanks Kevin, that was the problem!
is working on a reply...