add else if statement to sort link by paths