DOWNLOAD DEMO
Current Version: 2.4.0.3 2014-04-14
Need a hand? Join the community.

Configuring Initial Content

mojoPortal content management system has a means by which you can configure what pages are created and what features are placed on the page as initial content when a new site is created. This can 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. I use this feature myself on the demo.mojoportal.com site in order to populate it with some example pages with popular features. 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. This new childPages element is supported in mojoPortal 2.3.6.3 or later.

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 to put instances of features on pages and give them a title. It is possible with the Html Content feature to pre-populate the content based on additional configuration files. It is also possible to populate some other included features and to implement your own content installer to populate your own custom feature.

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 db 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 fle 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. However 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 I use to populate the demo site but with some things commented out such as the paid product features. It does provide a good example for you to study so you can better understand how to configure your own initial content.

Created 1/28/2009 by Joe Audette
Modified 2/3/2014 by Joe Audette