benmneb / pts-converter

📚 PTS reference to sutta number converter
https://benmneb.github.io/pts-converter/
4 stars 0 forks source link

Query strings break hash links on suttacentral #13

Open benmneb opened 2 years ago

benmneb commented 2 years ago

It appends ?ref=benmneb.github.io/pts-converter/ to the end of the ‘Read this sutta’ links, so I might look up S III 109 and it will form the following url (for English): https://suttacentral.net/sn22.84/en/sujato?layout=sidebyside&reference=main/pts&notes=asterisk&highlight=false&script=latin#pts-vp-pli3.109?ref=benmneb.github.io/pts-converter/

But that takes me to the start of SN 22.84

If I remove the ?ref=benmneb.github.io/pts-converter/ from the end of the url, then it scrolls to pts-vp-pli3.109 which is the behaviour that I was actually hoping for.

from https://discourse.suttacentral.net/t/suttacentral-2021-bug-reports-here/19609/215

benmneb commented 2 years ago

on second thought, i dont think this is me. i think its sutta central.

if you go directly to https://suttacentral.net/sn22.84/en/sujato?layout=sidebyside&reference=main/pts&notes=asterisk&highlight=false&script=latin#pts-vp-pli3.109 (or its short form https://suttacentral.net/sn22.84/en/sujato#pts-vp-pli3.109) it doenst even scroll to the correct place. but pressing enter in the URL bar after the page has already loaded does (which is why it seems like my params might be the problem).

im guessing because when the page loads, element with id pts-vp-pli3.109 doesnt exist yet. you can see the sutta content stagger in a bit after the header and footer load.

thesunshade commented 2 years ago

When I click on the first link, it scrolls to the correct place for me.

The second link will only work if your default setting is that the PTS ids are displayed.

In any case, is it allowable to have two ? in a url? I'd say it's better to not add params.

Also, I think Google can give them the referrer if they want to know. I also don't think Bhante ever looks at the analytics. 😁

benmneb commented 2 years ago

When I click on the first link, it scrolls to the correct place for me.

hmm true, safari iOS scrolls to to it, but firefox, chrome and safari on macOS dont for me. can you get it to work on desktop?

In any case, is it allowable to have two ? in a url? I'd say it's better to not add params.

i doubt it. your probably right

I also don't think Bhante ever looks at the analytics. 😁

🥲

thesunshade commented 2 years ago

can you get it to work on desktop?

I'm on Windows FF and it works.

But on chrome it does not. Huh. Strange. As you said, if you put the cursor in the url bar after the page has loaded and press enter, then it does scroll to the spot.