Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-11-12 12:23:58

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

txp:section name="about" in category/single article shows wrong link

Issue 128: 4.4.1: txp:section name=“about” in category/single article shows wrong link

Please check if you can reproduce Issue 128

Excerpt

Expected (my workaround)
<a title="..." href="<txp:site_url />about">Impressum</a>

Error condition:
<a title="..." href="<txp:section name="about" />">Impressum</a>

Example I. – Category page
On page: http://advokathamburg.de/kategorie/die-kosten-der-scheidung/
Output: http://advokathamburg.de/kategorie/die-kosten-der-scheidung/about

Example II. – Single article page
On page: http://advokathamburg.de/articles/10/scheidung-kosten-familienrecht
Output: http://advokathamburg.de/articles/10/about

A short ‘reproducible +1’ comment here helps to validate the issue :)

Last edited by merz1 (2011-11-12 12:24:18)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#2 2011-11-12 15:27:13

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: txp:section name="about" in category/single article shows wrong link

The tag <txp:section />, as single tag (and with default attributes) will just return information about the section. In this case, the section name (the string “about” in your example).
So, the generated output of what you stated as an “error condition” is:

<a title="..." href="about">Impressum</a>

That would be a relative URL to the current URL, and that’s why you end up with links to /some/wrong/place/about.

Bottom line: it’s not an issue, but wrong usage/understanding of relative URLs. Do you agree?

And your workaround is not a workaround, imo, but the correct way.
You could even do it shorter way, like this:

<a title="..." href="/<txp:section name="about" />">Impressum</a>

The slash at the start will “absolutize” the URL.

Alternatively, you could use <txp:section></txp:section> (as container tag) but you may not have too much control over the markup of the <a> tag (more precisely, its attributes, like title, class, etc, if needed).

Last edited by maniqui (2011-11-12 15:28:09)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2011-11-12 15:42:49

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: txp:section name="about" in category/single article shows wrong link

merz1 wrote:

A short ‘reproducible +1’ comment here helps to validate the issue :)

Reproducible, yes, as that is what it’s supposed to do. In other words, the report is invalid. <txp:section name="about" /> outputs section name, not a URL, nor a link.

For example:

<a href="<txp:section name="about" />">Impressum</a>

Results to:

<a href="about">Impressum</a>

As expected. The resulting link will be incorrect on sub-pages as it is relative to current location. To produce a link to section, you can either use link attribute with the section tag or any other of:

  1. <txp:section name="about">Impressum</txp:section>
  2. <txp:section name="about" title="1" link="1" />
  3. <a href="<txp:site_url /><txp:section />">Impressum</a>

Edit. Me slow turtle, Julián ninja.

Last edited by Gocom (2011-11-12 15:44:39)

Offline

#4 2011-11-12 18:54:18

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: txp:section name="about" in category/single article shows wrong link

Hmpf, smart explanations indeed. Thanks a lot guys :)

Bottom line: it’s not an issue, but wrong usage/understanding of relative URLs. Do you agree?

Grmpf, yes, I agree. My fast reading missed the Otherwise, it will return plain text. ‘hidden’ on top of the documentation.

But the wording Sets the link (twice) in the tag documentation is really misleading.

name=“section name”
Sets the link to the named section.
Default: unset (sets the link to the current section)

PS: Added a status ‘invalid’ comment to issue 128.

PPS: But maybe you can check the issue 127 :)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#5 2011-11-12 23:36:06

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: txp:section name="about" in category/single article shows wrong link

merz1 wrote:

But the wording Sets the link (twice) in the tag documentation is really misleading.

I agree. Better like this?

Offline

#6 2011-11-13 09:36:42

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: txp:section name="about" in category/single article shows wrong link

Yes, better. Maybe example 4 should also get a ‘single tag’ line.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#7 2011-11-13 17:35:02

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: txp:section name="about" in category/single article shows wrong link

Done :)

Offline

#8 2011-11-13 18:50:11

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: txp:section name="about" in category/single article shows wrong link

Thanks :)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB