How to print partial URL after #? [closed]

First off, the “slug” is what it is by definition. There is no such thing as a “front slug”.

As you do not elaborate/know on how the anchors/hashes are generated on the server side, all I can give you is a JS solution (proof of concept):

if (window.location.hash) {
    alert(window.location.hash.substring(1));
}