We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 359430b commit f68fc3dCopy full SHA for f68fc3d
src/index.js
@@ -78,7 +78,16 @@ async function generateUrls(opts) {
78
const files = await getFiles(opts)
79
const iterator = (f) => transformUrl(f, opts)
80
const urls = await pool(opts.concurrent, files, iterator)
81
- return urls.filter((i) => i)
+ return urls
82
+ .filter((i) => i)
83
+ .sort(({ loc: a }, { loc: b }) => {
84
+ const depth = (url) => url.split('/').length
85
+ if (depth(a) === depth(b)) {
86
+ return a < b ? -1 : 1
87
+ } else {
88
+ return depth(a) < depth(b) ? -1 : 1
89
+ }
90
+ })
91
}
92
93
function generateTxtSitemap(urls) {
0 commit comments