The snippet above should be inserted immediately after the open statement, ideally in a site global template or fragment

Rest of document template goes here

The pagename variable should be populated by the CMS to reflect the page location in the Site Information Architecture from the experience of a user.

The snippet below should be inserted immediately before the closing statement