I don't think it is legal in the UK. I mean it might not be illegal as such, but it would make the employer a sitting duck in an age discrimination lawsuit.
That page says discrimination during recruiting "may" be illegal, and that you "shouldn't" discriminate on age. It should say "is" and "mustn't" if it's certainly against the law.
My main problem with gov.uk is this fault to make clear the position of its advice in respect of the law, IMO it should link the appropriate legislation/caselaw as citations to prove the position it contends.