I have a Drupal 8 installation set up that is using a custom Bootstrap theme as the default theme. I have a View created to be a blog, and want to give it a different custom theme than the default. I have the path set as "/blog". Is there a simple way of doing this through code (specifically referencing either the URL or the view) or a menu option I've overlooked?

I've looked at other related questions on here such as: How to apply theme to Drupal view or block

But in my View display settings there is no "Theme : Information" option available.

Any help is greatly appreciated! If there is more details I can provide for a solution, please let me know!


Drupal 8 views doesn't have a Theme: Information section, or at least it doesn't have information about themes.

Twig is the themeing engine, so you'll need to get information there. You can enable twig debugging in a services.yml file:

    debug: true

This will print out theme-able names for views in the html. On a site I'm looking at the print out only gives one option for the view:

<!-- BEGIN OUTPUT from 'themes/custom/sitename/templates/block--views-block--our-leadership-senior-management.html.twig' -->

But the block that holds the view has a number of options:

x block--views-block--our-leadership-senior-management.html.twig
* block--views-block.html.twig
* block--views.html.twig
* block.html.twig

The x indicates that's the template I'm using.

| improve this answer | |
  • So I looked into what you mentioned and I was able to get drupal to start pulling a different twig template. The issue now is that its only pulling the twig template from my default theme (bootstrap) but I'm trying to get it to pull a template from a different non-default theme. Any recommendations for how to go about that? – mpgrahov Feb 13 '17 at 18:02
  • I've seen this done with the rules module, pretty easy and quick. Or you could write a custom module that sets the active theme based on the url. – icicleking Feb 14 '17 at 22:02
  • I was able to use the Theme Negotiator in one of my custom modules and it seems to be working. Thanks for pointing me in the right direction! – mpgrahov Feb 17 '17 at 16:12

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.