Made query in navbar conditional on page