I was searching around on how to no index specific URLs but I havent found any specific info on the following.
By adding the below
<?php if(is_single(X)): ?>
<meta name="robots" content="noindex,nofollow">
<?php endif; ?>
I would be able to no index the (X) where X could be the post ID, the post title of “Hello World” for example , or a post slug of “hello-world”.
Would if be possible to specify all URLs which start with the same post slug or title for example, as in the example below?
www.test.com/REF-123-mytest.html
www.test.com/REF-123-yourtest.html
www.test.com/REF-123-histest.html
Could I leave out all URLs which start by REF-123 for example?