mojoPortal

 

mojoPortal Content Management System has a means by which you can configure what pages are created and which features are placed on each page as initial content when  new sites are created. This could be useful if you have some custom application that you are packaging with mojoPortal and you want to be able to have a page created with your application on it. It is also useful if you are using the mutli sites feature and wish to have some standard pages created whenever you create a new site.  A default installation of mojoPortal also uses this, but it only creates a single page with some introductory information.

If you look in the /Setup/initialcontent/pages folder, you will see the file 00001homepage.config that has the configuration for the home page created when mojoPortal is first installed. The name of the file is not important except that the sort order of the files determines the order in which pages are created. The file does need to end with a .config extension and it must have the correct xml format inside it.

This example shows how to configure nested pages by using the <childPages> element within a page. In the example below the home page has a child page with a blog feature installed on it. 

Example:

<?xml version="1.0" encoding="utf-8" ?>
<siteContent>
<pages>
  <page
   name="Home"
   title=""
      url="~/home.aspx"
      menuImage=""
      bodyCssClass="mybodyclass"
      menuCssClass="mymenucssclass"
      pageOrder="1"
      requireSSL="false"
      visibleToRoles="All Users;"
      editRoles="Content Publishers;"
      createChildPageRoles=""
      pageMetaKeyWords=""
      pageMetaDescription=""
   >
   <contentFeature
       featureGuid="881e4e00-93e4-444c-b7b0-6672fb55de10"
       contentTitle="DefaultContentHtmlTitle"
       contentTemplate="InitialSiteHomeContent.config"
    location="contentpane"
       sortOrder="1"
       cacheTimeInSeconds="0"
   />
   <childPages>
    <page
     name="Blog"
     title=""
        url="~/Blog.aspx"
        menuImage=""
        pageOrder="1"
        requireSSL="false"
        visibleToRoles="All Users;"
        editRoles=""
        createChildPageRoles=""
        pageMetaKeyWords=""
        pageMetaDescription=""
     >
      <contentFeature
            featureGuid="881e4e00-93e4-444c-b7b0-6672fb55de10"
            contentTitle="DefaultContentHtmlTitle"
            contentInstaller="mojoPortal.Web.HtmlContentInstaller, mojoPortal.Web"
            configInfo="InitialSiteHomeContent.config"
          location="contentpane"
            sortOrder="1"
            cacheTimeInSeconds="0"
   />
      <childPages>
     <!-- additional pages can be nested here -->
    </childPages>
    </page>
   </childPages>
  </page>
</pages>
</siteContent>

The configuration allows you to define pages and place instances of features on pages with a title. It is possible to pre-populate some included features and your own features with content based on additional configuration files. Read the Populating Feature Content article for detailed information on implementing this functionality in your own features.

Next you see the definition for the contentFeature, the featureGuid shown is for the Html Content feature. You can look up the featureGuid either in the database, in the mp_ModuleDefinitions table, or in the feature config files located under /Setup/applications/[FeatureName]/FeatureDefinitions folder.

Be aware that we include one template file in mojoPortal by default to populate the home page with some initial content. The file, /Setup/initialcopntent/pages/00001homepage.config, is used to define this content. If you create your own content templates and would like it to ignore that file you can add this to your user.config:

<add key="ContentPagesToSkip" value="00001homepage.config" />

You can download InitialSiteContentExampleSetup.zip for a more detailed example. It is the actual files we use to populate the demo site but with some things commented out, such as the paid product features. 

Modified 7/29/2022 by Joe Davis
https://www.mojoportal.com/configuring-initial-content.aspx