From d46de9ce29e9c8d0d373360e2a75a2cb37b01b84 Mon Sep 17 00:00:00 2001 From: Seirdy Date: Fri, 13 Sep 2024 01:01:34 -0400 Subject: [PATCH] Use "an" instead of "a" in some reading times "11" and "18" minute reading times now use "an" as they start with a vowel sound but aren't qualified by "short", "somewhat long", "long", or "very long". before, it said "a 11 minute read" but now it'll say "an 11 minute read". --- layouts/partials/post-meta/wordcount.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/layouts/partials/post-meta/wordcount.html b/layouts/partials/post-meta/wordcount.html index ac6579e..702341e 100644 --- a/layouts/partials/post-meta/wordcount.html +++ b/layouts/partials/post-meta/wordcount.html @@ -14,6 +14,11 @@ About {{- $minutes := mod . 60 -}} {{- $displayTime = (printf "%d hour and %d" $hours $minutes) | safeHTML -}} {{- end -}} - ; a {{ if lt . 10 }}short {{ else if and (gt . 20) (lt . 30) }}somewhat long {{ else if and (gt . 29) (lt . 60) }}long {{ else if gt . 59 }} very long {{ end -}} + {{- $indefiniteArticle := "a" -}} + {{- $vowelNumbers := slice 11 18 -}} {{/* 11 and 18 aren't qualified by "short" or "somewhat long" and start with vowel sounds so we need to say "an" instead of "a" */}} + {{- if (in $vowelNumbers .) -}} + {{- $indefiniteArticle = "an" -}} + {{- end -}} + ; {{ $indefiniteArticle }} {{ if lt . 10 }}short {{ else if and (gt . 20) (lt . 30) }}somewhat long {{ else if and (gt . 29) (lt . 60) }}long {{ else if gt . 59 }} very long {{ end -}} read {{- end -}}