text: Site Types
  Last Updated: 2018-10-09
  For general information on the different rules & components available when defining content types, please refer to How To Setup Content.
  Site types are the content templates for the global content of your sites. In contrast to pages and posts, sites can be created without setting a Site Type as it is totally optional. Another difference is that Site types does not support Blocks.
  The preferred way of importing Site types is by using the
  Piranha.AttributeBuilder package. With this package you can directly mark your Site models with the Attributes needed.
  Defining a Site Type
  Here's a simple example of a site with a header with an
  ImageField and a
  StringField.
  using Piranha.AttributeBuilder;
  using Piranha.Extend.Fields;
  using Piranha.Models;
  [SiteType(Title = "Default Site")]
  public class DefaultSite : SiteContent<DefaultSite>
  {
  public class SiteHeader
  {
  [Field]
  public ImageField Logo { get; set; }
  [Field]
  public StringField Title { get; set; }
  }
  [Region]
  public SiteHeader Header { get; set; }
  }
  To import this page type during your application startup you add the following line to your
  Configure method.
  using Piranha.AttributeBuilder;
  var siteTypeBuilder = new SiteTypeBuilder(api)
  .AddType(typeof(DefaultSite));
  siteTypeBuilder.Build();
  As you can see the
  SiteTypeAttribute allows you to set the title that will be displayed in the manager interface. If this property is left blank the class name is used.
  How To Assign The Site Type
  To associate a Site type with your site from code you set the
  SiteTypeId property of the site.
  using Piranha;
  var site = api.Sites.GetDefault();
  site.SiteTypeId = "DefaultSite";
  api.Sites.Save(site);
  You can also set the Site type from the manager by editing the site and selecting one of the available types from the dropdown.
  How To Edit The Site Content
  Once you have assigned a Site type to your site your can start editing its content. You can easily edit it from code by accessing the
  SiteRepository.
  using Piranha;
  var site = api.Sites.GetContentById<DefaultSite>(siteId);
  site.Title = "My site title";
  api.Site.SaveContent(siteId, site);
  In the manager you can access the site content from the top of the Sitemap view that can be found under the Pages view in the manager. Please note that you have to assign a type to the site before the button for editing site content is available.