0

I'm on Drupal 7, I have a menu like :

  • HOME

  • NEWS

  • BLOG

For now, when I click on HOME, i can see all contents.

I want, when I click on NEWS, redirect the user to /news and only display contents of type NEWS. I want exactly the same for BLOG

I have no idea how can I do that.

Thanks !

  • How do you create your different sorts of content? Did you create some content types? – Volker Jul 2 '14 at 13:44
  • I created 3 contents types and 3 links in Main Menu – Clément Andraud Jul 2 '14 at 13:47
  • 2
    Good. You already know how to create content types and their fields, that is important first step. One option to create a page that shows specific content or, in other words only content that is created with a specific content type is the module "Views". You first should thoroughly read through this really good tutorial: acquia.com/blog/totally-beginner-tutorial-views-drupal-7 – Volker Jul 2 '14 at 13:52
  • I'm sorry, please use this one instead of the acquia-link (it's only accessible with registration): youtube.com/watch?v=3L9JLZOb_LQ – Volker Jul 2 '14 at 13:59
4

If you have used Blog modules to create you blog content type, you would be able to use the default View from blog.

Otherwise you can create your own view and add Filter Criteria: Type. You can do this using the module Views You can give the path blog to the view.

You need Views if

  • You like the default front page view, but you find you want to sort it differently.
  • You like the default taxonomy/term view, but you find you want to sort it differently; for example, alphabetically.
  • You use /tracker, but you want to restrict it to posts of a certain type.
  • You like the idea of the 'article' module, but it doesn't display articles the way you like.
  • You want a way to display a block with the 5 most recent posts of some particular type.
  • You want to provide 'unread forum posts'.
  • You want a monthly archive similar to the typical Movable Type/Wordpress archives that displays a link to the in the form of
    "Month, YYYY (X)" where X is the number of posts that month, and
    displays them in a block. The links lead to a simple list of posts
    for that month.

    Views can do a lot more than that, but those are some of the obvious uses of Views.

2

You can install and use Views module.

It will allow you to create a page (and define the path, for example "/blog" or "/news") on which you can display a list of specific content-type. You can also tell which fields you want to display in that list (maybe you don't want to display all your content-type's fields). You can rearrange it as you want, etc.

If it seems good for you, here is an example for you to create your NEWS page:

Delete all menu items you've created because it will be created automatically!

Install Views and activate it.

Go to Admin>Structure>Views and "Add new View".

Set your View name as "News".

Set "Display CONTENT of type NEWS" and maybe set a sorting rule if it pleases you.

Check "Create a page" and give it a name, like "news", and a path, like "yoursite/news".

Choose a display format, like "Unformatted list", which I think will suit perfectly for a list of news. If your news contents are long, maybe choose to display only "teasers" or "titles" previews. The users could access the entire content by clicking on the titles if they want to.

Choose to display comments links or not.

Set the number of news you want to display per page (there will be a pager system if you let "Use a pager" checked).

Check "Create a menu link" and choose in which menu you want to display it (maybe "Main Menu"?).

Don't check "Create a block" for now. You only want a page initially.

Save & exit for now, and check the result by clicking on your new menu item "NEWS".

That's how you create a very basic View of content-type. You can do a lot of configuration after that in your View panel but it could be very specific and complex so I suggest you to read the documentation and find by yourself.

Please excuse me if my answer sounds child but I understand that you're still pretty new to Drupal and I just wanted to help "step by step".

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.