you should use `root.location.pathname`.