0

I am new in Drupal

I have an article website, and it has some category like History, Sport, Graphic, Music and etc.

But when I add some content-type for each of these and when I visit that post, I can't find the URL path of them. for example when I post a new Sport article that it's title is "Ronaldo's regimen" and when I click on save button on drupal, drupal show me an article that its URL is this :

www.example.com/content/ronaldos-regimen

I need to add a link to my menu for each catagory, something like this:

Sport | History | Graphic | Music

(I use pathauto module)

  • Do you want the path to have an alias such as this: www.example.com/sports/ronaldos-regimen? If so please provide more information about your categories. Are they different node content types, or are they taxonomy terms on the article type? Provide as much information about categories as possible. – J. Reynolds Aug 28 '14 at 8:55
  • @J.Reynolds They are different node content, each category has it's own content type – Mohammad Kermani Aug 28 '14 at 9:59
1

You need to do two things if I understand you correctly.

You need to set up Pathauto patterns for your content, and you need to set up a few views.

Pathauto:

You can get really complicated with this, but as you are just starting do it the easy way.

Go to: admin/config/search/path/patterns

This will show you the pathauto pattens page. In the section content paths, for each of your content types add something like the following:

CONTENT_TYPE_OR_CATEGORY/[node:title]

So, for sports content or category type you will add:

sports/[node:title]

This means that when you create a new sports node it will get a URL alias that is a combination of the category and the title of the node.

Make sure to go to the Pathauto tab: Delete aliases, and delete all content aliases. Then go to Bulk Generate tab and generate content aliases before you continue.

enter image description here

Views:

When you navigate to 'sports/ronaldos-regimen' it will take you to that article, but what if you just type in 'sports' as the URL. You probably want to have a list of articles of type sports.

For each of your content types you create a view. (if you have a lot of different content types this will not work and you will have to use contextual filters, but for now lets assume you only have 5 or 6 different content types).

For sports you set:

  1. the view's Title to 'Sports'
  2. the path to 'sports'
  3. the Menu to 'Sports', and set the menu it must appear in to main menu.
  4. add a Filter Criteria of Content:type, and set it to sports type

Do the same for all the views (you can make sure your sports view is to your liking then clone the view for the other categories and make changes)

enter image description here

| improve this answer | |
2

While creating node, Check on Provide a menu link. Add Menu link title and select Parent item where you want to add the current node.

That's it

enter image description here

| improve this answer | |
  • thanks.can I do this by view module? I create a path and put it menu but does not word [in view module] – Mohammad Kermani Aug 28 '14 at 9:40
  • @Kermani Sorry I don't understand. What do you mean 'does not word [in view module]' ? – Krishna Mohan Aug 28 '14 at 9:47
  • Sorry that was does not work – Mohammad Kermani Aug 28 '14 at 10:01
  • @Kermani No problem, please add details to your post like what exactly you want and what you have tried. – Krishna Mohan Aug 28 '14 at 10:04
2

There is no such thing as url of content-type in Drupal. However, you may be looking for:

And if you want a listing

of nodes from a content type, taxonomy term, or anything like that, use Views. Views allows you to create listing pages, with (almost) any URL you want for them.

| improve this answer | |

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.