Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
<txp:permlink>, but with a select URL format
Say a Textpattern site uses /section/id/title/
for its article permlink format…but I want to find the /section/title/
equivalent URL stub (i.e., no id
in the mix), what’s the sanest way to do this, please? Is there some hidden magic in permlink
?
This is a bloody good CMS, I really should learn it some day.
Last edited by gaekwad (2020-12-02 15:25:37)
Offline
Re: <txp:permlink>, but with a select URL format
You can do it either on a per section basis presentation>sections>click on section or globally in preferences.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: <txp:permlink>, but with a select URL format
Thanks, Yiannis. I should have explained more clearly.
I’m using <txp:article_custom />
with an article form that uses <txp:permlink />
. What I’m wondering is whether it’s possible to override the site’s (or selection’s) chosen URL slug type within <txp:permlink />
, something akin to (bogus code, won’t work):
<txp:permlink urlmode="section-title" />
…and for this to output the ‘/section/title’ permlink instead of whatever the site or section is set too.
I managed to bodge a way around it for now, but I’m curious as to whether it’s possible.
Offline
Re: <txp:permlink>, but with a select URL format
Not possible automatically as far as I’m aware at the moment. The <txp:permlink />
tag will set its output to the URL scheme of the matching section in which the destination content resides. I can’t see a concrete reason to bypass this, since doing so may invalidate the URL. What’s your use case for this functionality?
Possible exceptions are messy mode which works all the time anyway, and sometimes variants of /section/id can work without the title, since by the time the ID is known, the article title is a formality and is (internally) ignored in favour of the ID.
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
Re: <txp:permlink>, but with a select URL format
gaekwad wrote #327206:
Say a Textpattern site uses
/section/id/title/
for its article permlink format…but I want to find the/section/title/
equivalent URL stub (i.e., noid
in the mix)…?
I just build the urls manually in such cases, e.g.:
</txp:site_url /><txp:section/>/<txp:article_url_title />
The question is whether your section then recognizes that. I’ve forgotten exactly, but some url schemes will, I believe, recognize the standard section/article-url-title schemes.
TXP Builders – finely-crafted code, design and txp
Offline
Re: <txp:permlink>, but with a select URL format
Yep, building them manually should work fine if there’s a unique title. In the event there’s a duplicated title, all bets are off (well, okay, you get the first, probably. Or the last. Uhhh, yeah, dunno. All bets are off).
Beyond messy mode, /section/title is the most permissive format as it’s the one we try hardest to match regardless of how mangled the URL seems. If there’s a matching article in the section, we’ll try and return it even if the permlink scheme is something else. But if you add a trailing slash then this behaviour is stopped because it’s deemed to be a landing page.
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