0

I wish to generate pages that populate a series of views of different content types based on a parameter in the url.

For example, a user may navigate to:

www.mysite.com/{tag}

The generated page would find all content tagged with the {tag} parameter and present it as a series of views, for example:

Custom page for {TAG}

View 1                 View 2
Item 1 (type A)        Item 1 (type B)
Item 2 (type B)        Item 2 (type B)
etc                    etc

and etc.

I wish to style and theme the resulting page considerably. Ideally I would also make it possible for an end user to style the resulting page.

I am a little unsure what the best 'drupal' way to make such a page is.

a) Is it possible to somehow style and manage the taxonomy page for 'tag' to look how I want?

b) Should I programatically generate the pages in a custom module that searches for content based on a taxonomy term (not even sure how this would be done)

c) Should I generate a series of views then pass parameters to them on each specific page?

d) Is there some other, better way to achieve such a page in Drupal 8?

One final question, which solution would perform best in terms of page loads, or would they all be pretty similar?

  • What are type A and type B? – Jimmy Ko Aug 4 '16 at 1:10
  • They will be custom content types. The could be anything. I want to have 6-7 different content types in their own views. The only thing they will all have in common as they would be the taxonomy term. – tanbog Aug 4 '16 at 1:36
  • Why is your question about multiple views? That seems to look more like one view where you have as argument the tag and sort the nodes by content type and group them. – 4k4 Aug 4 '16 at 8:04
1

Create 7 different views, one for each content type. Create a block display for each view, and use block layout to put them all on one page.

Use contextual filters for the block view to get an argument from the URL. I believe it's a bit odd to configure: "in the section 'What to do if the URL is not available' select ' Provide default value' and select 'Raw value from URL from the dropdown box. From the 'Path Component' box select the position in the URL that your contextual filter gets its value."

This is a straightforward Drupal approach, should be performant.

Alternatively, you could use Views aggregation to use only 1 view, divided into 7 different groups, and use CSS wizardry to adjust the layout.

Which approach you prefer depends on whether you want to be able to customise each view, and whether you want to use UI rather than CSS to control layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.