Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2026-01-23 09:58:05

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

permlinks

I’m yet to update to the latest release but I get an error when using <txp:permlink id="2147"><txp:permlink /></txp:permlink> in an article.

The html parsed is <a rel="bookmark" href="https://www.site.tld/correct-url">https://www.site.tld/current-article-url</a>


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

Online

#2 2026-01-23 10:52:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,410
Website GitHub

Re: permlinks

You don’t tend to use permlink tags like that. Either:

  1. Wrap the content you want to display in a <txp:permlink>... </txp:permlink> container; OR
  2. Use it as a single tag to ouput the URL to the (current or nominated) article.

What your example is saying:

  • Grab the permlink to article ID 2147. Start making an anchor that points to it.
  • Get the current URL permlink and use it as content for the anchor.

It doesn’t ‘set context’ inside the container for you, so you’ll need:

<txp:permlink id="2147"><txp:permlink id="2147" /></txp:permlink>

OR:

<a href="<txp:permlink id="2147" />"><txp:permlink id="2147" /></a>

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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#3 2026-01-23 17:30:22

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

Re: permlinks

Thanks so much! That did the trick. Here’s the final tag that also trims the https://www. of the url just if anybody needs it.

<a href="<txp:permlink id="2147" />"><txp:permlink id="2147" trim="/^https?:\/\/(?:www\.)?/i" /></a>

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

Online

#4 2026-01-23 18:18:19

etc
Developer
Registered: 2010-11-11
Posts: 5,655
Website GitHub

Re: permlinks

It seems, however, logical to switch the context if id is set. I can not see any reason to link the current article data to other articles.

Offline

#5 2026-01-23 18:56:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,410
Website GitHub

Re: permlinks

I agree. Switching context doesn’t seem invasive in this instance.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#6 Today 05:47:12

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

Re: permlinks

Bloke wrote #342363:

I agree. Switching context doesn’t seem invasive in this instance.

etc wrote #342362:

It seems, however, logical to switch the context if id is set. I can not see any reason to link the current article data to other articles.

Great!!! Thanks so much guys


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

Online

Board footer

Powered by FluxBB