h1. Deploy Single Content to a Predefined Page



h2. Overview

To build up a new website, you need to prepare a lot of contents for displaying when your site is put in production for the first time. This tutorial help you create and deploy your single content(a webcontent or DMS document) to a predefined web-page with Single Content Viewer in our eXo WCM.


h2. Content Creation and Exporting to xml file

With our wcm, we support several ways to create your content(document or webcontent):
- [WCM:Creating Web Content using the Create Page Wizard]
- [Create web content by single content viewer(SCV)|WCM:Creating Web Content using the Single Content Viewer]
- [Create web content in sites explorer|WCM:Creating Web Content using the Sites Explorer]
- [Create web content by using WebDAV|WCM:WebDAV in WCM]

When your content is created by these ways, you can see the content in 2 locations in SiteExplorer
- Under Docucments folder or its childen of site content storage location
- Or under Web contents folder of its childen of the site content storge

(Please read our about [Site Content Storage] for more details).

After you have the content, please export it as xml document view by export feature.
Here is screenshot to export Service and Products web-content in our acme site(Note that you can do the same step for other document type)

{note}

Disable the publication-service config in configuration.xml *before you create* the site artifacts: 

 *war:/conf/wcm/publication-configuration.xml* 
To disable it, you have to comment those external component plugins : StateAndVersionPublicationHandler,CmsService.event.postCreate,CmsService.event.postEdit,PortalArtifactsInitializerServiceImpl.portal.onCreate

Then export the node(s).

Don't forget to re-enable this configuration file!

Of course you can use different computers for creation and deployment, so that you don't have to reconfigure and restart WCM.
{note}

<div style="text-align:center"> !SerPro.png! </div>

h2. Content Deploying Configuration

This step is provided to configure so that you can deploy your content to right location that be created. 
After you have your content in xml document view version, you need configure to re-deploy it to acme/web contents folder when your web server application run at the first time.
To do that, put your xml file in your portal war and configure for ContentInitializerService to initiate the content.

{code:xml}
<external-component-plugins>
          <target-component>org.exoplatform.services.deployment.ContentInitializerService</target-component>    
      <component-plugin> 
        <name>Content Initializer Service</name>
        <set-method>addPlugin</set-method>
        <type>org.exoplatform.services.deployment.plugins.XMLDeploymentPlugin</type>
        <description>XML Deployment Plugin</description>
        <init-params>         
          <object-param>        
            <name>ACME Servives And Products data</name>
            <description>Deployment Descriptor</description>
            <object type="org.exoplatform.services.deployment.DeploymentDescriptor">
              <field  name="target">
              	<object type="org.exoplatform.services.deployment.DeploymentDescriptor$Target">
              		<field  name="repository"><string>repository</string></field>
              		<field  name="workspace"><string>collaboration</string></field>
              		<field  name="nodePath"><string>/sites content/live/acme/web contents</string></field>
              	</object>
              </field>
              <field  name="sourcePath"><string>war:/conf/wcm/artifacts/site-resources/acme/contents/ServicesAndProducts.xml</string></field>
            </object>
          </object-param>                  
          
        </init-params>  
      </component-plugin> 
   </external-component-plugins>
{code}

With this configuration, the *ServicesAndProducts.xml* file is located *sourcePath* params and will be imported to *Target* location is in: *"repository"* repository, *"collaboration"* workspace and under folder *"/sites content/live/acme/web contents"* (full path for web contents in acme site content storage)


1 Content Association with a Single Content Viewer

The last step is to associate your content with a Single Content View in a page.
Define the single content viewer in page.xml that is used to present the content like that
(the name of the SCV is *"<instance-id>portal#acme:/web-presentation/SingleContentViewer/acme-serpro</instance-id>"*)

{code: xml}
<page>
  	<page-id>portal::acme::homepage</page-id>
    <owner-type>portal</owner-type>
    <owner-id>acme</owner-id>
    <name>homepage</name>
    <title>Home Page</title>
	  <access-permissions>Everyone</access-permissions>
	  <edit-permission>*:/platform/administrators</edit-permission>
	  <container id="ACMEHomepage" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
			<container id="ACMEContainer" template="system:/groovy/wcm/webui/container/UITableColumnContainer.gtmpl">
	  		<container id="ACMESerProContainer" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
	  			<application>
				    <instance-id>portal#acme:/web-presentation/SingleContentViewer/acme-serpro</instance-id>
				    <title>Services and Products</title>
				  </application>
	  		</container>
	  	</container>
	  </container>
  </page>
{code}
And configure your portlet(in portlet-preference.xml file) points to the content that be created like that:
{code:xml}
<portlet-preferences>
    <owner-type>portal</owner-type>
    <owner-id>acme</owner-id>
    <window-id>portal#acme:/web-presentation/SingleContentViewer/acme-serpro</window-id>
    <preference>
      <name>repository</name>
      <value>repository</value>
      <read-only>false</read-only>
    </preference>
    <preference>
      <name>workspace</name>
      <value>collaboration</value>
      <read-only>false</read-only>
    </preference>
    <preference>
      <name>nodeIdentifier</name>
      <value>/sites content/live/acme/web contents/Services And Products</value>
      <read-only>false</read-only>
    </preference>
    <preference>
      <name>ShowQuickEdit</name>
      <value>true</value>
      <read-only>false</read-only>
    </preference>
  </portlet-preferences>
{code}
And here is final result you can see on acme homepage:
<div style="text-align:center"> !SerProOnHomepage.png! </div>
