3

I have a custom taxonomy for my posts called "Continents" and they could be:

Europe, Africa, Antarctica etc...

Then I have standard categories like: News, Reviews, Interviews etc.

And 1 subcategory for some categories e.g. for News I have subcategories like (entertainment, politics, sport, science etc.)

My question is how to set up URL permalinks in Drupal, so I have these types of links for "categories":

http://example.com/africa/news/politics
http://example.com/europe/reviews
http://example.com/antarctica

but at the same time I need to access things like:

http://example.com/news/politics

that will include everything from these categories and not taking care of the Continents taxonomy item.

And at that same time I need to access the posts (details) like:

http://example.com/2013/12/17/conflict-in-kongo-continues

Could that be done via Drupal or not?

1

Summary

I think you just need a couple of different views to create most of the functionality, but because the continent paths do not leave space for a path argument to call the view (eg example.com/viewname/africa/...), you might need to either duplicate the view with several displays or use some .htaccess mod_rewrites to point continent names at the view.

I have inserted a + into the first path (I hope that is alright?)

Suggestions

view: terms_by_continent

http://example.com/africa/news+politics

http://example.com/europe/reviews

http://example.com/antarctica

are presented by a view called terms_by_continent, with a contextual filter on term:name, accepting multiple arguments and defaulting to 'show all'. Create a different 'page' display for each continent so you can change the path to simply, for example, africa

view: terms_by_category

http://example.com/news/politics

would be a view called terms_by_category. The namespace is a bit difficult here because, unlike continents, I would guess this vocabulary might be subject to change, so creating multiple views displays would be tiresome and prone to error. If you are able to insert another path component then this becomes easy, ie category/news/politics would be served by a view of nodes with a contextual filter as above.

Multiple terms would normally be seperated with a + or similar, but if you needed to use / (ie news/politics) you could do a mod_rewrite on category/* to make this presentable

If you could not afford to add the category path component then I would guess you are stuck with using views displays as in term_by_continent to claim the paths that match each of your terms, accepting arguments for additional terms.

node: custom path

Finally:

http://example.com/2013/12/17/conflict-in-kongo-continues

This is the actual path to a specific article (node), so path auto is definitely the way to go. It will allow you to use tokens to construct your path for the appropriate content type, using date components and title.

Other solutions

I had a couple of other suggestions:

  1. look at page manager, which might allow you to have greater control over paths for your views
  2. you could try using pathauto for terms as well as nodes, and then replacing the term display with a view that accepted term:name as argument (as above), You could do this using term display or tvi

For option 2, I believe that (assuming there is not an existing page with this path), africa/news/politics for example, would not find a match, so would look for africa/news. Because that path also does not exist, it would fallback to africa, which (thanks to pathauto) takes you to the africa taxonomy term.

The term page contains a view, which accepts arguments (ie news/politics) and therefore you should get the appropriate listing. The view might need several displays which accept increasing numbers of arguments in order to allow the '/' seperated arguments, ie view/%,view/%/%, view/%/%/%

  • I have more than 200 "continents"and they are increasing every month. It's a science fiction portal. Not only Earth is included. SO, this approach is not ok in my case. I need to automate it. – Derfder Dec 21 '13 at 12:27
  • Ah, whoops, assumed it was a guaranteed 7! I this 'Other Solutions', option 2 might still work for you though. It was just another way I thought of afterwards, but I think it would work pretty well actually. – autopoietic Dec 21 '13 at 20:44
0

I don't have the exact answer but I think Organic Groups might be included in said answer. Using Views and filtering on the Taxonomy Term might work as well.

0

You should be able to do something like this just using views, tags and possibly panels (although I'm not really sure if its needed, but it will make things easier.)

Firsts off you could use tags for your continents. Also for your categories (although really anything you can filter off of in views should work, but the tags for continents could make it organic).

Then, create a view with contextual filters for the continent tag. If you create a pannel page at /%continents, then you can out put the view as content pane. That will give you pane settings in the view, and you can set the argument input (for your contextual filters) to come from the panel. If you have it use the /%wildcard as the argument, that should give you a list of nodes from tagged with North America, for instance.

You could then add another view with 2 contextual filters, one for the continent tag, and the other for the category type. You could then create a panel variant based off of the /%continents page, only with /%continents/%categories as your wildcards, and set things up similarly to how the first one was set up, that should allow ether /%continents to work or /%continents/categories to work.

http://www.webbykat.com/2012/02/creating-monthly-archive-block-drupal-7-views Here's a blog post I found which goes over how to create a block and views blog monthly archives, which really isn't too far off of what your trying to do (months/years will always increase, so they need to be created as needed, similar to your continents, it's just another way to filter posts)

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.