Create Related Articles by Taxonomy Term Automatically with Maximum Number of Related Articles (i.e. 6 Max Related)

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
cneumann's picture

Is there a way to relate existing articles when creating new content? I assume that it might be a rule?

Assumptions: There are articles that already have a taxonomy of "crime."
Workflow:
1.Create new article
2. Instead of manually associating Related Articles in Article creation page, have the LAST 6 (for example) Related Articles with the Taxonomy Term of "crime" relate to the new Article automatically.

I am thinking that this might be able to be done with a rule, but that level of complexity is outside my realm.

Thoughts?

Comments

This can be accomplished

fabsor's picture

This can be accomplished through views.

  • Enable the views UI module
  • Go to admin/structure/views and click add view.
  • Name the view whatever you want and select that it's going to show content of type article. Uncheck the "Create page" checkbox.
  • Click "Continue and edit".
  • Under "Advanced", add a "Contextual filter", and search for "taxonomy". You should find something called "Content: has taxonomy term id". Add that contextual filter.
  • Adjust the display of you view however you like by choosing a style of your choice and add whatever fields you want to have.
  • Under "Displays" (at the top), click "Add", and select "Content pane".
  • You now have a secton called "Pane settings", and there is an option called "Argument input" there. Click edit on that.
  • You can now select however you want to get your arguments from panels. Select "From context". Scroll down in the second select box until you find "Taxonomy term" and "Term ID", and select that. Click apply.
  • Finally, save the view.
  • Go to admin/structure/pages and edit the "Node template". Select the "Article" variant, and click content. Click the wheel on the region you want to add your view on and click "Add content".
  • Select the group "View panes", and you should find your created view. select that. Click finish.

This should do the trick!

//Fabian Sörqvist

The use case is for article nodes, not terms.

tomogden's picture

The steps you described above only work if you are on a term page or are providing a term ID. In the use case, if you are on the node's page, how would you connect the relationship between the terms and the NID?

For myself, what seems like it should be a simple contextual-relationships setup is unexpectedly confounding.

Tom/* Ogden

edit

tomogden's picture

edit

Tom/* Ogden

I am working with a live site

cneumann's picture

I am working with a live site with NS1, will this work in NS2 as well? I am working on developing and migrating NS1 to NS2.

NodeStream

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: