I don’t know if it is a bug or things are supposed to work this way, and it’s me doing something wrong.
Right now I ran hugo, copied the sitemap.xml from public directory, ran hugo one more time and compared the two sitemap.xml’s.
They are not identical. The difference concerns the order of lines describing pages that have no datetime in their front matter or whose datetime is identical. Is it the expected behaviour? I’d expect something like alphabetical sorting in those cases, but it seems that the order is undefined.
The date has nanoseconds precision (I think), which should be plenty for most blogs to avoid overlaps. There is also the Weight attribute that can be used to control sorting … and then there is the sort funcs that can be used in your own template.
This is expected behavior. One could argue that some other field (title?) should be used as a secondary sort key …
The sorting algorithm in use is stable, but there are no sorting algos that I know of that can fulfill your guarantee without some additional state (id incremented?), and we are not going there.
But I agree that using the title as a secondary key for the default sorting would be a good idea (esp. for the people not using the time element in their dates).