×

Notice

The forum is in read only mode.

×
We are going to change plans on our hosting. Little downtime until the change. (Yesterday)

The actual task of upgrading the server to the new base of operations will occur, starting around this evening until some hours. From this time the website will be unavailable and will remain inaccessible. And the topics are in read only modus, so you still can read your messages.

Thank you
Kunena Team

× Please note: The Kunena project team takes NO responsibility for maintaining nor supporting anything in this category.

Solved SOLVED: Open Graph for image with og:image and image_src

  • Trony
  • Trony's Avatar Topic Author
  • Offline
  • Junior Member
  • Music and Electronic Devices Designer.
More
3 years 9 months ago - 3 years 9 months ago #1 by Trony
Hello, i'm trying to add meta tags as title topic.

In /libraries/kunena/bbcode/bbcode.php at line 1712 i added
$document = JFactory::getDocument();
$document->addCustomTag( '<link rel="image_src" href="'.$fileurl.'" />');
$document->addCustomTag ('<meta property="og:image" content="'.$fileurl.'" />');

and it's work very well.

The problem is that when i switch from backend Render HTML & BBCode in RSS feeds to Yes, the Rss Feed give me an Error 500.

How can i solve this problem ?!?
Tnx so much for your Tips. :)

Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover.

Last edit: 3 years 9 months ago by Trony.
More
3 years 9 months ago #2 by 810
enable kunena debug, and then go back then copy the error here
The following user(s) said Thank You: Trony
  • Trony
  • Trony's Avatar Topic Author
  • Offline
  • Junior Member
  • Music and Electronic Devices Designer.
More
3 years 9 months ago #3 by Trony
Hi, thanks for reply but with Kunena Debug i can't see the error.
There's the screen with report the wrong line and stop. :pinch:

Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover.

More
3 years 9 months ago #4 by 810
login as admin. then paste here the error
  • Trony
  • Trony's Avatar Topic Author
  • Offline
  • Junior Member
  • Music and Electronic Devices Designer.
More
3 years 9 months ago #5 by Trony
Hi. This is the only information from my Kunena Debug. :pinch:


Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover.

Attachments:
  • Trony
  • Trony's Avatar Topic Author
  • Offline
  • Junior Member
  • Music and Electronic Devices Designer.
More
3 years 9 months ago - 3 years 9 months ago #6 by Trony
Great !!! Now work !!! I changed my code in:
$document = JFactory::getDocument();
$doctype    = $document->getType();
// Only render for HTML output
if ($doctype == 'html') {
$document->addCustomTag( '<link rel="image_src" href="'.$fileurl.'" />');
$document->addCustomTag ('<meta property="og:image" content="'.$fileurl.'" />'); }

I hope is a good solution for insert in Kunena Topic the og:image and image_src
Anyway, tnx so much for your support. :)

Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover.

Last edit: 3 years 9 months ago by Trony.
The following user(s) said Thank You: kenzo
More
2 years 10 months ago #7 by kenzo
Hi! Thanks for share with us. Your solution still works? I'm looking for an "Open Graph plugin".
Thanks!
  • Trony
  • Trony's Avatar Topic Author
  • Offline
  • Junior Member
  • Music and Electronic Devices Designer.
More
2 years 9 months ago - 2 years 9 months ago #8 by Trony

kenzo wrote: Hi! Thanks for share with us. Your solution still works? I'm looking for an "Open Graph plugin".
Thanks!


Hello.
Yes it's still work but i changed for Kunena 4.0.7
New file is default.php in:

components -> com_kunena -> template -> system -> layouts -> image
defined ( '_JEXEC' ) or die ();
$document =& JFactory::getDocument();

and at the end of
</div>
of div class
<div class="kmsgimage">

<?
$document->addCustomTag( '<link rel="image_src" href="'.$url.'" />');
$document->addCustomTag ('<meta property="og:image" content="'.$url.'" />'); 
$document->addCustomTag ('<meta name="twitter:image:src" content="'.$url.'" />');
?>
</div>

Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover.

Last edit: 2 years 9 months ago by Trony.
More
1 year 11 months ago #9 by Ierofant
Hello!
Please tell me how to make a version 5.0.2
  • Trony
  • Trony's Avatar Topic Author
  • Offline
  • Junior Member
  • Music and Electronic Devices Designer.
More
1 year 11 months ago #10 by Trony

Ierofant wrote: Hello!
Please tell me how to make a version 5.0.2


For 5.0.2 and 5.0.3 you must edit these files in Crypsis Template:

template ► crypsis ► layouts ► attachment ► item ► image.php
defined('_JEXEC') or die();
$document =& JFactory::getDocument();

at end
<?
$doctype    = $document->getType();
// Only render for HTML output
if ($doctype == 'html') {
$document->addCustomTag('<link rel="image_src" href="'. JURI::base() .$attachment->getUrl().'">');
$document->addCustomTag ('<meta property="og:image" content="'. JURI::base() .$attachment->getUrl().'" />'); 
$document->addCustomTag ('<meta name="twitter:image:src" content="'. JURI::base() .$attachment->getUrl().'" />');
}
?>


template ► crypsis ► layouts ► bbcode ► image ► default.php
defined('_JEXEC') or die();
$document =& JFactory::getDocument();

at end
<?
$doctype    = $document->getType();
// Only render for HTML output
if ($doctype == 'html') {
$document->addCustomTag( '<link rel="image_src" href="'.$url.'">');
$document->addCustomTag ('<meta property="og:image" content="'.$url.'" />'); 
$document->addCustomTag ('<meta name="twitter:image:src" content="'.$url.'" />');
}
?>
</div>


Naturally.... BEFORE BACKUP ORIGINALS FILES !!!

Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover.

The following user(s) said Thank You: Ierofant
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.332 seconds