Prevent page scroll to top when using taxonomy filters

Hi everyone,

I’m using taxonomies in Hugo to create filter functionality for cars.

The issue is:
When I select a filter, the page reloads and scrolls to the top. I want only the filtered content to update, without the page jumping to the top.

I already fixed this using JavaScript, but I’m wondering:

  • Is there a better or more “Hugo-native” way to handle this?
  • Can this be solved without JavaScript?

Basically, I want a smoother filtering experience where the scroll position is preserved.

Any suggestions would help. Thanks!

not really all pages are static

you will have to create pages per filter incl. an anchor and target these site.com/car1#filter1.

it’s always a full page reload with a flash.

the natural way is javascript for dynamic filters.