Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-10-20 18:32:12

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Un-hyphenated titles

I want My Article Title 1 for my article titles but I also want to use <txp:title /> in various links — for example, to obtain https://mysite.uk/my-article-title-1-something.jpg. Is there a way to add those hyphens to the unhyphenated title?


BB6 Band My band
Gud One My blog

Offline

#2 2020-10-20 18:50:29

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 307
Website GitHub GitLab Twitter

Re: Un-hyphenated titles

Does not txp:article_url_title fit this goal?

Offline

#3 2020-10-20 18:56:28

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: Un-hyphenated titles

Thanks! I overlooked that tag. It would do it if I wasn’t adding any keywords to my url-only titles. I might make this work if there isn’t another way.


BB6 Band My band
Gud One My blog

Offline

#4 2020-10-20 19:03:43

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

Re: Un-hyphenated titles

Try this:

<txp:title trim=" " replace="-" />

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 2020-10-20 21:13:08

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: Un-hyphenated titles

trim and replace. Perfect! Thanks Stef!

Edit. I looked here but overlooked it, thinking an escape might do it. That’s a very handy page.

Last edited by zero (2020-10-20 21:30:07)


BB6 Band My band
Gud One My blog

Offline

Board footer

Powered by FluxBB