When i started this site i really didn't think through how to to organize the pages in the content section, i just went along with whatever the theme i was using at the time, in this case: evan.
The result was less than optimal as evan used dates, which is ok if you write one article a day at best, but i write lots of small articles about Void Linux so the organisation was quickly thrown out of the window with weird filenames to be used as tie-breaker for sorting taking its place.
So i decided one day to take the plunge and fix it before it got really out of hand.
The past suck
This is how the tree was before i got myself into fixing it.
content ├── 2-foray-into-common-shlibs.md ├── 3-build-helper-void.md ├── 4-how-its-done.md ├── 996-libgusb-meson-gir-cross.md ├── 997-cross-the-gir.md ├── 998-using-tmplgen.md ├── 999-new-site-scheme.md ├── _index.md ├── pages │ ├── _index.md │ └── about.md ├── void-cpython3-cross-pt1.md └── void-cpython3-cross-pt2.md 1 directory, 12 files
2, 3, 4, 996, 997, 998, 999 ?!
2 files without numbering ?!
Wait until you hear that the bigger the number it means they are before and not after, so 999 comes before 998 and 4 comes before 2.
The current neat
To get an idea, this is how my files are currently named.
content ├── 1-void-cpython3-cross-pt1.md ├── 2-void-cpython3-cross-pt2.md ├── 3-how-its-done.md ├── 4-build-helper-void.md ├── 5-foray-into-common-shlibs.md ├── 6-new-site-scheme.md ├── 7-using-tmplgen.md ├── 8-cross-the-gir.md ├── 9-libgusb-meson-gir-cross.md ├── 10-weighting-the-pages.md ├── _index.md └── pages ├── _index.md └── about.md 1 directory, 13 files
Pretty neat isn't it ? You have _index which holds some pretty simple info, inside pages you have the about me page that can be reached by clicking at the top.
And the most neat part is that each article is ordered by the order in which i wrote them, 1 being the first and the latest being whatever has the highest number by the time one looks there.
The road taken
The one big change that allowed me to do that was changing the sort_by key in _index.md from date to weight.
With date it is really hard to keep filenames organized if you write more than 1 post a day, since pages with the same date have a tie-break resolved by their names.
That wouldn't be bad except that they sort it alphabetically and a lower number puts it after one of a higher number, so to make it work you would have to write it from the highest to the lowest.
Switching to weights still has the highest to lowest problem but now it it can be solved by just starting from 999999999 and working down from there.
Won't they run out ? Assuming 1 post a day we will have 2737851 years before we run out, 1368925 years for 2 articles a day. That should be enough, in any case we just add another 9 at the end and we get an extra 24640659 years to work it out.
Sadly this breaks everyone that linked to a specific post of my blog, which is why this should have been done much earlier, thankfully the breakage is limited to Void Linux sections.