Forum Moderators: Robert Charlton & goodroi
history.pushState("", document.title, window.location.pathname + window.location.search); The fact that Google lists / finds both pages like: example.com/page-one/ and example.com/page-one/#section2 is a little worrying.It shouldn't cause worry. It means that a human searcher is sent directly to the part of the page that contains the desired content. I see this regularly. (Not in logs, of course, but in analytics.) I first noticed it years ago with fragment anchors attached to headers, but now see it with almost any type of anchor, like individual images or even page numbers--that is, page numbers of books, where the anchor appears in the middle of nowhere, not attached to any element. (And then I'm left wondering what, say, is so especially interesting on page 239 of Directions to Servants, but it can't be helped.)
A URI reference may be absolute or relative,
and may have additional information attached in the form of a
fragment identifier. However, "the URI" that results from such a
reference includes only the absolute URI after the fragment
identifier (if any) is removed and after any relative URI is resolved
to its absolute form.