Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
archive examples...
Can anyone point out some Txp sites that demonstrate two-level article archives that are also categorized? I’m not interested in date archives (the articles themselves will have dates).
What I have in mind is something where (at a section-level, but not necessarily section-specific) you click category link that takes you to a view with a list of articles in that category and has a URL that looks something like this: domain.tld/section/category/
Click an article in the list and it takes you to the full article with an URL something like this: domain.tld/section/category/article-title
So you could theoretically have a URL like: domain.tld/archive/garden/unstoppable-rhubarb
I’m sure it’s not possible with Txp core (or it’s not very intuitive) or there would be more sites doing it.
Another curiosity I have, is when I use something like…
<p class="folio-cat">See all "<txp:category1 title="1" link="1" />" entries.</p>
It gives me a an actual link like this domain.tld/category/category-name/
That could work for me if I knew how to exploit it, but I don’t understand that default behavior or what I’m supposed to do with it. Am I supposed to create a new section-page combo (Section called “category”) and add the necessary output code?
I feel like I’m starting at square one again. :)
Offline
Re: archive examples...
Hi Destry,
Yes, it’s easily doable, using gbp_permanent_links.
For an example, check your Twitter DM box, as I’ve sent you a private link there.
PS: starting at square one again? Lot of old and new fun ahead!
Offline
#3 2010-04-30 23:31:06
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: archive examples...
Destry wrote:
Another curiosity I have, is when I use something like…
<p class="folio-cat">See all "<txp:category1 title="1" link="1" />" entries.</p>
It gives me a an actual link like this
domain.tld/category/category-name/
That could work for me if I knew how to exploit it, but I don’t understand that default behavior or what I’m supposed to do with it. Am I supposed to create a new section-page combo (Section called “category”) and add the necessary output code?
The category(1/2/_list)
tags without the section
or this_section
attribute, that create the /category/category-name URLs, link to the front page, so you need to place your article tag(s) to display the articles in the default template (preferably inside if_category
tags).
When the section
or this_section
attribute is used, the links look like /section-name/?c=category-name, and go to your section page. Like Julián said, you can use gbp_permanent_links to get /section-name/category-name/ and /section-name/category-name/article-title.
Without the plugin it’s not possible to have both the category name and the article title in the URL.
Offline
Re: archive examples...
Thanks to you both! Each of your responses provided good insight. This should get me going down the right track.
Offline
Re: archive examples...
So I’m employing the gpb_permanent_links and so far so good with that. The extent of the plugin’s power is beyond me without docs, but so far so good.
The txp side of it, however, isn’t quite there, so I’m looking for help. Following is a little model that should help make the context clear…

The model involves the Articles and Archive sections. Pretty typical. The default view for the Articles section is the current article. The default view for the Archives section will likely just be a sticky article (see discussion at bottom).
On each section/page (a 1:1 match) there is an identical category list for articles in the “archive system” (columns B and D). This is done using the <txp:category_list />
tag.
Orange arrow – If a visitor is in the Articles section and clicks a category in column B, they go to the Archive section and see a list of articles specifically for that category in column C. [DOESN’T WORK, EXACTLY.]
Purple arrow – If while in the Archive section the visitor clicks an article link displayed in column C, they are taken back to the full article display in it’s native section, Articles.
Green arrow – If wile in the Archive section the visitor clicks a new archive category in column D, the article list in column C is updated with the new category’s articles. [DOESN’T WORK, EXACTLY.]
In each case where it’s not working, I get article list output in column C, but it’s not showing just the articles from the selected category (the category in context); it shows those at the top of the article list, plus additional articles underneath them. So the part that doesn’t work, as you can see, might be the same problem in each case. Following are the blocks of code, respectively…
B and D category lists (save in “category” Form format)…
<txp:category_list section="archive" wraptag="ul" class="catslist" break="li" activeclass="active-cat" children="0" />
C column article list output (saved in “article” Form format)…
<div class="archive-intro">
<txp:article_custom id="128">
<txp:body/>
</txp:article_custom>
</div>
...
<txp:article_custom form="lstArchives" sortby="Posted" sortdir="desc" wraptag="ul" break="li" section="articles" />
Discussion:
The first part of the article output in the Archive section includes the body of a sticky article, which always needs to be in the Archive section; though if necessary I could make that a static content Form instead of a sticky article (I haven’t tried that to see if it makes a difference). This sticky article alone will probably end up being the default view of the Archive section (i.e., if someone enters the site at domain.tld/archive/
), they will only see the sticky article. So there’s obviously the conditional missing from the code above too.
But the article list display problem seems to be with the second part defining the article list output in context to the clicked category. I’ve tried adding something silly like category="<txp:category1 />"
as an additional attribute (because all categories are defined in the first category for each article), but that just made the entire list of articles disappear.
Can anyone set me straight. It’s probably something stupid, I’m sure.
Oh, one other question. I want to add a Archive/Category breadcrumb between the sticky article and the article list output as a kind of header for the list. For example: Archive » Category-Name. What’s the best plugin du jour for that which works nicely with gpb_permanent_links?
Offline
Re: archive examples...
Hi Destry,
a quick thing to try: on your last tag, instead of trying category="<txp:category1 />"
(which you said it failed making the article list dissappear), just try category='<txp:category1 />'
(single straight quotes, only way to summon the tags in tags power).
Regarding the breadcrumb, are there going to be many nested levels of categories? Like: Archive > Parent Category Title > Subparent Category Title -> Current Category Title?
Or, even if you are using nested categories, you would just need a one-level depth breadcrumb (Archive -> Category Title)?
I don’t know of any plugin that specifically does the breadcrumb job, but let me tell you that if you have a few smd_
plugins in your toolbox, you will be probably able to sculpture a nice breadcrumb that fits your needs. More precisely: smd_if
, smd_each
and smd_parent
(ths latter one is a must-to when working with nested categories, as it let’s you fetch the parents categories).
Hopes this help you, at least, to begin with.
Offline
Re: archive examples...
BTW, soryby
and sortdir
is deprecated, you should use just sort="Posted desc"
.
Offline
Re: archive examples...
Thanks for the thoughts, Julian.
The single-quotes didn’t seem to do anything. I still get more articles in the list than are actually in the category.
Yes, the breadcrumb will always only be section/category, so I’ll play around with that. (I love Bloke’s plugins too.)
And thanks for catching the deprecated attributes. That’s what I get from copy/paste. I need follow that history back now and kill all of those.
Back to the drawing board…
Offline
Re: archive examples...
Ops, I think I’ve (hopefully) spotted the error:
category='<txp:category1 />'
should be category='<txp:category />'
.
Try that one, I think you may have a winner.
Offline
Re: archive examples...
Bingo!
You would have thought I would have thought to try changing that, but…
Thanks, Julian! You are the tag master! :)
Offline
#11 2010-05-05 13:29:59
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: archive examples...
Can you post the code that you used to obtain that two-level archive, please? I’m interested, thanks!
Offline
Re: archive examples...
The code is already shown in a previous post of this thread, with the exception of the correction Julian kindly pointed out after that. The model is just like the diagram shown there.
The two level (perceived only in the URL) is made possible by using gbp_permanent_links. It’s not physically two levels, and not two sections at that; rather the plugin makes it possible to have section/category URLs which give the impression of more structured depth, for example: domain.tld/section/category/article-title
Offline