Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-02-21 19:06:29

mericson
Member
Registered: 2004-05-24
Posts: 137
Website

'absolute' attribute on txp:permlink

I saw another thread on the topic of absolute vs. relative urls generated by permlink. In general I like that relative permalinks are created, because the browser knows how to fix them up. I have since found a very compelling use case to have an option to create absolute URLs via txp:permlink.

There are many ‘widgets’ today that allow social linking and other inline capabilities (my use case is addthis). Many of those widgets let you optionally provide the URL rather than taking the page URL (useful for article lists). However, I have found some of these widgets aren’t as smart as the browser about fixing up the internal site link to add the http://domain prefix.

For those cases I woudl find it very useful if there was an attribute on txp:permlink like absolute=“1” to enable full URL.

Offline

#2 2011-02-21 21:26:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: 'absolute' attribute on txp:permlink

mericson wrote:

For those cases I woudl find it very useful if there was an attribute on txp:permlink like absolute=“1” to enable full URL.

In such cases, can the following syntax help?

<a href="<txp:site_url /><txp:permlink />">Add this</a>

Without knowing anything about addthis I dunno if that’s useful.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2011-02-21 21:40:24

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: 'absolute' attribute on txp:permlink

I always thought the permlink tag did output the absolute URL? If not, what is that hu in the code?

Offline

#4 2011-02-21 21:53:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: 'absolute' attribute on txp:permlink

Els wrote:

I always thought the permlink tag did output the absolute URL? If not, what is that hu in the code?

So did I, but mericson implies not. I can’t remember the truth! hu should be good enough to guarantee an absolute URL.

Last edited by Bloke (2011-02-21 21:55:30)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2011-02-22 05:22:44

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

Re: 'absolute' attribute on txp:permlink

He could be using a plugin that modifies the permlinks. The permlink tag does output full URL, but for example gbp_permanent_links changes that behavior.

Offline

Board footer

Powered by FluxBB