Nightmares
Sir gramham pls help me check my blog, I changed the display format to 10 and I started showing my default blog image
Graham
Nightmares you had changed display="5" (title 1st image and description) to display="20" which means the image data was not being displayed
Nightmares
Graham Graham sir, pls is there any possible way to add image preview to my xtgem site when I share my link on facebook .
E.g is is share this link on Facebook @
http://www.nightmareclick.com.ng/2018/03/aap-rocky-bad-company-ft-blocboy-jb.html
Is will pop up with an image but its not so with my xt site.
Pls help
Graham
Nightmares the answer is og:meta tags I will try and figure out a method of creating them for your posts over the weekend it has to be done right for FB as they are quite fussy they cannot be in the <body> or created using JS so it probably will have to be a twig/xtscript/xtGetVar combo
Nightmares
Graham Hello sir, pls are you done with the meta code?
Graham
Nightmares Sorry I got sidetracked with other issues I will look into it today
Graham
Nightmares This is the updated code for facebook og tags
I have tested this on one of my own blogs and it works although
facebook may have old versions of your share data cached and it will be up to you to get this reset
https://developers.facebook.com/tools/debug/sharing/batch/
This will only work on blogs that are output by xtscript and have a twig template file
The script creates AUTOMATIC facebook og meta tags using the posts title text content canonical URI and the FIRST image found in the post
I have already updated this on your site nightmareclick
This needs to go in your blog twig just below the
{% elseif view == 'entry' %} Line
<!--og_tags={{ data.post.title|replace({('$'):'$',('('):'('})|raw }}||{{data.post.content|striptags|trim|replace({('$'):'$',('('):'(',('"'):'"', ('\n'): ' ', ('\r'): ''})[:300]|raw}}||{{data.post.content|split('<img')[1]|split('src="')[1]|split('"')[0]}}-->
Copy code
Here is the actual xtscript code it needs it needs to be inserted after the blog has been assigned to a xtscript variable ( this expects it to be $blog )
# FB OG TAGS
get __xtblog_entry
if not $__xtblog_entry or not $blog
var $fb_og ={{
<meta content="DEFAULT TITLE" property='og:title' />
<meta content="SITE DESCRIPTION (max 300 chars)" property='og:description' />
<meta content='<xt:url/>' property='og:url' />
<meta content='website' property='og:type' />
}}
goto @skip_og
endif
var $og_tags_s = call strpos $haystack=$blog;$needle=og_tags=
var $og_tags_s = ($og_tags_s+8)
var $og_tags_e = call strpos $haystack=$blog;$needle=-->;$offset=$og_tags_s
var $og_tags = call substr $val=$blog;$start=$og_tags_s;$length=($og_tags_e-$og_tags_s)
var $og_title_s = 0
var $og_title_e = call strpos $haystack=$og_tags;$needle=||;$offset=$og_title_s
var $og_title = call substr $val=$og_tags;$start=$og_title_s;$length=($og_title_e-$og_title_s)
var $og_descr_s = ($og_title_e+2)
var $og_descr_e = call strpos $haystack=$og_tags;$needle=||;$offset=$og_descr_s
var $desc_len = ($og_descr_e-$og_descr_s)
var $og_descr = call substr $val=$og_tags;$start=$og_descr_s;$length=$desc_len
if $desc_len >= 300
var $spc=call chr $val=32
var $lstspc=call strrpos $haystack=$og_descr;$needle=$spc
var $og_descr= call substr $val=$og_descr;$start=0;$length=$lstspc
endif
var $og_img_s = ($og_descr_e+2)
var $og_img_e = call strpos $haystack=$og_tags||;$needle=||;$offset=$og_img_s
var $og_img = call substr $val=$og_tags;$start=$og_img_s;$length=($og_img_e-$og_img_s)
var $fb_og = {{
<meta content='<xt:canonical_uri/>' property='og:url' />
<meta content='article' property='og:type' />
<meta content="$og_title" property="og:title" />
<meta content="$og_descr" property="og:description" />
<meta content='$og_img' property='og:image' />
}}
@skip_og
Copy code you then need to add this to the
<head> area of the blog page using text editor
Nightmares
Graham Can't I just add it to my xt script instead of putting it in every post
Graham
Nightmares I have updated the code below and the code on your site to the AUTOMATIC version
what you do still need to do is go to
https://developers.facebook.com register start a project and get an app_id this then needs to go in a fb:ap_id meta tag in your pages <head> area
<meta content='YOUR APP_ID' property='fb:app_id' />
Copy code
Nightmares
Graham Thanks Sir.
But pls I need this other code, I've been trying to generate mine but I failed.
In the photos below, ( one is the xt forum; the "inbox and your feed" has a div property that makes it float and always hang on the screen.
The second photo shows the same thing, so what am asking is for the code the enables them to maintain this position.
Thanks.