Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-07-05 17:25:03

DragonBard
Member
Registered: 2014-07-01
Posts: 16

Author and Category lists

So what controls the Author and Category lists (https://example.com/author/name and https://example.com/category/name)?

I want those lists to display articles from ALL sections on the site, but they are only showing articles from a single section (blog), and none of the others. What page/forms produces these lists?

I’m using Textpattern 4.8.1.

Thanks.

Offline

#2 2020-07-05 18:27:30

DragonBard
Member
Registered: 2014-07-01
Posts: 16

Re: Author and Category lists

Finally found it and answered my own question.

Category and Article listings derive from the default page. In the section of code where it handles the author and category lists (controlled by an if statement), I just needed to add frontpage="0" to the txp:article tag to allow showing all articles.

Offline

#3 2020-07-05 18:27:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: Author and Category lists

The <txp:article> tag is context-aware and figures out that the URL matches /category or /author. So when your page flow hits a <txp:article> tag, it’ll handle it. The way in which it handles it can be governed by its attributes and conditionals. For example, if you want to have a dedicated article tag to list only category articles in a particular way, then in your default page template (or at least the one you have set to be handled by your front page):

<txp:if_category>
    <h1> Category: <txp:category title /></h1>
    <txp:article form="cat-list" limit="20" />
</txp:if_category>

That would pass each article through cat-list to render the various parts such as title, permlink, excerpt, article image, whatever you want.

In answer to your question about it not pulling them from all sections, I have a couple of thoughts:

  1. If you’re on the front page (/category/some-cat-name) then it might be showing all of them but your limit is only displaying the most recent 10 which may all be from the blog section.
  2. If you’re not on the front page (/section-name?c=some-cat-name) then only the articles from that section are displayed by default and you need to use other attributes (or <txp:article_custom>) to get them all.

Hope that helps.

EDIT: also, frontpage, as you found :)

Last edited by Bloke (2020-07-05 18:30:40)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2020-07-05 20:58:29

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Author and Category lists

I posted this a few years ago

<txp:variable name="task" value="frontpage" />

<txp:if_category><txp:variable name="task" value="category" /></txp:if_category>

<txp:if_search><txp:variable name="task" value="search" /></txp:if_search>

<txp:if_author><txp:variable name="task" value="author" /></txp:if_author>

<txp:output_form form="task-<txp:variable name="task" />" />

I’ve always thought it would be better if we could designate a page for search results or an author listing but that isn’t how Textpattern works.

Offline

#5 2020-07-06 07:10:38

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Author and Category lists

I’m not sure if this also affects the author and category lists, but (thanks for the clarification, Oleg)

For the frontpage it also depends on what settings you have for “Show on default page?” for those sections. If you have them set to “no”, they don’t show without you listing them explicitly.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2020-07-06 09:20:55

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Author and Category lists

jakob wrote #324301:

I’m not sure if this also affects the author and category lists …

Yep.

… but for the frontpage it also depends on what settings you have for “Show on default page?” for those sections. If you have them set to “no”, they don’t show without you listing them explicitly.

You can override this setting with frontpage="0" attribute, as said above.

Offline

Board footer

Powered by FluxBB