0

The N2 documentation on inheritance mentioned about putting common content into the start page definition then within the masterpage retrieving that part of the content from the StartPage rather than the CurrentPage. Is this considered to be best practice or is there another way to inherit content from the ancestor pages?

Chewy
  • 25
  • 6

1 Answers1

0

There are three aspects to this

  1. If you have some content that appears on more than one page, e.g. company contact phone that appears on site footer on every page, best practice would be to add this as a property to start page, probably on a separate tab (e.g. "Footer"), populate its value, and then reuse property value on all pages by reading from start page. Benefit of this is centralized editing of such reused property

  2. If you have some property that is the same on groups of pages - like when you have "theme color" same for all children of certain 1st level menu item - then you can use same approach on the level of children of start page - you would define property on child of start page (e.g. color), then reuse it on all of its children. Once editor sets "theme color" on 1st level page, it will automatically affects all its children.

  3. If you have property with some kind of user-defined default value but you want editor to be able to override it, like header image, you would use combined approach. Define HeaderImage property on start page and on all other pages. Then, in your code, if HeaderImage property is empty, use one from start page. This is a good practice since people tend to make mistakes and forget things. In this case, if Header image is not specified, it will be automatically replaced by value from StartPage

All three scenarios are used in real life conditions and proved over and over again to be good solutions.

Dejan Milicic
  • 819
  • 9
  • 18