1

I come from a custom web dev background but I'm working on some Drupal projects now. I am confused about the best method to set up basic site architecture. What I want is for taxonomy terms or variables to drive display of content throughout the different areas of the site. I gather I should be using taxonomies as these variables...If I am wrong please let me know

So say I have one taxonomy (BRANDS) with two terms:

BMW AUDI

I also have three content types:

Article (can belong to multiple brands) Video (can belong to multiple brands) Model (only single brand)

I want to create 3 types of pages (I think what I should be doing is using views) BUT - I should only need to use ONE view per page type:

Index Page (which accepts taxonomy term and displays all videos articles and models associated with the term - this is not an individual node page) (url should be something like /BRAND eg: /BMW)

Model Page (which shows the model node - and also content [videos and articles] associated with the BRAND taxonomy term) (url should be like /BRAND/Modelnode eg: /BMW/3-Series)

Article Page (which shows an article node - and also videos and models associated with one or more BRAND taxonomy terms associated with that article)(url should look like either BRANDS/Articlenode - eg: BMW-AUDI/Articlenode or just /article/Articlenode if the taxonomy does not need to be coming from the url to feed into views or whatever generates the page content)

If i was doing a custom PHP driven website, this would be easy to do, but it's confusing as hell in Drupal. What is the standard and best practice way to go about creating each of these page types - and if it is created using views - only use one view per page type [ ie the view will accept url or internal taxonomy arguments to dynamically show content]?

1 Answer 1

2

You'll need to use Fields and some modules to do this but it looks like you already have the understanding on how to get started.

Fields are basically properties that can be used to extend Drupal entities. You can add Fields to your Content Types and your Taxonomy Vocabularies to include extra properties not available out of the box.

Any Fields that you want associated with your Node, add them to the Node Type. Any Fields you want associated with a Taxonomy Vocabulary, add them to the Taxonomy Vocabulary. And in the end, make sure everything is rendered correctly in your theme.

As soon as you associate a Node with a Taxonomy Term, Drupal already provides a way to display all Nodes associated with a specific Taxonomy Term. If you navigate to /taxonomy/term/TERM_ID you'll see what I mean.

If you want to modify that page, I would start looking into Views and Panels which are arguably the building blocks of any Drupal site. It is important to note though that Views and Panels are usually not used to create new content but rather to query and display, respectively, existing content.

For the URL structure you mentioned, look into the Path and PathAuto modules. They provide a way to generate URLs based on a pattern.

So, for your example, if you want a URL /BMW to show all Nodes tagged with the BMW Taxonomy Term, those two modules will get the job done for you.

So what's the best approach? It depends on your site's content. From your question:

  • Index Page: Classic use case for a view that takes an argument from a URL. In this case, a Taxonomy Term. You can choose to filter on specific Node Types, Taxonomy Terms, etc.

  • Model Page: Simple Node. Create a field on it's Node Type to associate it with the appropriate Taxonomy Vocabulary. You can also use Views to pull related content, which from your description is what you need here. There are also a lot of modules that can help with this.

  • Article Page: Same as above.

Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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