HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Noindex based on min word count?
Please can someone provide me an IF statement I can insert somewhere so that any thread pages with a word count below X will have the following added:<meta name="robots" content="noindex"/>
Reason being is I'd like to try and minimise what might be considered 'thin content' to Google and although word count is only one factor, it's an effective one.
0
Comments
I think you are taking the phrase too literally
watch this video
https://support.google.com/webmasters/answer/2604719?hl=en
it is nothing to do with succinct discussions. You can have really useful questions that are short, with a single simple answer.
You are far better off encouraging the behaviours you want, rather than trying to prevent indexing on low quality content.
grep is your friend.
I appreciate your point and working the leading SEO agency in Europe, I do have a reasonable grasp of this. The nature of my forum is there are a lot of 'request' one liner topics that offer no value for searchers but it would not be reasonable for me to try and stop that activity.
I understand thin content is not simply about word count but it just so happens that limiting word count in my situation would prevent indexing topics that might get flagged by Panda. Also many of the one liner topics are similar to previous ones, and canonical tags are not an option, so word count restriction would simply rule those similar topics out anyway.
Is there a way to do the IF statement mentioned in first post?
I assume you want to filter on the number of words in the discussion and comments bodies.
You can adjust the word count threshold via the following configuration in
/conf/config.php
:Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Again you will need to encourage your users to make make better topics, there are a number of ways to do that from interface to behavioural incentives.
If you want to add noindex conditionally in a theme hooks file you can add this hook
This will also trap tag only posts such as links and videos, as it is taking a text only version of the body rather then tags which are not easily taken into consideration.
A better idea would to flag this up during posting, by trigging a validation error. To encourage better quality posts.
grep is your friend.
Thanks guys.
Encouraging better discussion really wouldn't help at all. When they create request topics, it is correct for it to only be a couple of sentences and of minimal value to outside world. Ideally I would just put them all in a requests sub-forum and block the directory. However, half of these requests actually turn into discussions and therefore are of value for searchers but I don't have time to moderate and move them on a per topic basis.
+1 very interesting appeal.
@hgtonight Where exactly do you place your code? I tried in bootstrap.early/before/after.php but it all caused the forum to load a blank page. I tried removing 'public' from your code which allowed the forum load but the code didn't seem to actually work.
Put it in your favorite plugin.
Don't have one?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Never created a plugin before so what I did was I downloaded your 'Testing Ground' and dumped your code at the bottom of class.testingground.plugin.php and it seems to be working. Is this what you had in mind?
Sounds good to me.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight Is your 'Testing Ground' compatible with latest version of Vanilla? When enabled you can't use basic functionality such as deleting topics as it just gives a discussion controller error.
Ok, when I remove 'noindex' code from your plugin container, the forum is fine. So perhaps something in the code you provided me is causing this problem. Any ideas?
Enable the debugger plugin, then the testing ground plugin. This should give you an error instead of an "nice" error.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Ok so I enabled debugger in config and this is what I get when I try and delete a topic:
Please can aonyone figure out why @hgtonight 'noindex' code is causing discussion controller errors on most of the forum functions? Deleting, favouriting etc.
Reminder of @hgtonight 's code:
Huh, thought I had responded to this.
You need to check and make sure the discussion object exists. Replace line 3 with:
You could also improve this by passing the bodies through the format class like @x00 did.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Thanks, that worked!
I did also try @x00 code but my forum were just blank pages but I guess that doesn't matter now anyway.
I've just upgraded from 2.1.x to 2.3.1 and this little hack/plugin is no longer working consistently.
Any ideas?
Please provide the full code...