This is the current behaviour. I think it produces a confusing result, particularly when sorting by date
$ curl -i http://127.0.0.1:4000/frontmatter/file/2024-06-23.md\?order\=asc | sed -n '6,7 p'
x-prev-file: 2024-06-24.md
x-next-file: 2024-06-22-11-57.md
$ curl -i http://127.0.0.1:4000/frontmatter/file/2024-06-23.md | sed -n '6,7 p'
x-next-file: 2024-06-22-11-57.md
x-prev-file: 2024-06-24.md