simplify permalink selection logic