Drupal Views display newest content per taxonomy limit to one node

巧了我就是萌 提交于 2019-12-21 22:29:50

问题


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 Example:

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.


回答1:


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



回答2:


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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/2638234/drupal-views-display-newest-content-per-taxonomy-limit-to-one-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!