Add some logic for showing/hiding prev/next links