Without directly answering your quesition, every page has a .Parent, .CurrentSection, .IsAncestor and .IsParent and .Sections
None of these options carries the value I’m looking for.
I’ve got a catalog of products. The parent section is called “catalog” and the nested section is called “portal”. There I have one file for each product in that category, so: “/content/catalog/portal/product-1.html, /content/catalog/portal/product-2.html, etc.”
I have the same template for any sub-section in catalog, i.e. “/layout/catalog/single.html”. There I’d like have the name of the current section I’m in, i.e. “portal”.
I looked everywhere in the docs, tried debugging the object “.”, “.Page”, “.Section”, “.CurrentSection”, etc. I can’t find this information anywhere. The best I could find is, by printing the object “.” there’s a unexported key called “targetPathDescriptor”. There I have an exported key called “Sections” that is a slice of strings looking like this string[] {"catalog", "portal"}. But since it’s under an unexported key I can’t have it.