Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-12-05 13:09:55

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Permlink including article category

I have a search function on the website I’m currently building with Textpattern. It works fine, apart from the links on the search results page. I have a separate Search page and the search results links are displayed with txp:permlink><txp:title /></txp:permlink>
I have article categories and currently the permlink does only direct to the section and does not add the article categories of that section. I read that permlink does by default only go to the section, so how do I include the category?
Basically it displays at the moment as http://www.hssptyltd.com.au/textp/accumulators
But I want to display http://www.hssptyltd.com.au/textp/product-categories?c=cat-accumulators

Any help is much appreciated.
otti

Offline

#2 2011-12-05 13:21:23

totoff
Member
From: Cologne, Germany
Registered: 2011-04-04
Posts: 145
Website

Re: Permlink including article category

hello otti,

the permlink tag should link to the article (what it does in fact in your example). i have no experience with search result pages, but you should check out if <txp:category_list /> can help you as permlink won’t do the job.

another solution might be rss_suparchive plugin or smd_tags which, in addition, would give you more tags do work with.

Offline

#3 2011-12-05 13:39:12

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Re: Permlink including article category

Hi Totoff,
Had already a look into category lists, but the problem seems to lie deeper in the search. It searches and finds the article, which has the article category assigned to, but does not show the link inclusive of the category as URL. Will have to dig deeper maybe using the additional tags you have suggested.

Many thanks
otti

Offline

#4 2011-12-05 14:08:09

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: Permlink including article category

hi otti

if you want to link to a category instead of article you can go to form “search_results” and change

<txp:permlink><txp:title /></txp:permlink>

to

<txp:category1 section="textp"><txp:title /></txp:category1>

But if your goal is to change the article link to something including category into it, that s not doable using core tag of txp, maybe using gdp_permanent_link plugin can help you in that case.

Offline

#5 2011-12-05 23:50:15

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Re: Permlink including article category

Hi Dragondz,

Thanks very much for that tip. I have tried

<txp:category1 section="textp"><txp:title /></txp:category1> 

but it adds a forward slash between the section and the category i.e.

http://www.hssptyltd.com.au/textp/product-categories/?c=cat-accumulators instead of
http://www.hssptyltd.com.au/textp/product-categories?c=cat-accumulators

Is there a way to delete the forward slash? If not, I will have to investigate into the suggested plugins.

Many thanks
otti

Offline

#6 2011-12-06 04:16:46

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Re: Permlink including article category

Hi guys,

Just to let you everyone know that I found the solution. I have used the following code in my search results form:

<a href="<txp:site_url /><txp:section />?c=<txp:category1 />"><txp:category1 title="1" /></a>

It eliminates the separator (slash) between the section and the category name in the URL. This, together with a if article category loop for pages without categories will do the trick.

Many thanks again to you all.
otti

Offline

Board footer

Powered by FluxBB