2017-12-27, 06:10 PM
I added Open Graph meta tags to the headerinclude template, but I want to dynamically populate them using the description of each page, so what is the PHP tag/Hook that generates the meta description for the forum pages?
(2017-12-28, 02:36 AM).m. Wrote: [ -> ]instead of adding the code to headerinclude template,
you can add to individual templates after {$headerinclude} & before </head>
basically you can add the code in below templates
index, portal, forumdisplay, showthread, calendar ..
(2017-12-28, 07:14 PM)laie_techie Wrote: [ -> ]@Noobly, how are you going to populate it for each thread? Who is going to write each thread's description?
You can modify the showthread template to include variables after $headerinclude, then have a plugin register a function on the showthread_start hook (I'd have to look at the code to verify this hook's real name) to populate that variable.
(2017-12-30, 12:15 PM)Noobly Wrote: [ -> ]use the first 100 chars of the OP as the description
(2018-03-05, 06:27 PM)RateU Wrote: [ -> ](2017-12-30, 12:15 PM)Noobly Wrote: [ -> ]use the first 100 chars of the OP as the description
By default, we don't have it.
Workaround possibility:
1. Install Thread Tooltip Preview.
2. You can use {$thread['postpreview']} in your showthread template as description.
(2018-03-06, 06:39 AM)Noobly Wrote: [ -> ]1. Will MyBB 2 support open graph etc out of the box (that is why I want this "hook"), I am manually adding the meta tags.Better to ask it to MyBB's dev
(2018-03-06, 06:39 AM)Noobly Wrote: [ -> ]2a. This plugin you mentioned, what other behavior does it introduce?Originally, the purpose of the plugin is for displaying tooltips in forumdisplay.
(2018-03-06, 06:39 AM)Noobly Wrote: [ -> ]2b. I do not want any modifications to my theme by the plugin, so if I can hook {$thread['postpreview']} without it adding that preview functionality elsewhere it would be perfect for now. (running Modern by some Taiwan guy who is no longer around.)The plugin itself doesn't modify any template (there is no find_replace_templatesets function run by the plugin).
(2018-03-06, 06:39 AM)Noobly Wrote: [ -> ]3. Does this affect performanceUnfortunately, every plugins you add to your forum will affect performance.
(2018-03-06, 06:39 AM)Noobly Wrote: [ -> ]I understand to render {$thread['postpreview']} it would require additional database queries, are those noticeable or should it not have a visible impact on performance?The plugin creates the preview when the user submit the thread. It is saved in your threads table. So it doesn't require additional database query when displaying it.