@baris @bentael helped me out last night. Amongst other things he confirmed that too, that being on the index page results in an empty data.url. He did get me going using the location.href.
I have to say every one on this forum has been super helpful. I intend to make a donation to Nodebb in the near future.