Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2025-07-20 05:03:06

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,197
Website GitHub Mastodon Twitter

permlink

I’m not sure if it is a bug but when I use <txp:permlink id="1"><txp:title /></txp:permlink> in an article, it returns the current article’s title, linked to the article with the id I specify.

ie. Instead of producing <a rel="bookmark" href="https://example.com/index.php?id=2">Linked article title</a>, it returns <a rel="bookmark" href="https://example.com/index.php?id=2">Current article title</a>.

I would expect that <txp:title /> would respond contextually, as it is described in the docs here and here.

>Edit:

Interestingly if I wrap the tags in article_custom, <txp:article_custom><txp:permlink id=“1”><txp:title /></txp:permlink></txp:article_custom>
it returns
<a rel="bookmark" href="https://example.com/index.php?id=1">Current article title</a><a rel="bookmark" href="https://example.com/index.php?index.php?id=1">Linked article title</a>

Last edited by colak (2025-07-20 05:37:34)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2025-07-20 05:48:17

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

Re: permlink

Which version of Txp? Has permlink ever changed context, given it is designed to be used within an article to return the current article link? It does kind of feel as if it should temporarily switch context if used with the ID attribute.

In the meantime, you can cheat by wrapping the permlink tag with article_custom id=“xx”.


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 2025-07-20 05:53:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,197
Website GitHub Mastodon Twitter

Re: permlink

Bloke wrote #340013:

Which version of Txp? Has permlink ever changed context, given it is designed to be used within an article to return the current article link? It does kind of feel as if it should temporarily switch context if used with the ID attribute.

In the meantime, you can cheat by wrapping the permlink tag with article_custom id=“xx”.

I tested in Pete’s current dev install as well as on my 4.9.0-dev (d72fbb8ac8a902583c01b17537647986). I was actually thinking of using the article_custom tag, but as it will be an article with over 150 internal links, it would be a bloat.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2025-07-20 06:41:35

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,197
Website GitHub Mastodon Twitter

Re: permlink

I was just thinking that the cool functions of the permilnk & title is that they can automatically update when there is a change in the article URL patterns, or a change in the title. After we use them, we can stop thinking about them.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2025-07-20 07:06:33

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,417
Website

Re: permlink

FWIW, I can reproduce this with TXP 4.9-dev and TXP 4.8.8.

This works fine (4.9-dev):

<txp:article_custom id="xxx"><txp:permlink><txp:title /></txp:permlink></txp:article_custom>

If needed multiple times I’d build a simple <txp:shortcode />.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#6 2025-07-20 14:19:04

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,197
Website GitHub Mastodon Twitter

Re: permlink

Thanks so much Philippe. I opted to go for: <a rel="bookmark" href='<txp:permlink id="2208" />'>my title</a> as it is needed over 150 times. If there was another two fields in the links pane, I would have done it all in there.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB