Make Your Vanilla More SEO Friendly – Adding noindex to Duplicate Pages
-
For whom – Those who use Vanilla WordPress plugin to use forum for blog comments.
Problem – Whenever a comment is made in blog page, a subsequent and similar forum discussion is automatically made which has same title as blog post. Now both are indexed by Google and creating duplicate content. Example here.
Solution –
Each Vanilla discussion page automatically inserts body class of chosen category. Now if your comment belongs to category blog-comments, then use this code –
<script> if (document.body.classList.contains('Section-Category-blog-comments')) { customMeta=document.createElement('meta'); customMeta.name='robots'; customMeta.content='noindex,follow'; document.getElementsByTagName('head')[0].appendChild(customMeta); } </script>
This will automatically insert no-index in duplicate discussions page.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Make Your Vanilla More SEO Friendly – Adding noindex to Duplicate Pages’ is closed to new replies.