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.
There was an error rendering this rich post.
Comments
This is not much use to search engine who don't run JavaScript, which is most of them.
You need to bring the solution to the server side, such as through a themehook or plugin.
grep is your friend.
You can also do it on the server run level buy url pattern as you want the whole category not to be crawled.
grep is your friend.
Note that both pages are given the same canonical url.
@x00 Yes, I thought that. We could either use themehooks but them need to carry smarty {$BodyClass}. Or we can use theme views.
But before implementing this, I did some research and found out that Google bot now runs javascript and then crawl text.
@Todd I am sorry to say, but both pages (the blog and the discussion comment one) have different canonical urls.
There was an error rendering this rich post.
I wouldn't rely on this you have no idea to what extent, what engine they are using. The primary purpose of a crawler is to be efficient. Probably the main reason for running initial code, is to get a good assessment of the what the page is like in really, especially to stop black SEO practices.
Also they are interested in more content to crawl.
grep is your friend.
You don't care about the class, you care about what category you are in. The class is secondary.
grep is your friend.
@x00 agreed. There is no way one could tell up tp what extent. I am trying to play a safe game here. Its an precautionary measure. Something is better than nothing.
For the second point, that would require getting into core. unfortunately I am not so comfortable with PHP. JS and CSS is my cup of tee.
There was an error rendering this rich post.
Something like in
class.nofollowthemhooks.php
drop it in your theme. It assumes you have set
Vanilla.Embed.DefaultCategoryID
grep is your friend.
You are superstar.
Much thanks to you.
Right now, I am going to play badminton, will try to use theme hook late night.
PS: Tell me if I can do something for you in return. I can design and write documentation.
There was an error rendering this rich post.
not right now but maybe at a later date.
grep is your friend.
I am back.
Anytime whenever you want.
There was an error rendering this rich post.
It worked like a charm.
Since I knew category id, I hard coded this like -
if($CategoryID == 9))
because I was not sure of
Vanilla.Embed.DefaultCategoryID
There was an error rendering this rich post.
Hi All
Need a small help!
We are working on a WordPress website and have integrated Vanilla Forum WordPress Plugin. Since it opens in iFrame, is it possible to have SEO compatibility for Forums or make Google Crawl those forums.
Regards
Rajat Bansal
it is not the ideal, I only use it with clients with private forums where SEO is irrelevant. Better to simply run each standalone, but style them to fit in with the brand.
9/10 having the respective frameworks run on their own, without embedding or (worse) force loading frameworks or doubling up, is better. Let them do what they do best.
P. S. next time create a new discussion/question.
grep is your friend.