Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-01 16:18:49

kelper
Member
Registered: 2005-05-27
Posts: 28

How to clean up category URL's?

Out of the box, textpattern displays categories as the following:
www.mydomain.com/?c=meaningful-labor
and that is with clean URL’s on.

Is there a plugin to make the category URL’s more clean?

I’ve thought of creating a static page in Textpattern and listing the top ten articles of a certain category, but I was wondering if that was the only way.

Offline

#2 2006-04-01 16:22:51

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: How to clean up category URL's?

www.mydomain.com/category/meaningful-labor doesn’t work for you? That’s usually how it works when clean url’s are on.

Offline

#3 2006-04-01 19:17:23

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: How to clean up category URL's?

That’s right, out of the box, if you have clean urls turned on, then most of the category links generated are clean links (i.e: in the form Elenita posted). I think you are referring to the popup tag? – it doesn’t use clean urls.

Offline

#4 2006-04-02 15:12:02

kelper
Member
Registered: 2005-05-27
Posts: 28

Re: How to clean up category URL's?

Right, I seem to have made a tiny mistake.

How would I change the page that the category uses? I cannot seem to find how to change the section it uses.

Offline

#5 2006-04-02 15:58:02

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

Re: How to clean up category URL's?

A category list page uses the default page. If you want it to use a section page (like yoursite.com/section/category), see the example here.

Offline

#6 2006-04-02 17:28:42

kelper
Member
Registered: 2005-05-27
Posts: 28

Re: How to clean up category URL's?

That post just really, really confused me. I keep rereading it over and over, but I can’t seem to figure it out. Can someone attempt to try and explain it to me.

What I want is are five of the newest articles of a category to be displayed on the category page but with my layout. I can’t seem to figure out that post.

Offline

#7 2006-04-02 18:18:05

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

Re: How to clean up category URL's?

Maybe I misunderstood what it is you want to do.

What I want is are five of the newest articles of a category to be displayed on the category page but with my layout. I can’t seem to figure out that post.

It’s the ‘but with my layout’ that is not clear to me. By default a category list uses the default page, so I assume it’s not the default page’s layout that you want the category list to use. What layout then do you mean exactly?

Offline

#8 2006-04-02 19:06:04

kelper
Member
Registered: 2005-05-27
Posts: 28

Re: How to clean up category URL's?

The situation in that post describes my situation. The default page of my layout is mainly static content. So when a link to a category is clicked, it just displays the static content that describes what the website is about.

I’d like the template of the category to not be default. I guess this is what that post fits, right? I can’t seem to understand how to get it to work.

Offline

#9 2006-04-02 22:11:10

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

Re: How to clean up category URL's?

On the page template for the section (let’s say the section name is ‘section-one’ and it contains articles with categories ‘category-one’ and ‘category-two’):
<code><txp:if_category name=“category-one”>
<txp:article_custom category=“category-one” />
</txp:if_category>
<txp:if_category name=“category-two”>
<txp:article_custom category=“category-two” />
</txp:if_category>
</code>
If you have links to category pages in your article form (the default links are like <txp:category1 link=1 />), replace them with <a href="<txp:site_url /><txp:section />/?c=<txp:category1 />"><txp:category1 title=1 /></a> (and the same for category2 if relevant).

If you have a menu on the home page or elsewhere that should point to the category pages you should code the links to the category pages like this:
<code><a href=”<txp:site_url /><txp:section name=“section-one” />/?c=<txp:category name=“category-one” />”><txp:category name=“category-one” title=1 /></a></code>.

Offline

#10 2006-04-02 23:24:52

kelper
Member
Registered: 2005-05-27
Posts: 28

Re: How to clean up category URL's?

I just can’t seem to get this to work.
So, in my “sections” tab, I have the “default” section with the page pointing to default and the style using my default style. So, I have to edit the “default” page, right? since the category automatically uses “default”?

So, in my “default” page, I’m putting those if_category statements, but still, when I go to my www.url.com/category/Category-Name, it just displays my static content.

Alright, here’s inside the div of the page where the content should reside:
Nevermind, the code messes up when I try to post.

In my default page, how would I make it so, if Textpattern recognizes this is the category called “Green Widgets” it displays the latest ten articles of “Green Widgets”, or if it’s “Blue Widgets” it displays the top ten articles of “Blue Widgets”, and if it’s not a category at all, it just displays my static content that says “Welcome, etc., etc.” When I try to use your if, then category code, the articles don’t show up. Only the static content. It’s sort of hard to explain.

Well, what I’m thinking is, should I just create a bunch of static pages and in essence, they can be the category pages? I’ll just have them list the newest ten articles of that category.

Last edited by kelper (2006-04-02 23:31:03)

Offline

#11 2006-04-03 00:26:52

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: How to clean up category URL's?

FAQ: How do I post tags and code on the forum?

or you can use pastebin.

Either way, it will be helpful to see the relevant contents of your ‘default’ page code.

-Kurt


kurt@kurtraschke.com

Offline

#12 2006-04-03 03:20:52

kelper
Member
Registered: 2005-05-27
Posts: 28

Re: How to clean up category URL's?

Alright, I’ll post the troubling part.

<code>
<div id=“main”>
<txp:if_category name=“Green-Tea”>
<txp:article_custom category=“Green-Tea” form=“category_list” limit=“5” sortby=“Posted” sortdir=“desc” />
<txp:else /> <h2>Green Tea Introduction</h2> <p>Don’t want to post too much. Don’t want to post too much. Don’t want to post too much. Don’t want to post too much. Don’t want to post too much.</p>
</txp:if_category>
</div>
</code>

I’m trying to make it so if it’s the category it will post the top 5 new articles in the category.

Offline

Board footer

Powered by FluxBB