Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Article image path
Hi,
I would like to add Facebook Open Graph Meta Tags for individual articles.
Such as <meta property=“og:image” content=”<txp:article_image escape=“html” thumbnail=“0” />”/>
The problem is <txp:article_image generates <img/> html tag.
How can I get only path of the article image?
http://cssbased.com/ – designers love nature
Offline
Re: Article image path
Although it is undocumented, I believe you can do something like this:
<txp:image_url id='<txp:custom_field name="article_image" />' />
Offline
Re: Article image path
springworks wrote:
Although it is undocumented, I believe you can do something like this:
This would give you the exact value used in the image field, which necessarily isn’t a path.
You can create custom lists or extract information from an article’s image data using tags such as images, image_url and if_article_image.
<txp:if_article_image>
<txp:images limit="1">
<txp:image_url />
</txp:images>
</txp:if_article_image>
The above gives you path to the first specified image when used on an individual article page. if_article_image
checks if the article has any images, making sure only images specified in the article are listed. images
is the actual listing tag and is used to select the first image from the list of specified images. image_url
then displays the URL to that selected image.
Last edited by Gocom (2013-01-09 19:56:08)
Offline
Pages: 1