5

I have content type City. I have a view page with contextual filters to show the cities at the URL pattern locations/<city id>. I want to use Context to add blocks to these cities pages but I dont seem to be able to figure out how to get it done.

In D7 I used the Context Request Path to be able to do this. In D8, I dont see how this is possible.

The Request Path condition only checks internal URLs which I think is useless for me since there is no pattern that can isolate the city pages. The Node Bundle doesnt work because the page is technically a View and not a Node.

How can I use Context to place blocks on a view page that uses contextual filters?

  • 1
    Is there are reason to can't use the block's visibility settings to display only in /locations/*? Are these context specific blocks? – Shawn Conn May 4 at 3:44
  • 1
    Yes. They are context specific. location/<city_id> The city_id in the URL indicates which city is being viewed. – Jeff May 7 at 18:04
  • Adding a block visibility setting for the Request path "/locations/*" should suffice. If you limit the views context argument to the City node type (see validation in the contextual filter) /locations/* will only apply for City nodes. What's the content of the block? If it's related to the city as well you could create a views block with a contextual filter. – mpp May 9 at 6:52

Your Answer

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

Browse other questions tagged or ask your own question.