MODX Community

Automating bloglist

Hi all :slight_smile:

I converted my personal website to MODX as well, and now i am trying to create an automated bloglist.

  1. Resource 2 is the page with all the blogposts. The posts are all children of resource 2.
  2. I created a tv, with tag categories to sort my blogposts
  3. I created a chunk to use as a very small template.
  4. Trying to get it working with a getresources call, but failing.

Where do I go wrong?

Resource 2, to list all the posts, is constructed this way:

<div class="usa-width-one-third">
<h3>Category 1</h3>
<ul>
[[getResources? &parents=`2` &includeTVs=`1` &processTVs=`1`  &tvFilters [(tvPostCategorie)(=)](Webdesign)]]
</ul>
</div>

<div class="usa-width-one-third">
<h3>Category 2</h3>
<ul>
</ul>
</div>

<div class="usa-width-one-third">
<h3>Category 3</h3>
<ul>
</ul>
</div>

The bloglist template chunk is as such:
< li>< a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]< /a>< /li>

Or am I thinking way too complex and can it be done in a more simple/elegant way?

try this:

[[getResources? 
&parents=`2` 
&tpl=`bloglist`
]]

does this show anything?

2 Likes

Yes!

It shows 5 results, not all 10? Is 5 the default for getresources?

1 Like

yes, see the limit - property
https://docs.modx.org/current/en/extras/getresources#selection-properties

FYI: Many of us use the pdoTools - Extra as replacements for getResources and Wayfinder
https://docs.modx.org/current/en/extras/pdoTools
They might be a little faster and have more features.

2 Likes

Ah, thank you :slight_smile:
So there is something going wrong with the tv then, which I want to use to filter/create lists by tag/category.

Hm, perhaps is Tagger the better extra…

should be:

&tvFilters=`tvPostCategorie==Webdesign`

but yes, using tagger for tags/categories might be the better option

1 Like