Hugo with --buildFuture doesn't show upcoming events

Hi! I’m building a site with Hugo that needs to display upcoming events.
I’ve added command = “hugo --gc --minify --buildFuture” in netlify.toml but it still doesn’t work as expected.
It’s working ok locally.
My site is here:
https://relaxed-knuth-e77a0f.netlify.app/events/
and it is only a test site.

What else can I do to make it work?

We would need to see the repo if possible to check this issue.

Link to my repo: https://github.com/maknetaRo/hugo-theme

EDIT: I see it now. Don’t mind me.

What part is the problem? I can see one date from the future in the events section. Moreover, your theme is setup in a way that builds the future post even without specifying it in the command line. I just ran hugo and still got the event from May 5 in the list.

This is what I’m getting:

Update: As I am seeing, your command is the problem. My previous comment stands true. If you run just hugo the build works fine. Check it here: https://silly-leavitt-3be0ff.netlify.app/events/

I deployed to Netlify using just the hugo command but didn’t realise you were overriding it in your netlify.toml, thus I faced the same error as you when I edited my previous post.

However, I changed the command to hugo, the build works fine.

Explanation: What’s happening is, when you use Build Future, the current Date is not according to system, it’s according to the post and the way your theme is setup, it’s using current Date to determine the upcoming events. Thus, keep your command as hugo --minify. It will do the trick.

Thank you for the answer. I had to remove everything form the netlify.toml and leave only

[build]

publish = "public"
command = "hugo --minify"

Now it’s working.
But I had all this netlify.toml from netlify documentation. I only change the Hugo version.

The documentation that you might have referred to does not apply to you because of the explanation I gave above.

If your code had not depended on the current date, and even then you wanted to build future posts, you would need the build future flag.

1 Like

Thank you once again.