3

As I try to migrate an existing Sitecore site over to Helix (specifically focusing on new areas of the site and sublayouts) I'm running into what I believe is contradictory information, or a lack of understanding on my part.

According to 2.5.3. Template Types in the Helix documentation:

Page Type templates are only ever present in the Project layer, as these are the integration points for the functionality in feature and foundation modules. Page Type Templates are therefore maintained in a common folder for a Project, equivalent to a site type. Each page in a site of the given Project type are instances of a Page Type template. This is actually very handy as all page types of a site are maintained in a single location, which can make it easier to manage site-wide changes to all page types.

Which is a bit verbose, but looking at the Habitat Example image (below) makes things a bit clearer and suggests that templates for pages should exist in Sitecore under /sitecore/templates/Project/Site/Page Types.

This seems to be backed up by the Habitat project, so I setup Unicorn serialization accordingly.

However, when reading through the documentation further I see 2.4.1 Item types where it states:

The items in your Sitecore databases can be split, for management and governance purposes, into two main categories: Content Items and Definition Items.

For definition items:

Definition items are items that typically define the configuration or structure of the implementation or which contain metadata for assets in the solutions. These items are owned, i.e. created and managed, in the development environment and moved as part of versioned deployments from development to test to production.

In the Habitat Example section:

Note how in the Habitat example sites, all Feature and Foundation modules almost exclusively contain Definition Items. [...]

The Project layer modules on the other hand consist of a majority of Content items, which are managed by editors.

This suggests to me that the Page Types should belong with the Feature instead.

Am I understanding this correctly, and safe to assume that in the case of page types Helix would recommend those could be created under the Project layer, per 2.5.3?

For the sake of this, the items will be created in Sitecore by a developer, and will have Presentation Details set on their standard values with the basic layout and controls we want on all pages in the section, again in Sitecore.

Figure: Page Type Templates of the Habitat website

4

Page Type templates should only ever exist in the Project Layer. They should also only inherit (via the Base Templates Field) from interface templates. For best practice purposes it's better to follow the Guidelines in Helix and not necessarily follow everything you see in Habitat. Habitat is built to be a guide to Helix principles, but there are definitely places even in Habitat that don't exactly follow the Helix standards.

  • Excellent. That's exactly as I was reading them as well. Having been a .NET developer far longer than a Sitecore developer, I'm used to assuming that when a company/org releases "principles and conventions" that they might not 100% match it yet, but they're moving in that direction (at least for now). I keep having to remind myself that Sitecore isn't quite to that point yet; maybe in a couple more years. :) Thanks! – James Skemp Jul 13 '17 at 12:47
  • 2
    2.1.2.1. Project Layer also backs this up. "The Project layer provides the context of the solution. This means the actual cohesive website or channel output from the implementation, such as the page types, layout and graphical design." – James Skemp Jul 13 '17 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.