Infinite Scroll problems

So, I was trying to implement infinite scroll on my website and it works well. I’m using this library: as I’m also using the manonary.js from the same author.

The library has a feature to update URL in address bar as we scroll, and so, if we go back, of it user refreshes, he/she returns to the same infinite scroll state. The problem is, because the URL in the address bar goes like /page/2, /page/3, when the user refreshes, he/she is taken to the list template and shows posts only on that page.

So, is it possible to implement it properly with Hugo, or is it a lost cause?

Here’s my repo: