TL;DR, Below are the structure of content types, paragraph types and taxonomy in my site.
Taxonomy vocabulary - Category
- Terms - Sports, Politics, Business
Paragraph type - Multi Article
Fields -
- Category (term reference to Category vocabulary)
Content types - Landing page , Article
- Landing page (fields) -
- Multi category (Paragraph field referring to Multi Article paragraph type)[unlimited]
- Article (fields) -
- Category term (term reference field to Category vocabulary) [unlimited]
Sample content example -
Landingpage A paragraph field has Sports,Politics
Landingpage B paragraph field has Politics
Landingpage C paragraph field has Business,Sports
Article A is tagged with Business
Article B is tagged with Sports,Business
Article C is tagged with Politics,Sports
Desired output -
Landingpage A detail page should be showing something like -
Sports [based on paragraph field]
Article B [based on term reference]
Article C [based on term reference]
Politics
- Article C [based on term reference]
Landingpage B detail page should be showing something like -
Politics [based on paragraph field]
- Article C [based on term reference]
Landingpage C detail page should be showing something like -
Business . [based on paragraph field]
- Article B [based on term reference]
Sports [based on paragraph field]
Article B [based on term reference]
Article C [based on term reference]
Can this be achieved with views and contextual filters ?
Question in detail - Forgive me for a lengthy question.
I have a field in the content type - Landing Page, which refers to a Paragraph type.
The paragraph type intern has a term reference field.
When I edit/ create a Landing page content, the desired term names are selected and saved (it can be any number of terms and it doesn't mean that this landing page is tagged to these terms. This is done just to categorise the result while rendering).
I also have another content type - Article which are actually tagged to some terms (both the above paragraph term reference and Article term reference are of same vocabulary)
Now, when any of the landing page content is rendered, I would like to show the latest 5 (or any number) Article contents tagged with each term that was added to the paragraph field which was selected from the paragraph field earlier.
The idea is to make the view result dynamic based on the terms added in the paragraph field of the content. In other words, the view result should vary on every node detail page.
Is there a way to achieve this with the help of views ? My final hope if I don't find a solution is to programatically fetch the latest contents under each term and display them. Would like to know if a better more elegant way is there with views.
Note - The reason why Paragraph is chosen is due to the flexibility it provides with rearranging the terms etc.
Would be great if any reference or examples are provided if my approach is right. Thanks.