Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-04-03 11:45:19

dylan-c
Member
From: Maine
Registered: 2012-07-09
Posts: 13

Permlinks with HTML anchor tags

Any tips for using permlinks with an anchor link?

Permlink generates the web address of the current article, which I need, but it’s “prewrapped” in the <a> tag.

I need to append an anchor link (#commentanchor) to the end. Any workarounds come to mind? Or maybe there’s another tag for this as part of the suite of comment-related tags?

Thanks so much :)

Last edited by dylan-c (2019-04-03 11:49:31)

Offline

#2 2019-04-03 12:00:33

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,191

Re: Permlinks with HTML anchor tags

dylan-c wrote #317470:

#commentanchor

Simply use that for the href value, verbatim, no need for suffixes, permlinks, tags, workarounds.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2019-04-03 12:14:47

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,388
Website

Re: Permlinks with HTML anchor tags

But if you do need to generate the anchor from the article, for example to jump to a position on a page with a list of multiple articles, use txp:article_url_title e.g.:

<a href="https://www.mydomain.com/section-name#<txp:article_url_title />"><txp:title /></a>

An example might be a list of articles as entries in a calendar.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2019-04-03 12:16:59

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,388
Website

Re: Permlinks with HTML anchor tags

Or if you meant specifically for @#comments, then use txp:permlink as a single tag, not as a container:

<a href="<txp:permlink />#comments">Go straight to comments</a>

On the same page as the article, you just need

<a href="#comments">Jump to comments</a>

as Uli mentioned.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB