Evergreen posts

Wednesday 28 October 2026

How blog posts here indicate their age, and how I had too much fun with it.

Because I’ve been writing this blog for so long, I often share links to very old posts. Three years ago, I added a feature: if the post is more than five years old, there’s a message next to the dateline indicating the age.

The age descriptions adjust automatically when the post is rendered. I had fun implementing the human-style age descriptions: “nearly 12 years”, “more than seven years”, “exactly nine years”, etc:

NUMBER_NAMES = dict(enumerate(
    "zero one two three four five six seven eight nine ten".split()
))

def years_age(age):
    years, frac = divmod(age.days / 365.25, 1)
    years = int(years)
    if frac < 1/365:
        modifier = "exactly "
    elif frac < 2/12:
        modifier = ""
    elif frac < 4/12:
        modifier = "more than "
    elif frac < 8/12:
        modifier = "over "
    elif frac < 9/12:
        modifier = "close to "
        years += 1
    elif frac < 10/12:
        modifier = "almost "
        years += 1
    elif frac < 11/12:
        modifier = "nearly "
        years += 1
    elif frac < 364/365:
        modifier = ""
        years += 1
    else:
        modifier = "exactly "
        years += 1
    years = NUMBER_NAMES.get(years, years)
    return f"{modifier}{years} years"

The complete message is then something like “This is more than 14 years old. Be careful” because many posts are technical, and details might have shifted. For example: Tricky locals().

But some posts never become stale: they are evergreen. So back then I also added a way to mark blog posts as evergreen. The message would change to “This is eight years old, but it’s still good.” I marked blog posts evergreen one by one when I shared them and saw the needless “Be careful” warning.

Today I took it one step further: I made the “but it’s still good” message customizable on each post. For example:

One of the things I like about running this site is that it is all mine. I can change the software however I like. I can build features like this that truly don’t matter, but they make me smile. And that is always good.

Comments

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.