News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How to add "noindex" to one SMF forum topic/ thread?

Started by Wellwisher, June 22, 2015, 08:28:11 PM

Previous topic - Next topic

Wellwisher

Hello there a way to add "noindex" to just one SMF forum topic?

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

All Colours Sam

There is no mod AFAIK but its simply a matter of adding a couple of lines into a source file.

On your Sources/Display.php find this:

// Add up unapproved replies to get real number of replies...

and add this before that:


if (!empty($topic) && $topic == 1)
$context['robot_no_index'] = true;


Where 1 is the topic ID you want to add the no index meta tag.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Wellwisher

Quote from: Suki on June 22, 2015, 08:41:20 PM
There is no mod AFAIK but its simply a matter of adding a couple of lines into a source file.

On your Sources/Display.php find this:

// Add up unapproved replies to get real number of replies...

and add this before that:


if (!empty($topic) && $topic == 1)
$context['robot_no_index'] = true;


Where 1 is the topic ID you want to add the no index meta tag.

Thank you Suki and what if there's multiple topics? Can you seperate this with commas i.e:


if (!empty($topic) && $topic == 1,2,3,4,5,6,7,8,9,10) <--- extreme example but you know..   :)
$context['robot_no_index'] = true;


Thank you again mate.  :) I just wanted to do one topic but I am curious.

Kindred

no...   to do that, you would need to make an array and use slightly different code...
Of course, this begs the question... Why are you trying to do this, anyway?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Wellwisher

Quote from: Kindred on June 24, 2015, 02:20:16 PM
no...   to do that, you would need to make an array and use slightly different code...
Of course, this begs the question... Why are you trying to do this, anyway?

Hello Kindred

Sometimes, members will post things (basically copying and pasting content from their websites/ blogs) on forums to gain higher rankings, exposure, make them sound legitimate or something. Whilst at times, this may be genuine, I want to ability to stomp this kind of activity out.

All Colours Sam

In that case, it might be better to check against the user/membergroup ID instead of the topic ID.

That is, if an user does that, put him/her on a special group and then check if whoever posting belongs to that group, if so, set the no index tag.

Of course this will flag all of the user's post with the no index tag and not just the ones with copy/paste content, if your suers only does that on certain boards you can limited the check to those boards too.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Kindred

hmmmm.... Well, you seem to be attempting to programmatically handle something which (IM) is bets handled by simple rules and then penalties for breaking the rules...



instead of doing this... and updating it every time someone does that -- why not just delete the thread in question and warn the user not to do that? If the user continues, then the user gets banned.   Problem solved!
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Wellwisher

I am an advocate of freedom of speech Kindred. I wish to encourage discussions and I want people to share links which basically cultivates a positive environment for members. Banning them for sharing with a geninue interest is too extreme of a measure.

For the moment at least, Suki's initial code is perfect, I might later modify it to add additional topics. If I do, I will add the updated code here. Thank you for all your help Devs!  :)

Advertisement: