开发者

Drupal Views display newest content per taxonomy limit to one node

I want to create a view where all 5 of my taxonomy terms are displayed and it then displays the latest node published but this is limited by 1. For E开发者_运维技巧xample:

Tax Term 1

Latest node published

Tax Term 2

Latest node published

etc etc

Currently I'm grouping by taxonomy term so it's displaying all nodes published then sorted by published date desc. I can't quite figure out how to limit the nodes to only show one item per taxonomy term.

Any help would be greatly appreciated.


This is possible with Views 3. I've tested this on D7, but should work on D6 also.

  1. Add a new view of type - Taxonomy terms
  2. Add relationship - Taxonomy term: Representative node
  3. Other - Use aggregation: Yes
  4. Add field - Content: Title. Change Aggregation settings to Group results together


It's not great if you have a lot of nodes, but I've done this in other cases by using a filter for "Promoted to front page" - then you simple make sure you only promote one node at a time.


I'd suggest to use a combination of panels ans views. First, create a (or use the default) view for nodes which takes a taxonomy term as argument. Second, create a panels page containing five regions. Each region is to be filled with a view (in fact it's going to be the same view from step one, but with different arguments). Within panels ui you can restrict the number of shown entries of each view, set this value to one to have only one article be shown per term.

Panels: http://drupal.org/project/panels

Views: http://drupal.org/project/views


I'd recommend checking out the Views Group By module.

http://drupal.org/node/389230

The tutorial listed above actually describes almost exactly what you are trying to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜