Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jun 2008
Posts: 92
Likes: 1
M
Journeyman
Journeyman
M Offline
Joined: Jun 2008
Posts: 92
Likes: 1
I'm working on putting Facebook "Like" button on certain posts on our forum.

The catch is that we need to have certain META tags present on the page which will be specific to that post (technically a topic). In other words, 1 topic will have to have a different set of META tags than another topic.

Is there a way to create topic-specific headers?

We're currently using UBBT 7.3.1. Is there perhaps a new feature that allows this in the most recent 7.x release?

Is this feature going to be available in the 8.x series? If so, we may just wait for that


If not, we can use Javascript injection to create the tags dynamically from the post itself, but I just wanted to know if there was a simpler way.

Thanks in advance.


If anyone is interested, I can followup this post showing how to do Javascript META tag injection.


Today they call you "crazy".
Tomorrow they call you "ahead of your time".
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
.js injection by manipulating the DOM works, but i'd recommend just modifying showflat.inc.php plus a tpl or two to do the work.

you are more semantic at the server level and can pass the optional meta to smarty for output..

2c

Joined: Jun 2008
Posts: 92
Likes: 1
M
Journeyman
Journeyman
M Offline
Joined: Jun 2008
Posts: 92
Likes: 1
I've been researching this and found that Facebook does not mention that its spider has the ability to run javascript. This means that javascript injection of OpenGraph headers (these are the header META tags that make your page act just like a Facebook "Page" - a good thing) will not work.

See, Facebook requires that your page include these headers in order for your page to act just like a Facebook "Page". Without them, your page will not be included in the "social stream" when a user clicks the "Like" button. (bummer)

So, the next area of research is to find the best way to add header tags server-side. The only catch is this: I have to know what post number is being viewed so the proper OpenGraph META tags can be built for each particular post that includes a "Like" button.

This will require me to know more about the UBB Threads architecture.

Does anyone have tips on where I can learn more about this?

In short, I need to know how to insert header tags server-side. Perhaps showflat.inc.php is the key, as you mentioned.

Also, I need to be able to know what post number is currently being viewed. Since I'll be in PHP (I assume), then I can _GET[] the "Number" element on the query string, but perhaps there's a better "UBB Threads"-ish kind of way???

Thanks in advance!

---

The process will be something like this:

1. Get post number

2. Search the database to see if any OpenGraph META tags are supposed to be associated with this post number.

3. If so, insert the appropriate META tags for this post number.


Today they call you "crazy".
Tomorrow they call you "ahead of your time".

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
1 members (Havenofsobriety), 458 guests, and 91 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)