sitemap job refactoring to improve extensibility - #1271
Conversation
|
@Remo are you thinking about the GenerateMultilingualSitemap job of the multilingual package, aren't you? |
|
@mlocati No, it's not about GenerateMultilingualSitemap. We've got quite a few projects with page type controllers. There are methods we call and get different content based on the parameters. /page/object-123 while object-123 is a database object and not a page object. I'd like to make sure Google finds those as well and wanted to override. Nothing else than additional pages I'd like to add to sitemap.xml However, I do see that GenerateMultilingualSitemap might benefit from a refactoring. I'm not sure if that method fits well into Page or PageList, generating sitemap.xml seems to be pretty specific to this job. I also thought about adding two new events The first would get called once for every job run and the second one would get called for every page found in the job. I'll keep on thinking about that, but so far, the "AddPages" method is all I need. |
|
@Remo Ok. BTW we could also leave the AddPage inside the GenerateSitemap job, add those two events. As a side note, I can't remember why I kept two separated calls to AddPage for the home and the other pages: now that you're touching the GenerateSitemap job, could you remove the |
|
@mlocati cID > 1 stuff removed |
|
Useless stuff removed almost everywhere ;) |
|
thanks @mlocati |
Add events to GenerateSitemap job
|
Accidentally closed this earlier. |
|
Thanks guys this looks good. |
I've had some issues when I wanted to override the sitemap job.
All I wanted to do is to add some custom entries without overriding the whole file.
Unfortunately most of the logic was in run(), a method I didn't want to override.
I created a new method "AddPages" which you can override. At this point you can easily add additional entries to the xml file, no need to override the whole run method or remove first