MyBB Community Forums

Full Version: Thread specfic template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm hoping this is possible. I need to insert arbitrary <link> tags into the <head> section of certain threads. For instance, if I have a thread with an article and the same article on my main website, I would like the thread to contain the tag:
<link rel='canonical' href=''content_on_main_site" />
In the header.

These tags would, of course, be manually entered and only on certain threads. I'm just at a loss on how I would go about doing it.

I'm considering, if worse comes to worse, conditional templates to check the ThreadID for every thread would have be used, and the <link> would have to be hardcoded. This isn't something I'm very happy doing, but will have to do it if there is no other way.

Looking forward to the community's response,

Regards,
Pleeb.
Why no try using Google SEO? It offers canonical feature and you don't have to use any other feature (i.e: SEF urls).
(2012-07-26, 03:20 AM)Omar G. Wrote: [ -> ]Why no try using Google SEO? It offers canonical feature and you don't have to use any other feature (i.e: SEF urls).

Hi, thanks for the quick response.

I do use the Google SEO plugin and I also utilize the canonical feature on there. However, from what I understand, you can't enter custom canonical urls to it for certain threads.

Like, in my situation I have this thread, and I would like to add a rel=canonical link to tell google that it should prioritize for this link instead.

I wasn't able to figure out how to do such a thing with the Google SEO plugin.

Hope I'm making sense, if not, I could try to explain better.
You can do this with XThreads. http://mybbhacks.zingaburga.com/showthread.php?tid=288

Here's what you can do.
  • Create a new Custom Thread Field with the key "metalinks"
  • Display value should be: <link rel='canonical' href=''{VALUE}" />
  • Editable only by mod/admin groups
  • In the template for your thread display, in the head tags, put: {$GLOBALS['threadfields']['metalinks']}
(2012-07-26, 01:00 PM)brad-t Wrote: [ -> ]
  • Viewable only by mod/admin groups

Actually, it should be viewable by all and editable by mods/admin (or everybody - optional) since he wants Google to view it.
Members, you just made my day, thank you very much, this is exactly what I was looking for!

Have a great day, and thank you for your support!
(2012-07-27, 02:52 AM)Omar G. Wrote: [ -> ]
(2012-07-26, 01:00 PM)brad-t Wrote: [ -> ]
  • Viewable only by mod/admin groups

Actually, it should be viewable by all and editable by mods/admin (or everybody - optional) since he wants Google to view it.

You're correct -- thanks! I've updated my post.

Good luck Pleeb.