Utility to generate a page identifier.


Generates an identifier for a file.

Useful when exposing template locals so that the identifier can be assigned to an element to allow easier CSS scoping.

The generated identifier is equal to the file name with the file extension removed unless the page is an index page.

If the page is an index page and is not at the context root the name of the parent directory is used, if the index page is at the root then the file name is used.

identifier({resourcePath: '/index.html'})      // index
identifier({resourcePath: '/features.html'})   // features
identifier({resourcePath: '/api/index.html'})  // api

Returns a page identifier.