use window.location.pathname instead of /