do not rely on publishedFromNow but build it dynamically

This commit is contained in:
Wouter Groeneveld 2021-03-25 20:58:31 +01:00
parent e183f50d1f
commit df46810328
5 changed files with 20 additions and 19 deletions

View File

@ -294,7 +294,7 @@ Merk op dat bij Groovy dit zeer krachtig is en hele expressies in strings kunnen
#### Template parsing ####
Grotere brokken tekst interpoleren werkt via *templates*. In Prototype JS is er een `Template` klasse [aanwezig](http:*www.prototypejs.org/api/template), in Groovy zit een uitgebreide en uitbreidbare [template engine](http:*groovy.codehaus.org/Groovy+Templates):
Grotere brokken tekst interpoleren werkt via *templates*. In Prototype JS is er een `Template` klasse [aanwezig](http://www.prototypejs.org/api/template), in Groovy zit een uitgebreide en uitbreidbare [template engine](http:*groovy.codehaus.org/Groovy+Templates):
**JavaScript**
```javascript

View File

@ -28,7 +28,7 @@ Another priority was _cable management_. I hate the sight of cable clutter - or
Next to the doorway, we have the least amount of space. I would love to get a decent CRT screen coupled with [my 486 machine](/post/2020/09/reviving-a-80486/), but space constraints make this impossible. The `17"` DELL screen does an okay job at displaying old VESA CGA/VGA resolutions, but it's far from great. At least now everything fits nicely. As a big fan of the original [Monkey Island](https://en.wikipedia.org/wiki/The_Secret_of_Monkey_Island) games, I framed the cover art (printed as high quality posters), that blends perfectly with the 1990s retro theme.
In the above photo, it's a bit hard to see, but this setup already mixes old (the obvious 486) with new (the newer LCD screen, the [SD card based HDD](/post/2020/09/486-upgrade-sd-hdd/) mod, and the [S2 wavetable board](http://localhost:1313/post/2020/09/486-upgrade-sound-blaster/)). I especially love the mechanical old keyboard, which was taken apart and thoroughly cleaned a couple of months ago. Things still on the wish list: a set of original Roland speakers, and of course a Roland [MT-32 MIDI syntheziser](https://en.wikipedia.org/wiki/Roland_MT-32) or one of the more recent [Sound Canvas](https://en.wikipedia.org/wiki/Roland_Sound_Canvas) devices.
In the above photo, it's a bit hard to see, but this setup already mixes old (the obvious 486) with new (the newer LCD screen, the [SD card based HDD](/post/2020/09/486-upgrade-sd-hdd/) mod, and the [S2 wavetable board](/post/2020/09/486-upgrade-sound-blaster/)). I especially love the mechanical old keyboard, which was taken apart and thoroughly cleaned a couple of months ago. Things still on the wish list: a set of original Roland speakers, and of course a Roland [MT-32 MIDI syntheziser](https://en.wikipedia.org/wiki/Roland_MT-32) or one of the more recent [Sound Canvas](https://en.wikipedia.org/wiki/Roland_Sound_Canvas) devices.
### 2. Middle: The Win98/XP machines

View File

@ -0,0 +1,15 @@
<!-- ty, https://kodify.net/hugo/date-time/relative-age-hugo/ -->
{{ $ageDays := div (sub now.Unix .Unix) 86400 }}
{{ $ageMonths := div (sub now.Unix .Unix) 2592000 }}
{{ if eq $ageDays 0 }}
Today
{{ else if lt $ageDays 31 }}
{{ $ageDays }}
{{ cond (eq $ageDays 1) "day" "days"}}
ago
{{ else }}
{{ $ageMonths }}
{{ cond (eq $ageMonths 1) "month" "months" }}
ago
{{ end }}

View File

@ -24,7 +24,8 @@
<use xlink:href='#cal1'></use>
</svg>
<time class="dt-published" datetime="{{ .published }}">
{{ .publishedFromNow }}
{{- $publishedAsDate := .published | time -}}
{{ partial "reldate" $publishedAsDate }}
</time>
&nbsp;|&nbsp;by&nbsp;
<a rel="author" class="u-author h-card u-url permalink" href="{{ .source }}">

View File

@ -8,22 +8,7 @@
<use xlink:href='#cal1'></use>
</svg>
<time datetime='{{ .Date.Format "2006-01-02T15:04:00" }}' class="dt-published">
<!-- ty, https://kodify.net/hugo/date-time/relative-age-hugo/ -->
{{ $ageDays := div (sub now.Unix .Date.Unix) 86400 }}
{{ $ageMonths := div (sub now.Unix .Date.Unix) 2592000 }}
{{ if eq $ageDays 0 }}
Today
{{ else if lt $ageDays 31 }}
{{ $ageDays }}
{{ cond (eq $ageDays 1) "day" "days"}}
ago
{{ else }}
{{ $ageMonths }}
{{ cond (eq $ageMonths 1) "month" "months" }}
ago
{{ end }}
{{ partial "reldate" .Date }}
</time>
&nbsp;|&nbsp;
<a href="{{ .RelPermalink }}" class="permalink">Permalink</a>