0
votes

I'm new to D8. I want to customise the theme of a view. I have already created a block view and assigned into the sidebar of bartik's theme (default provided). See the below screen shot. enter image description here

Now, I've made the twig debug as true and saw the theming guide for the view files:

<!-- FILE NAME SUGGESTIONS:
   * block--views-block--articles-block-1.html.twig
   * block--views-block--articles-block-1.html.twig
   * block--views-block.html.twig
   * block--views.html.twig
   x block.html.twig
-->

Now, I have created a file named "block--views-block--articles-block-1.html.twig" within the path: "/themes/bartik/templates/views/" and wrote something like:

Hello

{% for row in rows %}
test
{% endfor %}

After clearing cache, I see there is no change in the view theme and it renders as default. enter image description here

What did I missed?

2

2 Answers

0
votes

You are creating block template that contains block title and content, not a views template.

The view template name should start by "views--".

0
votes

@niladri, You have chosen format to unformmated.I will suggest to create template in views directory in your theme. Views-view-unformatted--[view machine name]--[view display name].html.twig Clear cache after this via drush or Drupal admin/config/development/performance.