intro image as facebook-share image?
Support help forum dedicated to free and commerical templates for Joomla 3 and 2.5 version.
- GK User
- Sun Jun 03, 2012 3:28 pm
Hi!
Really happy with the template World News 2 so far.
Was wondering though, often i don't have an image in the article itself, only a youtube link or whatnot.
I always have an intro-image though, so I was wondering if it's possible to use the intro-image when sharing articles on facebook?
Or are there any other solutions that might suit my needs?
Thanks in advance,
Martin
Really happy with the template World News 2 so far.
Was wondering though, often i don't have an image in the article itself, only a youtube link or whatnot.
I always have an intro-image though, so I was wondering if it's possible to use the intro-image when sharing articles on facebook?
Or are there any other solutions that might suit my needs?
Thanks in advance,
Martin
-
- Fresh Boarder
- teitbite
- Thu Jun 07, 2012 11:42 am
Hi
Do You mean a default image for an article? You need to edit /html/com_content/article/default.php and add a code like:
The above is for regular joomla articles. If You are using K2 than the propper file is in /html/com_k2/templates/default/item.php
Do You mean a default image for an article? You need to edit /html/com_content/article/default.php and add a code like:
- Code: Select all
$doc->setMetaData( 'og:image', 'http://www.images.com/image.png' );
The above is for regular joomla articles. If You are using K2 than the propper file is in /html/com_k2/templates/default/item.php
-
- Moderator
- GK User
- Thu Jul 12, 2012 8:04 pm
I want Facebook's like and share to show the image from my K2 articles and I am trying to overcome the fact that Gavick's OpenGraph plugin is not currently working with K2 articles. I've tried Easy Open Graph, but that plugin adds multiple og:url to the page, which throws errors on Facebook's debugging page.
I want to add the code below to /html/com_k2/templates/default/item.php, but there is no $doc in that php file. Please help me add this to item.php. Thanks in advance!
A related post here:https://www.gavick.com/forums/league-news/wrong-title-and-picture-when-posting-on-facebook-17635.html supposedly makes a similar change to /layouts/blocks/head.php, but when I add that code, the meta content comes out in BODY, not in HEAD, and the several "meta content" lines are nested within eachother. Again, thanks in advance.
Al
I want to add the code below to /html/com_k2/templates/default/item.php, but there is no $doc in that php file. Please help me add this to item.php. Thanks in advance!
- Code: Select all
$doc->setMetaData( 'og:image', 'http://www.images.com/image.png' );
A related post here:https://www.gavick.com/forums/league-news/wrong-title-and-picture-when-posting-on-facebook-17635.html supposedly makes a similar change to /layouts/blocks/head.php, but when I add that code, the meta content comes out in BODY, not in HEAD, and the several "meta content" lines are nested within eachother. Again, thanks in advance.
Al
-
- Fresh Boarder
- teitbite
- Fri Jul 13, 2012 4:03 pm
Hi
I cannot be sure without making numerous of dumps for that, but please try maby with:
if this will not work the best solution would be to make this class one more time.
I cannot be sure without making numerous of dumps for that, but please try maby with:
- Code: Select all
$this->setMetaData( 'og:image', 'http://www.images.com/image.png' );
if this will not work the best solution would be to make this class one more time.
- Code: Select all
$doc =& JFactory::getDocument();
$doc->setMetaData( 'tag-name', 'tag-content' );
-
- Moderator
- GK User
- Mon Jul 16, 2012 10:01 am
Thanks, this got me closer.
For anyone searching about how to use Open Graph with K2 articles and using the item's image as the facebook-share image, here is what worked for me:
in html/com_k2/templates/default/item.php I added the block of code titled "OpenGraph Support" from this page https://www.gavick.com/forums/fb-gk4/og-image-not-generated-15719.html?p=75421&hilit=share%20facebook#p73053. However, I tweaked this code slightly because there were two problems. 1. This code grabs the first image in the article's "text" property. Unfortunately, K2 puts the the html code for the article's image in a separate property than "text." 2. I hide most of my images because I lead with embedded videos. Fortunately, you can access the article's "image" property---even if the image is hidden---simply with $this->item->image.
Al
For anyone searching about how to use Open Graph with K2 articles and using the item's image as the facebook-share image, here is what worked for me:
in html/com_k2/templates/default/item.php I added the block of code titled "OpenGraph Support" from this page https://www.gavick.com/forums/fb-gk4/og-image-not-generated-15719.html?p=75421&hilit=share%20facebook#p73053. However, I tweaked this code slightly because there were two problems. 1. This code grabs the first image in the article's "text" property. Unfortunately, K2 puts the the html code for the article's image in a separate property than "text." 2. I hide most of my images because I lead with embedded videos. Fortunately, you can access the article's "image" property---even if the image is hidden---simply with $this->item->image.
Al
-
- Fresh Boarder
- teitbite
- Mon Jul 16, 2012 3:17 pm
Hi
Yes that's exacly the change I was thinking about to used $this->item->image instead of the code parsing an url to image from content (in this point K2 is easier than regular joomla article), anyway. I do not understand why You had to hide anything ???
Yes that's exacly the change I was thinking about to used $this->item->image instead of the code parsing an url to image from content (in this point K2 is easier than regular joomla article), anyway. I do not understand why You had to hide anything ???
-
- Moderator
- GK User
- Mon Jul 16, 2012 5:04 pm
The reason I hide them doesn't have to do with this topic of Open Graph and K2. See this post https://www.gavick.com/forums/template-discussion/i-want-to-replace-image-with-vimeo-link-video-17739.html?p=83137#p83137
Thanks again for your help.
Thanks again for your help.
-
- Fresh Boarder
- teitbite
- Tue Jul 17, 2012 10:09 am
Hi
Ok. That's good, but I'm pretty sure I could be done in a more automatic way. Maby K2 developers can help with that ? Anyway Your solution is very good, so if this do not bother You than I would leave it the way it's now.
Ok. That's good, but I'm pretty sure I could be done in a more automatic way. Maby K2 developers can help with that ? Anyway Your solution is very good, so if this do not bother You than I would leave it the way it's now.
-
- Moderator
8 posts
• Page 1 of 1