theming – Twig template for just one page in a view

I have a Drupal view (Product Section) where I have a master view. This is the view I’m currently using for Computers, Cell Phone, and other pages I am still creating.


I also have a Product Shop page, which is almost like the parent page. For this page, the path is /products, for Computers is /products/computers, and so forth.

In my theme folder, inside of the templates folder, I created a page–products.html template. This works great, but this template gets used not only by the /products pages but also the products/page-name-here pages.

  1. How do I change this template to only target /products and not products/page-name-here. Would I just have to change the template name to something more specific?
  2. Inside of this template, can I do an if statement something like the code below that will only target that /product page? Let’s say I end up keeping the template on all the pages, but I want to add code that only shows up if it’s on /products and not products/page-name-here. Maybe I could target it by its unique ID. How can I achieve this?
{% if page = 'page-name' %}
  // This will only show on /products.
{% endif %}