Get current page name without query string

The location documentation page has the answers for you there.
You can also console.log(location) to see a live example of all the different properties.

location.pathname gives the current page name with no query string.