Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2019-06-10 13:37:07
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,289
article image field as facebook meta property
is it possible to achieve?
Offline
Re: article image field as facebook meta property
Edit: ignore this, use colak’s example below.
textpattern.tips/implementing-facebook-services-on-textpattern-articles-via-fbml
Last edited by gaekwad (2019-06-11 10:53:57)
Offline
Re: article image field as facebook meta property
Gallex wrote #318439:
is it possible to achieve?
Hi Gallex
Check how we went about it for facebook (og standard) and twitter starting on line 71 on github. You can adapt that code by using <txp:custom_field name="article_image" />
.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: article image field as facebook meta property
FYI Facebook’s FBML was discontinued years ago. Colak’s example is the way to go.
Offline
Re: article image field as facebook meta property
Example:
<meta property=“og:image” content=“https://yourdomain.com/img/<txp:custom_field name=“article_image” />.jpg” />
Offline
#6 2019-06-11 11:09:27
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,289
Re: article image field as facebook meta property
towndock wrote #318446:
Example:
<meta property=“og:image” content=“https://yourdomain.com/img/<txp:custom_field name=“article_image” />.jpg” />
you are using it like this?
Offline
#7 2019-06-11 11:33:30
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,289
Re: article image field as facebook meta property
colak wrote #318442:
Hi Gallex
Check how we went about it for facebook (og standard) and twitter starting on line 71 on github. You can adapt that code by using
<txp:custom_field name="article_image" />
.
thank’s colak! i start to investigate it.
first issue:
p. this: <meta property="og:url" content="<txp:site_url /><txp:page_url />" />
outputs this: <meta property="og:url" content="https://www.mysite.ee//portfolio/">
look, extra slash before section name
Last edited by Gallex (2019-06-11 11:34:13)
Offline
Re: article image field as facebook meta property
Whoops I recently changed that in order to make it more generic. You can change it by using <txp:permlink />
for individual articles and http://www.yoursite.tld<txp:page_url />
for section landing pages. It all depends of course on how you use your site. The example allows only for sections and individual pages and has not been tested with categories author urls.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: article image field as facebook meta property
Gallex wrote #318447:
you are using it like this?
Yes, for many years. It of course presumes that your image directory is “img”.
Example article with Facebook & Twitter meta:
https://towndock.net/shippingnews/s-v-misto
Offline
#10 2019-06-12 09:22:04
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,289
Re: article image field as facebook meta property
in article pages colak solution
<txp:if_description><meta property="og:description" content="<txp:meta_description format="" />" /></txp:if_description>
works well if user has inserted something into article’s description field, if not, no facebook meta description.
for google i use rah_metas plugin for that:
<txp:if_description><txp:meta_description /><txp:else />
<txp:rah_metas description_from="body" description_replacement="1" /></txp:if_description>
tried to implement it into facebook’s meta too, but with no success:
<txp:if_individual_article>
<meta property="og:description" content='<txp:rah_metas description_from="body" description_replacement="1" />' />
</txp:if_individual_article>
is it possible to use it, what you think?
Offline
Re: article image field as facebook meta property
Hi Gallex,
re description, you can use:
<txp:if_description>
<meta property="og:description" content="<txp:meta_description format="" />" />
<txp:else />
<meta property="og:description" content="<txp:excerpt />" />
</txp:if_description>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#12 2019-06-12 13:00:46
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,289
Re: article image field as facebook meta property
Gallex wrote #318457:
<txp:if_individual_article> <meta property="og:description" content='<txp:rah_metas description_from="body" description_replacement="1" />' /> </txp:if_individual_article>
just show you, how facebook displays the code above:
<meta name="description" content="this is description text from article body..." />
Offline