Post dates read from the English copy
Pluso developer · · 中文 · 日本語

Post dates read from the English copy

When the English file exists but carries no date, the post sinks to the end of the list with an empty time field, and a date written in the Chinese copy does nothing. Nothing fails and nothing is logged. The page is generated as usual, which is why this went unnoticed for so long.

The cause is subtler than "it only reads English". The date was fixed the first time the record was created, taken from whichever file created it, and nothing ever wrote to it again. A second assignment does branch on language, and it looks like the thing enforcing English priority, but it is dead code.

I changed it to assign regardless of language and rebuilt the whole site: zero files differed. All 39 markdown files and all 13 English posts came out byte-identical, because every English file already carries a date and none is the case this line guards. Deleting the line gives the same zero difference.

So English wins neither through a priority list nor through that line, but at the moment the record is created: files are read in name order, and the English file sorts after the Japanese and Chinese ones, so the record is always created from English and takes the English date.

The line never maintained English priority because that priority had already happened before it ran.

Only when there is no English file does the sort decide, taking whichever name comes first, which in practice means Japanese before Chinese. That half is a by-product of file names rather than a rule anyone wrote, and renaming a file would change it.

The reading now stores each file's date separately and then takes the first non-empty one in the order Chinese, English, Japanese. Reading and choosing are separate steps, the order is written down, and adding a language later means adding one entry to that list.

One caveat remains. The date is taken as the first non-empty value and is never checked for validity or compared with today. The build has no filter that skips future-dated posts; if one is added, an empty date cannot be compared and will be treated as publishable, so the check has to live at that read, not be left to the empty value.