Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-01-09 17:37:27

mkavici
New Member
From: Ankara Turkey
Registered: 2006-03-08
Posts: 9
Website

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

#2 2013-01-09 17:51:05

springworks
Member
Registered: 2005-01-06
Posts: 172
Website

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

#3 2013-01-09 19:52:15

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

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

Board footer

Powered by FluxBB