How to identify the template

Hi, I have a multi-level menu in my sidebar, when I click a top level item I receive a list of titles of all the pages in the main content area, instead of the menu expanding to show only it’s children.
When I click a menu item for a single page that page appears correctly - served by single.html.
How can I change this so that menu items with children expand in the sidebar, also how can I identify which template is producing the list in the content area - its not single.html or list.html.

Thanks for any help
David

You can filter these pages by using .Type and .Kind attributes for the page.
For example:

<ul>
{{range where (where .Site.AllPages "Type" "posts") "Kind" "page"}}
  <li><a href="{{.URL | relURL}}">{{.Title}}</a></li>
{{end}}
</ul>

The single page template has the kind value that equal to the “page”, the list template has the kind value that equal to the “section”. More info here.
Here is the details about how the .Type value is determined by Hugo.

Thanks serg.
I’ve put the code here if anyone has suggestions how to get the menu to work

Thanks