Working around not-so-random randomness

I’ve been thinking about a way to give more attention to an article, maybe with a bigger picture, like if that article was “featured” within its category or randomly, shuffling .Paginator.Pages, shifting the first Page out of the Collection and following from there.

But, obviously, Hugo is one of many static site generators and I do know that unless I have a way to rebuild my site every hour or something like that, shuffle won’t do much. Even though I am in fact generating content twice a week, eventually my publishings will end, as they’re related to a finite subject.

Then I thought:

Can I take the most recent article, through its Publish Date I suppose, and make it “featured”? Does Hugo/Go provide a way to get current Date and compare like other languages?

Of course, this doesn’t solve the problem I’ll have when my articles end, implying in no other site rebuilding but, when that day comes, I could invert the logic and get the oldest article to the day instead.

Sounds to me like a way to workaround the not-so-random randomness, right?

I don’t think I understand.

What does “featured” mean to you? To me that means a post that is visually separated from the rest, and that is really easy to do with the latest post. I would almost say it is the default behavior.

What randomness is getting in yer way?

“Random” was something that came to me to be implemented today, with one article, and be ready “forever”, with thousands, which as far as I know is not possible because the randomness is created when the site is built.

I can sort the articles by date, yes, and get the most recent one and consider it as “featured”, but I was trying to come up with a way of give some “attention” to older posts as well.

Only now I realized that my statement of “just invert the logic” wouldn’t work, after all the oldest article will be the oldest regardless the current date.

My recommendation is to use a robust taxonomy. Then, you can built a little “related posts” section at build time, and either use keywords or taxonomy terms to “connect” the posts. Or even manually connect the posts per content.

Search around on the forum for how to do that, if interested.