5 ms·
I went all in on using Caddy for rendering my website and blog, but I’m encountering a frustrating issue that I’m not sure how to solve. The feed on my site use
by jprokay13 1y ago
I went all in on using Caddy for rendering my website and blog, but I’m encountering a frustrating issue that I’m not sure how to solve.
The feed on my site uses the listFiles feature to populate from a directory. I take care to name things so ordering is preserved.
No problems on my machine getting the feed ordered correctly.
However, when deployed to Railway via a container, the ordering is all wrong.
Any thoughts on how to debug?
- shakna 1y agolistFiles is not sorted. It provides the files in the order that the OS provides them. That it's ordered on your machine, probably has to do with when the underlying nodes were created. But that's not going to much work in production. dirInfo, err := dir.Readdir(0) if err != nil { return nil, err } names := make([]string, len(dirInfo)) for i, fileInfo := range dirInfo { names[i] = fileInfo.Name() }
- jprokay13 1y agoYeah that was what I was afraid of. I thought I saw in the caddy code that they did a sort on file name, but I must have misread it. Thanks for responding! Edit: after looking more closely at sprig, the solve was sortAlpha
- indigodaddy 1y agoI'd love more info about your process!