Strategy for delaying posts in RSS feed but not "main" site

I create a “daily note” post every morning and add to it throughout the day. I prefer to publish it as I go, but for people reading via RSS it’s a little strange to see a new post show up in their feed at 5:00 am containing nothing but “Good morning” or whatever.

I’d like a way to publish these posts on the blog as I go, but delay them in the RSS feed until later in the day. I thought maybe something like a separate draftRSS flag in the front matter, but that might be too manual. I’m sure I would forget to change it.

This feels like something that could go in my theme’s RSS template, but I’m unsure how to go about it. Any suggestions?

Whatever solution you choose, you need to redeploy your site to get things published, even if that’s just rss feed.

Depend where you host your site, maybe hosting provider is offering some sort of scheduler. Through strictly with Hugo I doubt that’s possible.

1 Like

That’s a good point, thanks. I think I can find a way to schedule the deployment part of it.

I didn’t mention that I’d like regular posts included in the RSS feed when posted. Only “journal” type posts should be delayed. Maybe I’m overthinking it :slight_smile:

Try setting your notes with future date/time. This will prevent them from been processed on scheduled build until time match.

That could work, but it would also prevent them from being published on the blog, yes? I’m hoping to only delay them from appearing in the RSS feed(s).

Yes, you cannot get two.

Could you create a variable in your front matter like complete=false. Then override the built-in RSS template with your own which only includes posts where complete=true?

This may be more trouble than you’re willing to try but, if you deploy via CI/CD — e.g., a GitHub Action — you can include a cron job. This in combination with the future-dating method mentioned by @idarek might do the trick.

That was my initial thought, yes. The downside is that it requires that I manually set it to “true” at the end of each day. No big deal, but if I could find something that just did that automatically at, say 5:00 pm it would be cool.

Would it work to build with different settings?

I will add something from another perspective. Why do you worry that the note will be visible in the feed at 5 am?

The thing with RSS feeds is that almost nobody is using notifications on feeds. Also, some feeds read updates with delay, while others live.

It may be an overthink, but 5am here can be 3pm on other part of the word.

Instead adding complexity maybe better to leave as it is?

1 Like

That’s definitely an option! You’re right that it’s probably not a serious issue. I was just thinking of ways to improve things, but maybe I should leave it alone.

2 Likes

In the RSS template, tell it to skip posts where the publish time is less than N hours.

{{ if lt (.PublishDate.Sub now).Abs.Hours 3 }}
skip
{{ else }}
publish
{{ end }}
1 Like

Nice, I’ll give that a try, thanks!