Timber: How to set permalink in Timber's twig?

Created on 3 Dec 2015  路  1Comment  路  Source: timber/timber

I want to link to different posts from within a twig file. I expected I could do something like <a href="{{site.post.id(100)}}"> but could not find any reference for this.

Right now, the only way to do it is using {{function('get_permalink',100) }}.

Is that best practice? What do you suggest me to do?

question

Most helpful comment

Try....

<a href="{{ TimberPost(100).link }}">

... TimberPost( 100 ) will retrieve a TimberPost object of ID 100 and then you can access the standard properties/methods on it

>All comments

Try....

<a href="{{ TimberPost(100).link }}">

... TimberPost( 100 ) will retrieve a TimberPost object of ID 100 and then you can access the standard properties/methods on it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jarednova picture jarednova  路  5Comments

claudiopedrom picture claudiopedrom  路  5Comments

ogrosko picture ogrosko  路  4Comments

JakeHenshall picture JakeHenshall  路  4Comments

chaimaech picture chaimaech  路  4Comments