SiteEdit 2009 Essentials - The Basics

So you have installed SiteEdit 2009.... what's next? This article contains details on how the basics of SiteEdit 2009 can be implemented in your templates, and then moves on to address additional features such as controlling the publication in which components and pages are edited, making embedded or linked components editable through SiteEdit, and enabling the editing and creation of components that are published as Dynamic Component Presentations. The whole article refers to functionality provided by SiteEdit 2009 SP2. Earlier versions will not necessarily work with the described approaches. The TT72267 hotfix is also required.

SiteEdit 2009 Essentials

Article Sections

The Template Building Blocks mentioned in this article can be downloaded here .

The Basics

This section describes how SiteEdit works with Modular Templating and how to set up your modular Page and Component Templates to enable basic SiteEdit features.

How SiteEdit 2009 works with Modular Templating

SiteEdit functionality is enabled on published pages by use of HTML span tags to enclose sections of content (for example an entire component presentation, or an individual field) and HTML comments containing JSON objects to define the section (for example identify the component id and template id for a component presentation) or to provide other data like the current page id.

The RenderComponentPresentation() and RenderComponentField() Dreamweaver methods add an intermediary markup called TCDL to identify the Component Presentations and Fields, which is converted into the <span> tags and JSON syntax by .NET TBBs provided as part of the SiteEdit product:

  • Enable Inline Editing - converts the <tcdl:ComponentField/> elements - usually used in Component Templates

  • Enable SiteEdit 2009 - converts the <tcdl:ComponentPresentation/> elements and adds some further data to the output - usually used in Page Templates

The conversion to JSON is done only when publishing to the Staging websites. Any remaining TCDL is cleaned up and removed/converted at deployment time by the Content Deployer - TCDL is also used to define other functionality like dynamic assembly of content and dynamic linking.

Enabling basic features of SiteEdit in Page Templates

In order to enable the SiteEdit toolbar to appear in published pages you need to ensure that your Page Templates are set up as follows:

  1. You add the SiteEdit Prepare TBB before the Dreamweaver TBB
  2. You add the Enable SiteEdit 2009 TBB after the Dreamweaver TBB and before the Default Finish Actions TBB.

SiteEdit Prepare is a custom TBB created to configure the standard SiteEdit TBBs correctly. The Enable SiteEdit 2009 and Enable Inline Editing TBBs require a TargetType parameter to be specified, which contains the uri of the staging target type. In this way they can ensure that they only write out SiteEdit markup when publishing to staging, and the live websites do not contain it. SiteEdit Prepare will check if the current publishing action is to the target type with name "Staging" and if so push the uri of the Staging target type into the package for the other TBBs to use. The TBB also contains logic to determine blueprint contexts which is described in the next section.

NOTEif you are using ASP.NET Master Pages, or otherwise not publishing a full HTML structure in your page, you need to additionally adding <!--SITE_EDIT_INIT--> to your Dreamweaver TBB, this should go towards the end of the template. This is required as the Enable SiteEdit 2009 TBB looks for the closing </body> tag in the Output, and inserts some JSON objects containing SiteEdit settings at that point. If you do not have this tag in your output (if for example you are using a Master Page which contains this), you have to instruct SiteEdit where to put the settings using this comment.

Enabling basic features of SiteEdit in Component Templates

In order to enable your component fields to be editable with SiteEdit you need to ensure that your Component Templates are set up as follows:

  1. You add the SiteEdit Prepare TBB before the Dreamweaver TBB, Note that this is bundled as part of a compound TBB called Component Template Start Actions
  2. You write out your fields in the Dreamweaver TBB using @@RenderComponentField()@@
  3. You add the Enable Inline Editing TBB after the Dreamweaver TBB and before the Default Finish Actions  TBB

Note that using @@RenderComponentField()@@ can be complicated for multi-value and embedded component field values, and not all types of component field can be written out in a way that they are editable with SiteEdit using this function (images and links for example).

Outcome and next steps

Once you have completed the above steps for your Page and Component Templates you should be able to use standard SiteEdit functionality to edit components on your published pages.

If the component or page is not created in the same publication as that which the page is published from, then you will notice that the Page and Component are read-only, this is because by default SiteEdit shows them in the context of the publication you publish from. You can make the component editable by click the Edit in Parent publication button on the Component Toolbar, or clicking the Localize button to localize it and edit it.

However, this is not so convenient for Editors, and often you do not want to localize the Component in the publish publication, but further up in the Translation layer of the Blueprint. A way round these issues is presented in the next section .