Professional Documents
Culture Documents
.NET Developers
8.0.0.1 www.sitecore.net/training
Let’s Begin!
HELLO
My name is
Welcome Introductions
___
Breaks Facilities
8.0.0.1 www.sitecore.net/training
Module 1
Sitecore Overview
8.0.0.1 www.sitecore.net/training
Topic 1.1
Course Overview & Agenda
8.0.0.1 www.sitecore.net/training
Objectives for This Course
By the end of this course, you will be able to:
Define data and assemble presentation components
Use common API features
Configure and build for the Experience Editor
Deal with complex sites and large volumes of data
Extend Sitecore’s core functionality
Use recommended practices around installation,
environments, scaling and optimization
8.0.0.1 www.sitecore.net/training
Course Format
10 modules 1 2 3 4 5 6 7 8 9 10
Demos
Exercise – Labs
Review – Questions
Extend
8.0.0.1 www.sitecore.net/training
Module Overviews
Module 1 Sitecore Overview Module 6 Real World Solutions
Module 2 Defining Data Module 7 Configuring the Experience Editor
Module 3 Presentation Module 8 Dealing with Your Data
Module 4 Sitecore API Module 9 Beyond Developer Environment
Module 5 Advanced Presentation Concepts Module 10 Analytics
8.0.0.1 www.sitecore.net/training
Topic 1.2
What Is Sitecore?
8.0.0.1 www.sitecore.net/training
Sitecore Is an Experience Platform
Sitecore combines content management with a marketing
platform
• Design and populate a website
• Tailor the experience to individual visitors
8.0.0.1 www.sitecore.net/training
Cross-Channel Communication
Offering a consistent, individual experience regardless of how visitors
interact with your content
Online and
Social media
offline
engagement
advertising
campaigns
8.0.0.1 www.sitecore.net/training
A Typical Scenario
A Land on site, 4 Sign up for 5
3 Receive e-mail –
contact form callback
personalized based “Visit Facebook
on IP and how you while you wait!”
found the site
Like Facebook 6
2 Follow
page, click link to
campaign
site – personalized
link
10% off offer
8.0.0.1 www.sitecore.net/training
The Developer’s Role
Who are you?
• Professional ASP.NET developers
• Passionate about supporting business goals
What are your responsibilities?
• Build and scale according to recommended practices
• Support Sitecore’s marketing and analytics features
• Build for the Experience Editor
• “Don’t fight the framework!”
8.0.0.1 www.sitecore.net/training
What’s in It for You?
A world leader in customer Clients include:
experience management ASOS, Nestle, Brother, Cadbury, Dyson
• We deliver highly relevant content and easyJet, Canon, Heineken, Kia Motors
personalized digital experiences Play.com, Virgin Active, Thomas Cook
• You will be sought after for your
Sitecore skills
MVP program
• Technical previews, MVP summit,
closed product feedback circuit
Active community
• SDN, Twitter, Stack Overflow, blogging
8.0.0.1 www.sitecore.net/training
Where Can I Find More Information?
Knowledgebase Marketplace Developer Network
(support articles) (modules) (forum, downloads)
Documentation
• https://doc.sitecore.net/
• https://sitecore-community.github.io/docs/
Modules
• Email Experience Manager
• Web Forms for Marketers
• Social Connected
Modules Compatibility Table: https://kb.sitecore.net/articles/541788
8.0.0.1 www.sitecore.net/training
Sitecore XP 8 Resources
Visit dev.sitecore.net
doc.sitecore.net
8.0.0.1 www.sitecore.net/training
How Do I Contact Support?
http://support.sitecore.net
• Before filing a ticket:
o Try reproducing the issue on a clean installation
o Look at log files using log analyzer
https://marketplace.sitecore.net/en/Modules/Sitecore_Log_Analyzer.aspx
o Compare <yoursite>/sitecore/admin/ShowConfig.aspx to stock web.config
o Search marketplace if asking for code examples
8.0.0.1 www.sitecore.net/training
Review – What Is Sitecore?
Q Name two key components that Q What should you do before you
make up Sitecore XP:
contact support?
Experience CMS and marketing
platform Refer to HelpDesk best practices
Q Name some sites that you can refer Q What are your responsibilities as
to for more information and
module downloads. a developer?
SDN: Build according to recommended
http://sdn.Sitecore.net practices
Knowledge Base:
https://kb.Sitecore.net
Marketplace:
https://marketplace.Sitecore.net
Sitecore XP 8:
https://dev.Sitecore.net
Sitecore XP 8 Documents:
https://doc.Sitecore.net
8.0.0.1 www.sitecore.net/training
Topic 1.3
Sitecore from an Author’s
Perspective
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Your New Job Flow with Sitecore
Architects
Storyboard BE Developer
FE Developer
Authors
Live Site
QA
Marketing
Live Site Marketing
8.0.0.1 www.sitecore.net/training
Sitecore as a Web Experience Manager (WXM)
8.0.0.1 www.sitecore.net/training
Demo 1.3 – Sitecore Interfaces
In this demo:
• Use the Experience Editor – navigating, editing and designing
• Use the Desktop
• Use the Content Editor
• Publish content
http://basicsitecore/
To log in, append /sitecore to your URL:
8.0.0.1 www.sitecore.net/training
Publishing and the Sitecore Databases
• Sitecore Publishes items from the Master to the Web database
8.0.0.1 www.sitecore.net/training
Topic 1.4
Sitecore from a Developer’s
Perspective
By the end of this topic you will be able to:
Explain what gets installed on your computer when you install Sitecore
Name three Sitecore databases
Name four foundation features that Sitecore provides out of the box
Draw out the minimum requirements for a production environment
8.0.0.1 www.sitecore.net/training
Sitecore Architecture
Sitecore is an ASP.NET application
Applications
Base Implementation
Sitecore
API Layer
Data
8.0.0.1 www.sitecore.net/training
Requirements for Sitecore
Current Requirements
• ASP.NET 4.5
• SQL 2008 R2 SP1 or better
• IIS Integrated Mode
• MVC 5.1 (for SPEAK UI)
• MongoDB (if using xDB/Analytics)
8.0.0.1 www.sitecore.net/training
Separation of Concerns
Authors and developers have separate responsibilities
Authors… Developers…
• Mange content and presentation using • Define data structure and presentation
your custom implementation of Sitecore components for authors
Sitecore Rocks
Visual Studio Plugin
8.0.0.1 www.sitecore.net/training
How Sitecore Handles a Request
Browser IIS Sitecore
Requests URL
Passes request
Page dynamically
assembled*
Stream response back
*More in Module 3
8.0.0.1 www.sitecore.net/training
What Gets Installed?
Databases
• Master – authoring database, work in progress Core Master Web
• Web – published, live content
• Core – settings and membership
• xDB – MongoDB NoSQL collection. New starting with 7.5! xDB Reporting
• Reporting – replaces Analytics DB previous to version 7.5
File system
• Website – Web root of your Sitecore application
• Database – database files
• Data – license, Sitecore logs, packages, indexes
8.0.0.1 www.sitecore.net/training
Installation Scenarios – Recommended Minimum
Content Database Content
Management server Delivery
server server
Live environment
Authoring environment
No access to Sitecore
Previewing capabilities Master Web client (*/sitecore)
• Access to master • Access to web
• Access to web
• Access to core
• Access to core
Core
8.0.0.1 www.sitecore.net/training
Review – Sitecore from a Developer’s
Perspective
Q When a request comes in, Q Name some foundation features
Sitecore… that Sitecore provides out of the
Maps URL to an item in the content box
tree and dynamically assembles Content versioning, multi-language
presentation support, devices (adaptive design)
support
Q Name the three databases that
are installed by default: Q What is the name of the digital
Master, web, core marketing management part of
the Experience Platform that
collects and aggregates contact
information?
xDB (or Experience Database)
8.0.0.1 www.sitecore.net/training
Module 2
Defining Data
8.0.0.1 www.sitecore.net/training
Creating Data Templates
Topic 2.1
8.0.0.1 www.sitecore.net/training
Items, Fields and Data Templates
An item Field
• Is a unit of data in Sitecore Section
• Has fields organized into field sections
Data templates Fields
• Fundamental building block in Sitecore
• Define a type of item
• Determine what field sections, field
types and field names compose an item
• Field types determine the editor control
used in the tools, for example: Image
fields, Rich Text fields
8.0.0.1 www.sitecore.net/training
Building Data Templates
Start by building data templates
• After your thorough data analysis, begin by building
base templates
• Include Fields and Field Sections that can be reused
• In our project, Content Base will become the base
template for our future templates
Content Base
• The easiest way to create data templates is using
Sitecore Rocks Heading
Main Content
Main Image
8.0.0.1 www.sitecore.net/training
Field Type Determines…
• Editing controls used in the Sitecore Tools
8.0.0.1 www.sitecore.net/training
Field Source Folder with images
in Content Tree
8.0.0.1 www.sitecore.net/training
This Course Uses Sitecore Rocks Extensively
A free plug-in that integrates Sitecore and Visual Studio IDE
• Provides access to Sitecore Content Tree
• Integrates with .NET component development
• Authors use Sitecore Client Tools vs. Sitecore Rocks
8.0.0.1 www.sitecore.net/training
Demo 2.1 – Creating Data Templates
Demo objectives:
• Create a data template and name it Content Base
• Add three fields to the template: Heading, Main Image and Main Content
Use Commandy!
CTRL + SHIFT+ SPACE
8.0.0.1 www.sitecore.net/training
Exercise 2.1 – Create Data Templates
8.0.0.1 www.sitecore.net/training
Review – Defining Data Structure
Q An item’s type is determined by Q In the Content Editor, where can
the ______ used to create it. you find out which data template
Data template an item is based on?
Quick Info section on that item
Q What is an item composed of?
Field sections and fields Q Some examples of field types
are…
Q What do you need to specify Single-Line Text, Rich Text, Image,
when creating a new field? Date
Field name and type
8.0.0.1 www.sitecore.net/training
Topic 2.2
Data Template Inheritance
8.0.0.1 www.sitecore.net/training
Challenges with Repeated Fields
Important issues:
• There is no one true source for these fields
• Changes to field names and types have to be applied on every single data template
8.0.0.1 www.sitecore.net/training
Data Template Inheritance
Inheritance …
Standard
• Merges fields from all System fields
Template
inherited data templates
• All data templates inherit
from Standard Template Heading
Main Content Content
o contains fields that define Main Image Base
system properties
• Modifying the Content Base
template will affect all the Holidays
items immediately Trip Bicycle
Section
8.0.0.1 www.sitecore.net/training
Resulting Inherited Structure
Holidays Section Trip Bicycle
Heading* Heading* Heading*
Main Content* Main Content* Main Content*
Main Image* Main Image* Main Image*
Price per person Type
Start date Suitability
*Fields inherited from Content Base
After inheriting from the base template, Content Base
• Every data template receives fields defined in Content Base
Warning:
• Field names should be unique, but field sections with the same name will merge
• Avoid circular data template inheritance - never inherit indirectly from itself
• Get data template inheritance right! Refactoring may cause a loss of field values
8.0.0.1 www.sitecore.net/training
Demo 2.2 – Assign and View Data Template
Inheritance
Demo objectives
• Create a Holidays Section data template
• Set the Holidays Section data template icon
• Change Holidays Section data template to inherit from Content Base
• Create a Family Holidays item based on the Holidays Section data template
• Create a Trip data template and change it to inherit from Content Base
• Create a Cycle the Cotswolds item under the Family Holidays item, using the
Trip data template
• View the list of data templates that Cycle the Cotswolds inherits
8.0.0.1 www.sitecore.net/training
Exercise 2.2 – Template Inheritance
Lab 2.2.A Create a data template named Holidays Section and data
template named Trip
Lab 2.2.C Create content items using the Holiday Section and Trip
data templates
8.0.0.1 www.sitecore.net/training
Creating Items
1
2
Item uses data template icon –
easy to distinguish types
8.0.0.1 www.sitecore.net/training
Review – Data Template Inheritance
Q In which scenario would you use Q What happens if the same field
data template inheritance? section name is used in multiple
templates in a data template's
When fields are repeated in multiple inheritance tree?
data templates
The field sections will merge
Q Why is it important to think of
your data template creation and Fields will be listed under this single
section
inheritance structure from the
beginning? Q What happens if the same field
Refactoring template inheritance may name is used in two separate
cause data loss inherited data templates?
Fields do not merge
Q By default, all data templates
eventually inherit from which Both fields will appear
Sitecore data template? Best to avoid reusing the same field
Standard Template names
8.0.0.1 www.sitecore.net/training
Topic 2.3
Standard Values
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Standard Values Allow You to Define Defaults
8.0.0.1 www.sitecore.net/training
Standard Values and Inheritance
Base data template
inheritance
Inheriting data template
Standard Value
Option to override
information
Instance of item
8.0.0.1 www.sitecore.net/training
Tokens
Tokens are replaced the moment an item is created
• $name, $id, $time, $parentid (further examples in Student Manual)
• You can add your own tokens programmatically
Instance of an item
Item is created
token is
evaluated
8.0.0.1 www.sitecore.net/training
Item Naming Conventions
Business names preferred approach:
• Name items using spaces so tokens expand in fields correctly
• Hyphenated item names result in hyphenated field values where tokens were used
8.0.0.1 www.sitecore.net/training
Exercise 2.3 – Create Standard Values
Lab 2.3.A Create Standard Values and populate with tokens and sample content
8.0.0.1 www.sitecore.net/training
Review – Standard Values
Q Describe the standard values Q What are the two types of
item default field values?
Always named __Standard Values Dynamic (uses tokens) and Static.
Child item of owning data template Q How do tokens work?
Is a special instance of an item – Tokens are replaced when an item is
contains all inherited fields created. For example, there are
tokens for the name of the item or the
Q What type of settings can be ID of the parent item.
applied to standard values?
Q Name three tokens:
Default field values, default Insert
Options, default presentation, default $name, $date, $id, $parentid,
Workflow $parentname, $time, $now
8.0.0.1 www.sitecore.net/training
Topic 2.4
Insert Options
8.0.0.1 www.sitecore.net/training
What Are Insert Options?
Why Insert Options?
• Authors require a list of allowed item types (data templates)
• Developers and administrators are less restricted
Insert Options…
• Define allowed child items Insert
Insert options
Options
• Allow authors to build multiple levels defined
definedbyby
of content in the tree developers
developers
• Reduce risk of human error
• Usually defined on Standard
Values
• Can be overridden on an item
8.0.0.1 www.sitecore.net/training
Demo 2.4 – Set Insert Options
Demo objectives
• Assign Insert Options to the Holidays Section data template
8.0.0.1 www.sitecore.net/training
Exercise 2.4 – Insert Options
Lab 2.4.A Add Trip as an Insert Option on the Holidays Section data template
8.0.0.1 www.sitecore.net/training
Review – Insert Options
Q What are Insert Options? Q Why is it a good idea to
A list of item types (data templates) configure Insert Options on
that can be created under a specific standard values?
item All items using that data template will
have the same Insert Options
Q Where should Insert Options be
configured?
On the data template’s standard
values which can be overridden at
item level
8.0.0.1 www.sitecore.net/training
Summary and Optional Lab
Topic 2.5
8.0.0.1 www.sitecore.net/training
Key Vocabulary
Data Template
Defines an item’s type. Contains field sections and fields. Should always have a
unique icon. Used to create items.
Field
Holds content. Can be different types: Single-Line Text, Rich Text, Image, General
Link and more. Type determines the interface that the author sees for editing that
field.
Data Template Inheritance
Data templates can inherit fields and field sections from other data templates.
Reduces duplication.
Standard Values
__Standard Values is a child item of a data template and is the mechanism for
defaults when items are created.
Insert Options
List of item types that can be inserted by authors as a child of a particular item.
8.0.0.1 www.sitecore.net/training
Data Template vs. Standard Values
1. Default
1. Field Sections
Field Values
2. Default
2. Fields Insert Options
Data Standard
Template Values 3. Default
3. Template Icon Presentation Details*
8.0.0.1 www.sitecore.net/training
Review of Steps
Content
Data Templates
• Field sections
• Field names/types
• Icon
• Inheritance
1
Data Template
? ?
Standard Values
• Default values
• Insert Options
• Tokens Content Items
• Create the 2
tree structure
8.0.0.1 www.sitecore.net/training
Exercise 2.5 – Optional Lab
In this lab, you will use the skills you have learned in Module 2 to
create a Bicycle data template.
See student manual for further instructions. For detailed steps, refer to previous labs.
8.0.0.1 www.sitecore.net/training
Layout Not Found
What happens when you
• Preview http://basicsitecore/Family Holidays
8.0.0.1 www.sitecore.net/training
Module 3
Presentation
Presentation Is Dynamic and Modular
Preparing to Build with a Visual Studio Project
Creating a Layout
Creating Components
Dynamic Binding
Rendering Content
8.0.0.1 www.sitecore.net/training
Presentation Is Dynamic and Modular
Topic 3.1
8.0.0.1 www.sitecore.net/training
How Sitecore Resolves a Page
Static HTML
• URL points to an HTML file with the same name
Sitecore
• URL points to an item in Sitecore, which has a set of rendering instructions
8.0.0.1 www.sitecore.net/training
A Detailed Look at a Request
Browser IIS Sitecore
Requests URL
Passes request
Presentation
Run RenderLayout pipeline assembled dynamically
from configuration in
Stream response back presentation details
8.0.0.1 www.sitecore.net/training
Presentation Details
Presentation details determine the
appearance of an item when it is
requested by the browser
Modular components
on a canvas
8.0.0.1 www.sitecore.net/training
Demo 3.1 – Modify the Presentation with
Experience Editor
Demo objectives
• Create a new Standard Content item in Traincore
• Use Sitecore Rocks to view presentation details
• Add a Banner and General Widget component to the newly created page
• Use Sitecore Rocks to view changes in presentation
8.0.0.1 www.sitecore.net/training
Review – Presentation Is Dynamic and Modular
8.0.0.1 www.sitecore.net/training
Preparing to Build with Visual Studio
Topic 3.2
8.0.0.1 www.sitecore.net/training
Turn Your Design into Components
Break designs into units of reusable functionality
Consult your front-end developers, designers and user experience designers!
8.0.0.1 www.sitecore.net/training
How Would You Componentize Your Own Sites?
8.0.0.1 www.sitecore.net/training
Create a Visual Studio Project
Presentation details map to physical files on the file system
• Sitecore is an ASP.NET application – it has a web root and web.config
• Create and manage presentation files in a normal Visual Studio project
• Connect Sitecore Rocks to project – you never have to leave Visual Studio!
8.0.0.1 www.sitecore.net/training
Walkthrough 3.2 – Creating a Project
Walkthrough steps
• Create a new ASP.NET Empty Web Application (C#) project in Visual Studio named
BasicSitecore to match our Sitecore instance
• Move the .csproj and the Properties folder into the web root (check permissions)
• Include the layouts folder in project
• Add a reference to the Sitecore.Kernel.dll
o It is important: set Copy Local property to False
• Connect the project to Sitecore Rocks
• Note: We will cover using a project inside the webroot in this module
8.0.0.1 www.sitecore.net/training
Review – Preparing to Build
Q What is the name of the main Q What happens if you do not set
Sitecore .dll? Copy Local to False for your
Sitecore.Kernel.dll Sitecore.Kernel reference?
Some dll’s in bin folder will be deleted
and you will need to get the full set
from another installation to continue
working.
8.0.0.1 www.sitecore.net/training
Creating a Layout
Topic 3.3
8.0.0.1 www.sitecore.net/training
One Layout for All Items in Our Site
A Layout is a canvas or the ‘scaffolding’ for a site
• The training site BasicSitecore defines a single shared Layout for all items within
the site (per device)
• Assign Layout on standard values (consider setting Layouts on base templates)
• Build up page design using components
8.0.0.1 www.sitecore.net/training
What Is a Layout?
A Layout is…
• An .aspx file on the file system See lab instructions for
details on how to create a
• A corresponding Layout definition item in the tree Layout in Sitecore Rocks!
• Linked by the Path field
8.0.0.1 www.sitecore.net/training
Assigning a Layout
Items must have a Layout to be viewed as web pages
• Layouts are part of an item’s presentation details
• Recommended practice – assign Layouts to the data template’s standard values
• An item can have one Layout per device* (mobile, print, RSS)
8.0.0.1 www.sitecore.net/training
Demo 3.2 – Creating and Assigning a Layout
Demo objectives
• Create a Layout using Sitecore Rocks – this creates both the file and the item
• Paste sample HTML into the Layout .aspx file
• Assign a Layout to the Content Base data template’s standard values
• Preview an item that inherits from Content Base
8.0.0.1 www.sitecore.net/training
Exercise 3.3 – Create and Assign a Layout
Lab 3.3.C Assign a Layout to Content Base template’s standard values and preview
the Family Holidays item
8.0.0.1 www.sitecore.net/training
Review – Creating a Layout
Q In a Sitecore context, what is the Q How do you configure an item’s
name give to an .aspx file? presentation details in Sitecore
A Layout Rocks?
Right-click->Tasks->Design Layout or
Q How is a Layout definition item CTRL+U.You can also use Commandy
connected to a Layout file?
The Path field on the Layout
Q How many Layouts can you
definition item points to the location assign to a single item?
of the .aspx file One – per device!
8.0.0.1 www.sitecore.net/training
Creating Components
Topic 3.4
8.0.0.1 www.sitecore.net/training
Movable, Reusable Components
Pages are assembled from smaller units of functionality
• Various types – collectively known as components
• Components can be re-used and moved and they can be nested
• Arranged to create a unique page design
8.0.0.1 www.sitecore.net/training
What Is a Component?
A component can be a… We will use the term
component
• Sublayout (Sitecore’s wrapper for a Web User Control)
• XSLT Rendering
• Sitecore Web Control There are Sitecore MVC
alternatives – see videos!
8.0.0.1 www.sitecore.net/training
What Is a Sitecore Sublayout?
A Sitecore Sublayout is: See lab instructions on how
to create a Sublayout in
• Most commonly used component in a web forms Sitecore Rocks!
implementation
• An .ascx file on the file system (with normal .ascx.cs code behind)
• A corresponding Sublayout definition item in the Sitecore tree
• Linked by the Path field
• A wrapper for normal .NET User Control
8.0.0.1 www.sitecore.net/training
Demo 3.4 – Creating a Sublayout
Demo objectives
• Create a Sublayout named Introduction
• Move the heading, content and image from Main.aspx into the Introduction
Sublayout
8.0.0.1 www.sitecore.net/training
Exercise 3.4 – Create a Sublayout
8.0.0.1 www.sitecore.net/training
Review – Creating a Component
Q Name three different types of Q A component consists of a file on
Sitecore components the file system and…
Sublayout, XSLT rendering, web A definition item in Sitecore
control
Q How does a component definition
Q What type of file is a Sitecore item know where to find the
Sublayout? associated file?
.ascx By a Path field on the definition item
8.0.0.1 www.sitecore.net/training
Dynamic Binding
Topic 3.5
8.0.0.1 www.sitecore.net/training
Dynamic Binding of Components to a Layout
8.0.0.1 www.sitecore.net/training
What Are Placeholders?
• Placeholders are Sitecore controls used in Layouts and Sublayouts
o Define where components can dynamically be bound to an area of a page
o Can be added anywhere in the markup of Layouts or Sublayouts
• Identified by an attribute called Key (the ID attribute is not required)
• The Placeholder is added directly in the markup:
<sc:Placeholder Key=“gallerycontainer" runat="server" />
(Module 7 covers Placeholder Settings items, which are required by Experience Editor)
8.0.0.1 www.sitecore.net/training
Binding Components to Placeholders
Presentation Details: Tasks->Design Layout or CTRL+U
maincontent
content
8.0.0.1 www.sitecore.net/training
Demo 3.4 – Holidays Section Presentation
Details
Demo objectives
• Create a maincontent placeholder in Main.aspx
• Bind the Introduction component to the maincontent placeholder on Content
Base template’s standard values
• Preview Family Holidays
• Add an additional Introduction component to Family Holidays
• Reset presentation back to what it looked like prior to adding the additional
component
8.0.0.1 www.sitecore.net/training
Dynamic vs. Static Binding
What are the benefits of dynamic binding?
• New page types can be assembled from existing components
• Changes to page structure do not require a developer
• Supports content re-use (more in Module 5)
• Supports Sitecore’s personalization and testing features
Static binding
• Some components, like headers and footers, may be statically bound
<sc:Sublayout Path="/layouts/Header.ascx"runat="server" />
8.0.0.1 www.sitecore.net/training
Designs Change
Resetting Presentation
• Editors may modify appearance of a page using Experience Editor
• Changes are stored on the item
• Presentation can be reset back to the default Standard Values
• Reset buttons available in Experience Editor and Content Editor for editors
• Developers can reset in Sitecore Rocks
Experience Editor
Content Editor
Sitecore Rocks
8.0.0.1 www.sitecore.net/training
Exercise 3.5 – Binding Components
Bind components to placeholders on standard values
8.0.0.1 www.sitecore.net/training
Review – Dynamic Binding
Q What is the Sitecore control that Q Name the property that you
must set on a placeholder to
allows you to dynamically bind identify it.
components to a page?
Key
sc:Placeholder
Q If all items of a particular type
Q What is the Sitecore control to require a particular component,
statically include Sublayouts on a where should these presentation
details be configured?
page?
On the standard values of the data
sc:Sublayout template
8.0.0.1 www.sitecore.net/training
How Do You Output Content?
Field property
Sitecore Item is mandatory
Introduction.ascx
<sc:Text Field="Heading"
runat="server" />
8.0.0.1 www.sitecore.net/training
Sitecore Controls Have Optional Attributes
Sitecore offers a different set of options depending on the control
On Sitecore’s Image control, you can configure:
• CssClass for a particular instance of an image
• Dynamically resize with MaxWidth or MaxHeight (caches an image of that size on the
server!)
8.0.0.1 www.sitecore.net/training
Demo 3.6 – Outputting Content
Demo objectives
• Swap all static content with Sitecore controls
8.0.0.1 www.sitecore.net/training
Exercise 3.6 – Outputting Content
8.0.0.1 www.sitecore.net/training
Review – Outputting Content
Q Name three specialized Sitecore Q Name the one mandatory
field controls property that must be specified
<sc:Text />, <sc:Date>, <sc:Image /> on the Sitecore web controls
Field
Q How can Sitecore help you resize (note: on <sc:FieldRenderer />, the
images dynamically? equivalent is FieldName)
Set MaxWidth and/or MaxHeight on
the sc:Image tag
8.0.0.1 www.sitecore.net/training
Summary and Optional Lab
Topic 3.7
8.0.0.1 www.sitecore.net/training
Vocabulary
Presentation details
• An item’s presentation details are instructions that tell it which Layout and components
to use and which placeholders to use to dynamically bind components.
Layout
• A Layout is your page canvas. It is linked to an .aspx file on the file system, which may
also be referred to as a ‘Layout’. You can have one Layout per item per device.
Component
• A unit of functionality. All components have a definition item in the Sitecore tree and a
file on the file system. Components can be: Sitecore Sublayouts (.ascx), XSLT renderings
(.xslt), or web controls (.cs).
Placeholder
• A placeholder is a Sitecore control that determines where on a page a component can
be inserted. Inserted amongst regular HTML markup and must have a key.
8.0.0.1 www.sitecore.net/training
The Renderings Field
All presentation is stored in the Renderings field as custom XML
When presentation details are changed, the raw value of the renderings field is
updated. This XML contains all information about layout, devices, components and
placeholders.
8.0.0.1 www.sitecore.net/training
Review of Steps
Content Presentation Binding
Data templates
• Field sections 3 5
• Field names/types Create Layout
• Icon • Device
• Inheritance • Layout .aspx Data template
1 standard values
Data template • Presentation
standard values 4 Layout Details
Create
• Default values components • Placeholders
• Insert options
• Sublayout .ascx
• Presentation details
• Web Control .cs
• Workflows *
• XSLT (.cs)
2 Content Items
• Create the tree structure
8.0.0.1 www.sitecore.net/training
Exercise 3.7 – Optional
In this lab, you will use the skills you have learned in Module 3 to
build up default presentation for the Bicycle data template.
See book for further instructions. For detailed steps, refer to previous labs.
8.0.0.1 www.sitecore.net/training
Module 4
Sitecore API
8.0.0.1 www.sitecore.net/training
Topic 4.1
Basic API Concepts and Retrieving
Items
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Sitecore.Kernel Assembly
Sitecore Namespaces
• Sitecore.Data – CRUD operations, item manipulation
• Sitecore.Context – Information about current request
• Sitecore.Links – Links management
8.0.0.1 www.sitecore.net/training
Sitecore Context
• The Sitecore context, exposed by the static Sitecore.Context class, contains
information about the Sitecore installation and the current HTTP request
8.0.0.1 www.sitecore.net/training
Debugging
Sitecore is a regular .NET application
• You can use the usual Visual Studio debugging techniques
• Preview a page that will run the code
• Use Sitecore Rocks (commandy) to Attach to Process… to all w3wp worker
processes
o (F5 not recommended unless after a Sitecore Publish)
• Step through your code
8.0.0.1 www.sitecore.net/training
Demo 4.1.1 – Basic API Concepts
Demo objectives
• Explore Sitecore.Context
8.0.0.1 www.sitecore.net/training
The GetItem() Method
Retrieving items
• Items represented by the type Sitecore.Data.Items.Item
• Items can be retrieved using the GetItem() method:
o Sitecore.Context.Database.GetItem("/sitecore/content/Home");
• If you want to get an item from another database (for example: editing an item in
the master database), get the desired database by name:
Sitecore.Configuration.Factory.GetDatabase("master");
8.0.0.1 www.sitecore.net/training
Demo 4.1.2 – Retrieving Items
Demo objectives
• Use .GetItem() to retrieve an item by path and ID
• Explore Item properties and methods
• Use .GetChildren() and .Children
o These return a collection of items of type Sitecore.Collections.ChildList
Example:
Sitecore.Collections.ChildList children = item.GetChildren();
8.0.0.1 www.sitecore.net/training
Exercise 4.1 – Render Item Children (30 min)
8.0.0.1 www.sitecore.net/training
Review – Basic API Concepts
Q In which .dll can you find the Q When you are looking at a page
majority of the API? in Experience Editor mode, what
Sitecore.Kernel is the context database?
Master
Q When Sitecore makes a request,
what is the name of the static
class that is assembled?
Sitecore.Context
Q Name four properties that you
might get from Sitecore.Context:
Context user, language, database and
item
8.0.0.1 www.sitecore.net/training
Review – Retrieving Items
Q Name the method used to Q How should you compare two
retrieve items? items in code?
GetItem() Using their IDs
8.0.0.1 www.sitecore.net/training
Topic 4.2
Item Links
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Item Resolver
item.Name = Holidays
Sitecore’s ItemResolver resolves
a URL to an item and can interpret item.DisplayName = Our Holidays
various different URL formats:
item.ID = {F02D3ACC-45B1-45A1-9BD2-
C19B9D81099E}
http://mysite/....
Family Holidays
Family Holidays/
Family Holidays.aspx
Our%20Holidays.aspx
en/Family Holidays.aspx
Family Holidays.aspx?sc_lang=en
?sc_itemid={F02D3ACC-45B1-45A1-9BD2-C19B9D81099E}
~/link.aspx?_id=F02D3ACC-45B1-45A1-9BD2-C19B9D81099E&_z=z
Display Names allow alternative item names for different languages. If the site was translated
into Danish, the content editor would see ‘ferier’ rather than ‘Family Holidays’
8.0.0.1 www.sitecore.net/training
LinkManager and Item URLs
Always use the LinkManager to output an item’s URL
• Use LinkManager.GetItemUrl() – recommended practice; SEO-friendly URL
• Do NOT use LinkManager.GetDynamicUrl() – URL with a GUID!
8.0.0.1 www.sitecore.net/training
Demo 4.2 – Retrieving an Item’s URL
Demo objectives
• Retrieve the item URL using LinkManager.GetItemUrl()
• Use UrlOptions to output the Display Name
• Change items to use Display Name in Sitecore
Example:
Item item = Sitecore.Context.Database.GetItem("{565A8A17-032F-44AC-B506-
B65F27A31241}");
options.UseDisplayName = true;
8.0.0.1 www.sitecore.net/training
Controlling Your URLs
Decide how you want to render links
• Individually or globally
8.0.0.1 www.sitecore.net/training
Exercise 4.2 – Render Item Links (10 min)
8.0.0.1 www.sitecore.net/training
Review – Item Links
Q What method do you use to Q What object can you pass into
retrieve an item’s URL? the GetItemUrl() method to
LinkManager.GetItemUrl() customize the way your item’s
URL is rendered?
Q Why should you not use A UrlOptions object
GetDynamicUrl() for your site’s
front end? Q Where can you customize how
Unreadable ‘developer’ URL, uses IDs URLs are rendered globally?
In the LinkManager section of the
web.config
8.0.0.1 www.sitecore.net/training
Topic 4.3
Creating, Deleting and Modifying
Items
By the end of this topic you will be able to:
A field’s raw value (value stored in database) depends on the field type
8.0.0.1 www.sitecore.net/training
Getting and Setting Raw Values
Access the field value directly…
string fieldValue = Sitecore.Context.Item["Profile Text"];
(note: this returns String.Empty even if field is null)
Note: If you bind field.Value to a .NET Literal, it will not be editable in the Experience Editor!
8.0.0.1 www.sitecore.net/training
Demo 4.3.1 – Raw Values
Demo objectives
• View the raw values of items in Sitecore Rocks
• Output raw value to the browser – which will not be editable in the Experience
Editor
8.0.0.1 www.sitecore.net/training
Creating and Editing Items
Seven Steps to Edit or Create an Item:
1. Get the master database – do not edit directly on web database!
2. Change the security context
3. Retrieve an item
(When creating a new item, you need the parent item and a data template ID)
4. Put the item into an editing state use Editing.BeginEdit() in a try/catch
block
5. Set the item’s field values to the new values
6. Save changes with Editing.EndEdit()
7. You must publish your changes if you want them to appear in the web database
8.0.0.1
www.sitecore.net/training
Security and Editing Contexts
Security context Editing context
• Requests are made in the context • Editing and renaming must happen in
of anonymous or currently the editing context
logged-in user
• You can force code to run regardless try
{
of context user’s permissions: newItem.Editing.BeginEdit();
newItem.Editing.EndEdit();
o UserSwitcher is safer in production, }
however you can also use
catch
SecurityDisabler {
newItem.Editing.CancelEdit();
}
using (new SecurityDisabler()){}
8.0.0.1 www.sitecore.net/training
Demo 4.3.2 – Creating and Editing an Item
Demo objectives
• Programmatically create an item based on the Trip template
8.0.0.1 www.sitecore.net/training
Recommended Practices
You will not typically create items for your live site (the CD
environment)
• But you may have to do it in the CM server: data import, web service…
What are the options for adding content from within the CD?
• Item Web API (bundled with 7.2+)
• Custom web API or service
• Third party service (high volume user-generated content, such as comments)
8.0.0.1 www.sitecore.net/training
Exercise 4.3 – Create and Edit Items
8.0.0.1 www.sitecore.net/training
Review – Creating, Deleting and Modifying
8.0.0.1 www.sitecore.net/training
Review – Creating, Deleting and Modifying
Items
Q Why is it a bad idea to output a Q Which field types are suitable for
field’s value straight to the editing using the .Value
screen? property?
Not editable in Experience Editor and Simple text fields. For example,
complex fields contain custom XML Single-Line Text
8.0.0.1 www.sitecore.net/training
Topic 4.4
Working with Complex Fields
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
RECAP: Field Types (previously mentioned in 2.2)
8.0.0.1 www.sitecore.net/training
Simple Fields
Simple fields contain text only
Field Raw value Source Control Class
Singe-Line Text
Multi-Line Text text n/a <sc:Text /> Field
Integer
Path,
Rich Text text <sc:Text /> Field
GUID
Droplist
Path,
Grouped <sc:Text />
text GUID, Field
Droplist Query
8.0.0.1 www.sitecore.net/training
Complex Fields
Field Raw value Source field Control Class
Image Custom XML Path, GUID <sc:Image /> ImageField
Date ISO date n/a <sc:Date /> DateField
General Link Custom XML n/a <sc:Link /> LinkField
Droplink
Grouped
Single GUID Path, GUID, Query n/a ReferenceField
Droplink
Droptree
Multilist
Path, GUID, Query
Checklist Pipe-
Treelist delimited Path, GUID, n/a MulitlistField
GUIDs Parameterized
TreelistEx
Datasource
1 (true) or
Checkbox n/a n/a CheckboxField
not 1 (false)
File Custom XML Path, GUID n/a FileField
8.0.0.1 www.sitecore.net/training
Base Field Object
Sitecore.Data.Fields.Field
8.0.0.1 www.sitecore.net/training
Raw Value of a Rich Text
Example of the raw value of a Rich Text field containing a link:
<p>Have an <a
href="~/link.aspx?_id=992233B83B0447F4B23BE548AACED6AA&_z=z">awesom
e holiday</a> with us!</p>
Notice the URL – this uses non-SEO Notice _z=z in the URL. This is a
friendly GetDynamicUrl() terminator, everything after this is
treated as a normal querystring
8.0.0.1 www.sitecore.net/training
ImageField Object
Sitecore.Data.Fields.ImageField
8.0.0.1 www.sitecore.net/training
LinkField Object
Sitecore.Data.Fields.LinkField
8.0.0.1 www.sitecore.net/training
ReferenceField Object
Sitecore.Data.Fields.ReferenceField
8.0.0.1 www.sitecore.net/training
MultilistField Object
Sitecore.Data.Fields.MultilistField
8.0.0.1 www.sitecore.net/training
Some Fields Can Be ‘Rendered’
Rendering images, links, text and dates for web pages
• The FieldRenderer pipeline can turn raw values that are unfit for websites into
rendered field values that can be used on web pages
• For example, this is an Image field’s raw value in the master database:
<image mediaid="{743C2FAD-0E01-426E-8972-2CCFEBDC20F9}"
mediapath="/BaseCore/Images/Holiday Image"
src="~/media/743C2FAD0E01426E89722CCFEBDC20F9.ashx" />
For that same Image field, here is the rendered HTML tag:
<img src="/~/media/BaseCore/Images/Holiday Image.ashx" />
8.0.0.1 www.sitecore.net/training
Render() Method Parameters
Different Parameters for the Render() Method
• Image – image formatting string, such as “w=120&as=1” for width of 120 pixels
and allow stretching the image
8.0.0.1 www.sitecore.net/training
Demo 4.4 – Using the FieldRenderer
Demo objectives
• Use the FieldRenderer.Render() method with a few parameters to output an
Image field
8.0.0.1 www.sitecore.net/training
Exercise 4.4 –Complex Fields (50 min)
8.0.0.1 www.sitecore.net/training
Review – Complex Fields
Q Why is it a bad idea to output raw Q What method should you use to
values to the screen? render the contents of text, date,
Not editable in Experience Editor, image and link fields to the screen
complex field types will not make (and why)?
sense – images, for example FieldRenderer.Render() – Experience
Editor support, transforms custom
Q Name the best suited field object XML, transforms Rich Text links
for the following field types:
single-line text, treelist, droplink, Q Why are you unable to render a
general link: multilist field to the page using
Field, MultilistField, ReferenceField, .Render()?
LinkField It contains IDs, not readable content
8.0.0.1 www.sitecore.net/training
Module 5
Advanced Presentation Concepts
Reusable Content
Layout Deltas
8.0.0.1 www.sitecore.net/training
Topic 5.1
Reusable Content
Define a Datasource
Be able to retrieve the Datasource from a component
Describe the benefits of using Parameters
Set and retrieve Parameters
Describe what the ParseURLParameters utility does
8.0.0.1 www.sitecore.net/training
Demo 5.1.1 – What Is a Datasource?
Demo objectives
• Using TrainCore in Experience Editor design
mode, change a General Widget’s Data Source
• Add an additional General Widget to the page
• Illustrate the reuse of components and
content
8.0.0.1 www.sitecore.net/training
What Is a Datasource?
Allows your component to display content from an item that is not the
context item
Benefit?
Reusable content and components that prepares for Experience Marketing
implementation
8.0.0.1 www.sitecore.net/training
Datasources Allow..
• A component that takes data from an item that is not the context item
• Content and components need to be reusable and Experience Marketing ready
• You use GUID’s and physical paths to items
in the Data Source field
8.0.0.1 www.sitecore.net/training
Using the API for Sublayout Datasources
• Sublayouts are just .NET user controls, no prior method to retrieve Datasources
• To get a sublayout’s datasource, you can use the following snippet in your code-
behind:
8.0.0.1 www.sitecore.net/training
Forcing Controls to Use the DataSource
By default the target of a Sitecore control is the context item
• If you use an <sc:Text /> without explicitly setting the item that it should target, it
will try to render the specified field from the context item.
• To force Sitecore controls to target the Datasource, you can either set the
.Item property or the .DataSource property:
OR
Heading.DataSource = "{6C0EB349-5FBA-481C-A350-7B9ECAD7D394}"
Or you can set the control’s DataSource or Item property directly in the .ascx file!
8.0.0.1 www.sitecore.net/training
Demo 5.1.2 – Datasource API
Demo objectives
• Modify the Trip component to accept a Datasource
8.0.0.1 www.sitecore.net/training
Component Rendering Parameters
Component’s
parameters in
Experience Editor
8.0.0.1 www.sitecore.net/training
Retrieve Rendering Parameters Using the API
8.0.0.1 www.sitecore.net/training
Demo 5.1.3 – Parameters
Demo objectives
• Change the background color for the Trip Overview component from grey to red
using rendering parameters from a parameters template
8.0.0.1 www.sitecore.net/training
Setting an Item’s Presentation and a Component’s
Datasource
Uniqueness:
• Set the Presentation on each item and set the Datasource on each component
instance
Standardization
• Set the Presentation on the Standard Values and set the Datasource on the
component’s definition item
Combination
• You can start with standardization and have uniqueness in some instances
8.0.0.1 www.sitecore.net/training
Unique Presentations
Set the…
• Presentation on each Item—When presentation is set on an item, only that one
item has that particular presentation
8.0.0.1 www.sitecore.net/training
Standard Presentation
Set the…
• Presentation on the Standard Values—All items sharing that specific data
template have the same presentation (unless altered by an individual item’s
presentation)
8.0.0.1 www.sitecore.net/training
Combination Approach
You can start with standardization and add uniqueness in some instances
Set the…
• Presentation on the Standard Values—All items based on a data template start
with the same presentation
• Datasource on a Component’s Definition Item—All instances of the component
start with the same Datasource. Both the item’s presentation or one component
instance’s Datasource can be overridden.
8.0.0.1 www.sitecore.net/training
Exercise 5.1 – Build a Featured Trip Component
(40 min)
Lab 5.1.A Create component and get the DataSource item
8.0.0.1 www.sitecore.net/training
Review – Datasources
Q Setting a component Datasource Q What do parameters allow you
allows that component to _____. to do?
Output content from a content item Allow properties to be set per
elsewhere in the tree instance of a component
8.0.0.1 www.sitecore.net/training
Review – Datasources
Q What utility converts parameter Q Why would you set the
lists to a NameValueCollection? component and the Datasource
on the standard values’
WebUtil.ParseUrlParameters() presentation details?
Q Why would you set the Datasource When you want all items based on a
particular template to have that
for a component on the component with that particular
presentation details of an item? Datasource as default
When that Datasource should only be Q Why would you set the
used on a particular page component on the standard
values and override the
Datasource on the item?
When your component has to appear
on every page but has a different
Datasource for a particular page
8.0.0.1 www.sitecore.net/training
Topic 5.2
Layout Deltas
8.0.0.1 www.sitecore.net/training
What are Layout Deltas?
• When presentation details are overridden on an item (differ from presentation details
defined on the standard values) – layout deltas get created
• When developers update standard values, the item gets updated via the delta
8.0.0.1 www.sitecore.net/training
A Layout Delta Is Like a Transform
• Presentation details are stored as XML in the Renderings field
Un-edited standard
values presentation
8.0.0.1 www.sitecore.net/training
The RenderLayout in the Request
Browser IIS Sitecore
Requests URL
Passes request
Map request to a
Run HttpRequestBegin pipeline content item
Inspects rendering
Run RenderLayout pipeline property of Content Item,
retrieves presentation
components and invokes
Stream response back them to render the page
8.0.0.1 www.sitecore.net/training
Review – Layout Deltas
Q When does a layout delta get Q How does the XML of a layout
created? delta differ from the XML
When presentation coming from the specified on a template’s
standard values of an item’s template standard values?
is overridden on that item. Layout deltas only contain
differences between an item’s
standard value presentation and any
changes made by the author on the
item.
8.0.0.1 www.sitecore.net/training
Module 6
Real World Solutions
Familiar Concepts
Dealing with Larger Sites
Sitecore Query
8.0.0.1 www.sitecore.net/training
Topic 6.1
Familiar Concepts
8.0.0.1 www.sitecore.net/training
Traincore
A fictional cycling holiday site where users
can search for holidays and get tips and
advice about cycling
8.0.0.1 www.sitecore.net/training
Demo 6.1 – Solution , Topology, and
Templates
Demo objectives
• Look at Traincore’s project structure
• Look at Traincore’s Sitecore tree
8.0.0.1 www.sitecore.net/training
Recommended Practice
Project Structure Topology Templates
Abstract functionality in Multiple subfolders for Organize into subfolders
separate projects – for multiple sites
example, Sitecore.Utilities Use author-friendly
Identify reusable content names
Patch in config changes
/App_Config/Include Store content under Use of icons
/sitecore/Content
Reference .dlls in a Use multiple base
Libraries folder templates to avoid field
redundancy
8.0.0.1 www.sitecore.net/training
Demo 6.1 – Presentation Configuration
Demo objectives
• Look at presentation details of various items – particularly how sublayouts are
nested
• Look at which components accept datasources
• Look at which components make use of rendering parameters
8.0.0.1 www.sitecore.net/training
Placeholder Nesting & Component Re-Use
Levels of Nesting
Layout – e.g. BaseCore
8.0.0.1 www.sitecore.net/training
Supporting the Experience Editor
Componentize, componentize, componentize
• Make HTML developers aware of componentization
requirements early
• Separation of data and presentation
• Use the FieldRenderer and Sitecore controls
• Dynamic binding for movable components, static
binding for components with fixed locations
Header
Why Build for the Experience Editor?
• Must form part of requirements – your clients were sold this functionality
• Much easier to change appearance of a page in future if presentation is modular
• Building for Experience Editor means building for Sitecore’s marketing features
8.0.0.1 www.sitecore.net/training
Demo 6.1 – Creating a Mobile Site
Demo objectives
• Create a mobile device
• Create and assign a simple Mobile layout to a holiday item’s Mobile device
• Output Page Heading and Page Content in the layout
• Add a number of existing components (also used by the Default device) to the Mobile
layout’s placeholder
8.0.0.1 www.sitecore.net/training
Devices
Sitecore architecture supports adaptive
design
8.0.0.1 www.sitecore.net/training
Exercise 6.1 – Putting it Together (60 min)
8.0.0.1 www.sitecore.net/training
Review – Familiar Concepts
Q What can you do with methods Q What kind of content can you
that could be used across display using a General Widget?
multiple Sitecore projects? Promotions, announcements –
Abstract code to a generic utilities anything that could be re-used across
project the site
Q Why can’t you preview items Q Name 2 devices you may want to
under Global? target with different
presentation details:
They do not have presentation details
Tablets and mobiles
Q Why is the Settings item outside
any individual site folder
structure?
Values shared across all sites
8.0.0.1 www.sitecore.net/training
Topic 6.2
Dealing with Larger Sites
By the end of this topic you will be able to:
List three considerations that must be taken into account when architecting
a multi-language site
8.0.0.1 www.sitecore.net/training
Multi-Language Support
Things to consider when building a multi-language site:
• Components must be able to support different content lengths
• All content must be translated – including labels, button texts, etc.
• Some field values need to be shared across languages
• Build feature that allows users to change the site language
(query string, stored in cookie):
• Restrict author access to their languages only
How does Sitecore choose the language:
• Explicitly in the URL (?sc_lang or /en/holidays)
• Language cookie (traincore#lang)
• <site … language="en-US" /> (per site)
• <setting name="DefaultLanguage" value="en-US" /> (default)
8.0.0.1 www.sitecore.net/training
Remember!
Handle items that do not have language versions
• When processing a list of items
o check if a version is available in the language
o (items without versions will still exist foreach (Item child in item.Children)
{
in the item.Children collection – avoid $name)
• Custom code must account for multiple languages
if (child.Versions.Count <= 0)
{
o For example, Spider creating a Google sitemap }
}
Language fallback
• There is NO language fallback in Sitecore by default.
o Two free modules available from the marketplace provide this functionality.
• Translation vs. Localization
• Are you writing content for a location or translating global content?
8.0.0.1 www.sitecore.net/training
Demo 6.2 – Multi-Site
Demo objectives
• Look at the configuration for multi-site, and add http://traincore-corporate/
• Create an item clone
8.0.0.1 www.sitecore.net/training
Multi-Site
How? Warning!
• Multiple site root items in tree Multi-site can become too complex!
• Shared content outside individual site • URL resolving/generation affected
structure • Shared templates/presentation or
• Individual <site /> node in config (use separate? Duplication vs. complexity
include folder!) • Complex security considerations
• Different host name, start item, • Sites share the same application pool
language, caching options
8.0.0.1 www.sitecore.net/training
Review – Dealing with Larger Sites
Q When will Sitecore use the Q What kind of error checking
language attribute of the site should you do when rendering
definition in the web.config? items to the screen?
If there is no explicit language in the Check that each item has a version in
URL nor a language cookie. the context language
8.0.0.1 www.sitecore.net/training
Topic 6.3
Field Versioning
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Language and Numbered Versions
• Items can have any number of language versions without any extra work
• Each language version can have any amount of numbered versions
• Switch language in browser with:
http://domainname/?sc_lang=da-DK
OR
v2 v2 v2
v3 v3
v4
8.0.0.1 www.sitecore.net/training
Demo 6.3.1 – Language, Number & Field
Versions
Demo objectives
• Add new language
• Add new numbered versions in a language
• Switch languages
8.0.0.1 www.sitecore.net/training
Field Versioning
Defining fields on the
data template
8.0.0.1 www.sitecore.net/training
Demo 6.3.2 – Field Versioning
Demo objectives
• Add a new Shared field
• Add new versions of items
• Switch between language and numbers versions to see that a Shared field value
remains the same
8.0.0.1 www.sitecore.net/training
Setting Field Versioning Options
Sitecore Rocks
Drop-down list is
provided for each field at
the template item level
8.0.0.1 www.sitecore.net/training
What Do You Do When…
• VP requests you to return back to a previous version an item
both in terms of content as well as presentation
• You need a seasonal presentation and to be able to quickly
revert back to the original presentation when the season is
over
• You need to create language specific presentation
• Your boss needs to approve presentation before it goes live
while keeping the previous version intact
• You need to let customers know about an upcoming address
change over time and would like to do so visually (your lab
exercise)
8.0.0.1 www.sitecore.net/training
Introduction to Versioned Layouts
Each version of an item can have its own tailored presentation
• Applies to numbered and language versions
• Behaves the same as content versioning
SHARED LAYOUT is the baseline
presentation we have already used in
this course
8.0.0.1 www.sitecore.net/training
Renderings Fields
8.0.0.1 www.sitecore.net/training
Non-Versioned Layout Example
At item level additional presentation
_Renderings Field (Shared Field) information can be added but it must be
used by all item versions
(__Rendering field is shared)
8.0.0.1 www.sitecore.net/training
Versioned Layout Example
__Renderings Presentation can now be versioned like content
Field _ Final Renderings Field for each item version (either numbered or
language)
__Renderings field is shared
__Final Renderings field is item version specific
8.0.0.1 www.sitecore.net/training
Walkthrough 6.3 – Versioned Layouts
Walkthrough Objectives
• Create a new numbered version of the Contact-Us item
• Add a General Widget component to the Final Layout
• Create another numbered version of the Contact-Us item
• Test preview each numbered version of the Contact-Us item
8.0.0.1 www.sitecore.net/training
Exercise 6.3 – Versioned Layout
Versioned Layout
Lab 6.3.A Create a new numbered version of the Contact-Us item
Lab 6.3.D Test preview each numbered version of the Contact-Us item
8.0.0.1 www.sitecore.net/training
Review – Versioned Layouts
Q Which shared field is used to Q How do you access the Layout
store presentation information Details window for each item?
for all versions of an item? In Content Editor or Experience Editor
__Renderings field click the Details command. In
Sitecore Rocks choose Tasks ->
Q What does the presence of the Design Layout
__Final Renderings field allows
an author to do?
Q What is the difference between
the Shared Layout tab versus the
To define individual presentation Final Layout tab of the Layout
details for each version of an item Details window?
Q Which item versions can have The Shared Layout tab is for defining
individual presentations defined presentation details for all versions of
on them an item while the Final Layout tab
focuses on the presentation detail of
Numbered and language versions of that specific version of the item.
an item
8.0.0.1 www.sitecore.net/training
Assembling Presentation Information
Without Final Standard Values Item
Rendering
_Rendering _Rendering
8.0.0.1 www.sitecore.net/training
Topic 6.4
Sitecore Query
8.0.0.1 www.sitecore.net/training
Demo 6.4 – Sitecore Query using XPath Builder
Context Node: /sitecore/content
Absolute query
/sitecore/content/#sitecore-cycling-holidays#/*
Relative query
.//*[@@templatename='Bike'] templatekey is lower
case
Filter by template
/sitecore/content/#sitecore-cycling-holidays#//*[@@templatekey='bike']
Filter by content
/sitecore/content/#sitecore-cycling-holidays#//*[@#Page Title# = 'Home']
Return at index
/sitecore/content/#sitecore-cycling-holidays#/*[3]
Using axes – ancestor-or-self::
/sitecore/content/Home/#sitecore-cycling-holidays#/Home/news/#our-plans-for-the-new-
year#/ancestor-or-self::*[@@templatekey=‘news listing']
./descendant-or-self::*[@@templatekey=‘trip']
8.0.0.1 www.sitecore.net/training
Sitecore Query
Allows you to interrogate an XML representation of Sitecore
tree
o Primarily used to limit selection in field source
o Can contain axes (e.g. ancestor-or-self) and wildcards
o Test with Tools -> XPath Builder in Sitecore Rocks
o Sitecore query is not Sitecore search – serious performance implications
o Number of results limited by Query.MaxItems setting (default is 100)
8.0.0.1 www.sitecore.net/training
Uses for Sitecore Query
Source field
• Query is supported in most list field types that accept a source
• Prefix with query: when using in source fields
• For Treelists use a Parameterized Datasource in the source field
8.0.0.1 www.sitecore.net/training
Walkthrough– Topic 6.4.1 – Sitecore Query
(15 min)
Using Sitecore query in a source field
Lab 6.3.A Set Related Articles field source
8.0.0.1 www.sitecore.net/training
Review – Sitecore Query
Q What will . return? Q Why shouldn’t you query the
The context item. entire content tree?
Expensive – particularly if you are
Q Name two axes available in iterating through all descendants
Sitecore query:
Q Unless you are doing a very
ancestor-or-self::, parent::
simple query on a very limited
area of your Sitecore tree, what
should you use instead?
Sitecore search
8.0.0.1 www.sitecore.net/training
Configuring the Experience Editor
Module 7
Datasource Restrictions
Parameters and Parameters Templates
Placeholder Restrictions
Advanced Experience Editor Configuration
8.0.0.1 www.sitecore.net/training
Topic 7.1
Datasource Restrictions
8.0.0.1 www.sitecore.net/training
Datasource Location and Template Restrictions
8.0.0.1 www.sitecore.net/training
Demo 7.1 – Apply Restrictions
Demo objectives
• Apply Datasource restrictions using the Experience Editor
• Apply restrictions using Sitecore Rocks
8.0.0.1 www.sitecore.net/training
Exercise 7.1 – Datasource Restrictions
(20 min)
Datasource restrictions
Lab 7.1.A Set Datasource Location
8.0.0.1 www.sitecore.net/training
Review – Datasource Restrictions
Q What does the Datasource Q What happens if the Datasource
Location field automatically do in Location field is empty, but the
the Experience Editor? Datasource Template field is not?
Opens the Select the Associated The dialog doesn’t open
Content dialog when authors add a automatically, but when the author
new component requests it, they see the whole tree
with irrelevant items ghosted
Q What happens if the Datasource
Location and the Datasource
Template fields are both filled in?
The Select the Associated Content
dialog opens and authors can create a
new content item using the template
specified
8.0.0.1 www.sitecore.net/training
Topic 7.2
Parameters and Parameters
Templates
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Demo 7.2 – Using a Parameters Template
Demo objectives
• Create and assign a Parameters Template using Sitecore Rocks
• Show the result in the Experience Editor
8.0.0.1 www.sitecore.net/training
Specify Parameters Using a Parameters
Template
Represent parameters as real fields instead of key/value pairs
VS.
8.0.0.1 www.sitecore.net/training
Exercise 7.2 – Parameters Templates
(50 min)
Parameters templates
Lab 7.2.A Create and assign a Parameters Template
8.0.0.1 www.sitecore.net/training
Review – Parameters and Parameters
Templates
Q What is the benefit of rendering Q If you want your component to
Parameters Templates to use this new Parameters
authors? Template, where do you assign
They reduces error - authors do not it?
have to specify the parameter name On the component’s definition item in
and they can choose values from the Parameters Template field
dropdowns.
8.0.0.1 www.sitecore.net/training
Topic 7.3
Placeholder Settings
8.0.0.1 www.sitecore.net/training
Placeholder Settings Items
Placeholder Settings items are definition items for Placeholder Keys
8.0.0.1 www.sitecore.net/training
Allowed Controls
Allowed Controls
• Configured on Placeholder Settings item
• Define which components can be added to that particular placeholder
• If none selected, everything is allowed
8.0.0.1 www.sitecore.net/training
Compatible Renderings
Compatible Renderings
• Configured on component definition items
• Must define each other as compatible
• Both must be Allowed Controls of any placeholder you want to add them to
• Consider whether components need to share Parameters or Datasources
8.0.0.1 www.sitecore.net/training
Demo 7.3 – Allowed Controls / Compatible
Renderings
Demo objectives
• Use the Compatible Renderings button
• Assign Compatible Renderings
• Assign Allowed Controls
8.0.0.1 www.sitecore.net/training
Review – Placeholder Restrictions
Q When you add <sc:Placeholder Q What are Allowed Controls?
Key="myKey" runat="server" /> They determine which components
to your sublayout, what must can be added to a particular
placeholder
you do for the placeholder to be
selectable in the Experience Q Which Experience Editor mode
Editor? supports adding components
Create a Placeholder Settings into placeholders?
definition item in Sitecore Designing
Q What else do these Placeholder Q If a component is not in the
Settings items allow you to Allowed Controls list, can it be
specify for authors? added into that placeholder
through the Experience Editor?
Which components authors can insert
into a placeholder. No
8.0.0.1 www.sitecore.net/training
Review – Compatible Renderings / Allowed
Controls
Q What are Compatible Q If a component is not in the
Renderings? Allowed Controls list, can it still
Components that can be used in place be used as a Compatible
of another component Rendering?
No
Q What two elements should you
keep in mind when setting up
Compatible Renderings?
Both components need to be able to
accept the same Datasource and the
same Parameters
8.0.0.1 www.sitecore.net/training
Topic 7.4
Advanced Experience Editor
Configuration
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Demo 7.4.1 – Custom Experience Buttons
Demo objectives
• Change an existing button in the floating toolbar of all components
• Add an additional Custom Experience button to the floating toolbar of the Gallery
component
8.0.0.1 www.sitecore.net/training
Custom Experience Buttons
Custom Experience buttons are a configurable
• Floating toolbar around fields and components
8.0.0.1 www.sitecore.net/training
Custom Experience Button Types and
Assignment
Customizing buttons
• Field Editor – Displays a field’s editor in a
pop-up window. This is useful for editing complex
fields in the Experience Editor, such as a Multilist field.
• WebEdit – Indicates which code is triggered
by a button. For example, the default for
The Delete button will
the Delete button is to fire
execute this command
webedit:delete
8.0.0.1 www.sitecore.net/training
Edit Frames
Sitecore Control Pointing to List of Custom Experience Buttons
• Defined in code; surround any mark-up (for example, content from a Multilist field)
• Floating toolbar will appear in that location
• Buttons attribute points to folder of WebEdit/Field Edit buttons in Sitecore tree
• Defined in core database – /core/sitecore/content/Applications/WebEdit/Edit Frame Buttons
• Not aware of Datasource (but can be assigned using DataSource attribute)
8.0.0.1 www.sitecore.net/training
Demo 7.4.2 – Edit Frames
Demo objectives
• Create a field editor button
• Insert an Edit Frame into the Holiday Summary widget
8.0.0.1 www.sitecore.net/training
Exercise 7.4 – Edit Frame (20 min)
Customer Experience and Edit Frames
• Lab 7.4.A Add a Customer Experience button
• Lab 7.4.B Add an Edit Frame
8.0.0.1 www.sitecore.net/training
Review – Advanced Page Editor
Configuration
Q Once Custom Experience Q What do Edit Frames do?
buttons are assigned, where do
Surround an area on a page or
they show up? component and display buttons
On a component / field and displayed allowing you to edit fields that would
in the Experience Editor not be normally editable in the
Experience Editor
Q Name two examples of custom
buttons: Q In which database do you create
Field Editor and WebEdit buttons the Custom Experience buttons
and Edit Frames?
Q On what type of definition item
can you assign Custom core
Experience buttons?
A component definition item or a
field definition item
8.0.0.1 www.sitecore.net/training
Dealing with Your Data
Module 8
Item buckets
Search
8.0.0.1 www.sitecore.net/training
Item Buckets
Topic 8.1
8.0.0.1 www.sitecore.net/training
The Scenario
Reliance on hierarchical data
• Not all data needs to be represented as a tree structure
In addition…
• Using API to interact with a large Sitecore tree is expensive and slow
• Developers forced to interact with hierarchical tree structure – not efficient when
dealing with large volumes of data (Topic 8.2)
8.0.0.1 www.sitecore.net/training
Demo 8.1.1 – Using Buckets as an Author
Demo objectives
• Use buckets to search for bookings
• Narrow down results using facets
• Edit and create items as normal
• Use plain-text search to search for a widget we know exists – for example, which-
bike. Use wildcards, replacements and exact phrases
• Change the results view to Gallery or GUID view
• Developers can replicate search mechanism in their code – query an index rather
than a tree
8.0.0.1 www.sitecore.net/training
What Is a Bucket?
• A bucket allows you to transform an item into a repository that stores other items
that are not displayed in the content tree
• Potential to store millions of items, which a tree structure would not support
8.0.0.1 www.sitecore.net/training
When to Use a Bucket
Advantages of Buckets
• Support for potentially millions of items that would not suit a tree structure and
slow down the UI – for example, products, repositories and orders
• Automatically organizes content items into a folder structure that improves
database retrieval performance
• Queries run against an index, ensuring high performance
• Find what you want quickly by using free text search, facets and search filters
• You do not care
Should I bucket?
Bucket if:
• You do not care about the structure of the data stored in the bucket
• You anticipate a large volume of items
• You would benefit from searching for items rather than locating them in the tree
8.0.0.1 www.sitecore.net/training
Demo 8.1.2 – Buckets and Bucketable Items
Demo objectives
• Turn reusable content into a bucket
• Make General Widget items bucketable
• Change bucket settings
8.0.0.1 www.sitecore.net/training
Creating a Bucket
Any item can become a bucket
• Items inside the bucket no longer have a parent / child relationship with semantic
meaning
o organized into folders based on creation time (by default, this structure is hidden)
• Items in a bucket can still be created, edited and deleted by conventional means
• If you want to retain the parent/child relationship for items stored in a bucket (for
example, comments should always be children of a news article)
Convert
o specify it on the template standard values of the intended parent
selected item
to a bucket
8.0.0.1 www.sitecore.net/training
Demo 8.1.3 – Facets
Demo objectives
• View a number of pre-existing facets created by developers
8.0.0.1 www.sitecore.net/training
Search Facets
Facets allow you to narrow down your search results
• Configurable items in /Settings/Buckets/Facets
• Specify index field to facet on – for example, ‘size range’
may be a special computed index field that does not
exist in Sitecore
• If you facet on a Droplink, you would get a list of
GUIDs to facet on – not useful and would require custom
index configuration
8.0.0.1 www.sitecore.net/training
Exercise 8.1 – Create a Bucket and Make
Items Bucketable (20 min)
Create a bucket and makes items bucketable
Lab 8.1.A Turn the News Listing template into a bucket
8.0.0.1 www.sitecore.net/training
Review – Item Buckets
Q Use a bucket when… Q What do facets allow you to do?
You do not need a hierarchical item Progressively apply filters (based on
structure and/or you have a large fields) to narrow down your result set
number of items
8.0.0.1 www.sitecore.net/training
Search
Topic 8.2
8.0.0.1 www.sitecore.net/training
Simple Search
• Item buckets uses Sitecore’s Search API
• You can leverage the same API to build search functionality for your website’s
front end
8.0.0.1 www.sitecore.net/training
Demo 8.2.1 – Executing a Simple Search
Demo objectives
• Build a simple search – return all indexed items
• Search by the item’s Name property (Sitecore property)
• Search by item’s ‘Heading’ (developer-created property)
8.0.0.1 www.sitecore.net/training
Basic Index Configuration
Search works on an index that is external to Sitecore
• Configuration in /App_Config/Include/ (default and index-specific)
• Determine how items should be indexed
8.0.0.1 www.sitecore.net/training
Demo 8.2.2 – Rebuilding the Index
Demo objectives
• Using the Sitecore Content Editor, expose the Developer toolbar
• Examine the rebuilding commands available
• View the default three indexes – one per database (master, core and web)
• Use the Rebuild button
• See how to rebuild without deleting the index folder
• Using the file system, examine the /Data/indexes folder to view each index’s folder
8.0.0.1 www.sitecore.net/training
LINQ Examples
The API implements the IQueryable<T> interface and supports most options
Standard LINQ Custom extensions
.Where .Boost (make this part more important)
.Any .Page (does skip/take)
.OrderBy .Between (exclude/include start and end ranges)
.Filter
Fuzzy search
queryable.Where(x => (x["page heading"].Like("Citecoar", 0.8));
Pagination
queryable.Page(2, 50);
8.0.0.1 www.sitecore.net/training
Custom Search Result Type
You create your own search result type
• Map Sitecore fields to index fields
• Empty constructor and public properties
• Support for various property types, not just strings! (see Student Manual)
• Can inherit from SearchResultItem
Standard .NET class
8.0.0.1 www.sitecore.net/training
Demo 8.2.3 – Paths, Pagination and Search
Result Types
Demo objectives
• Create a custom search type called CustomSearchResult - include a number of
different fields from base templates
• Inherit from Sitecore’s base SearchResultItem class
• Refactor search to query properties rather than strings
• Limit result set using .Paths
• Paginate results
8.0.0.1 www.sitecore.net/training
Returning a Result Set
A query returns an IQueryable<T>:
var query = context.GetQueryable<SearchResultItem>();
8.0.0.1 www.sitecore.net/training
Facets
Use .FacetOn() to get a list of facet categories (for example:
Template Name)
8.0.0.1 www.sitecore.net/training
Demo 8.2.4 – GetResults() and Facets
Demo objectives
• Return the SearchResults object
• Set counts, hits and facets to variables and inspect
8.0.0.1 www.sitecore.net/training
Index Configuration
• By default, the majority of index configuration is shared between indexes and
stored in .DefaultIndexConfiguration.config per provider type
• For Lucene, that file is:
Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config
8.0.0.1 www.sitecore.net/training
Which Fields Should Be Indexed?
The more data you store, the larger the index
• Make sure you have configured your index to include only what you need by
controlling what is indexed
• Selectively exclude or selectively include fields and templates
<IndexAllFields>true</IndexAllFields> Index all except explicitly
excluded OR index nothing
• Settings can be overridden per index except included
<exclude hint="list:ExcludeTemplate" />
<include hint="list:IncludeTemplate" />
Include or exclude specific
<include hint="list:IncludeField" /> fields or items based on
<exclude hint="list:ExcludeField" /> specific templates
By default, the ExcludeField list has many standard fields that would not be valuable in an
index – for example, Allowed_controls and UpdatedBy.
8.0.0.1 www.sitecore.net/training
How Should Fields Be Indexed?
• How a field is indexed is determined by the field name (for example, the Page
Heading field) or its type (for example: Single-Line Text fields)
<fieldNames hint="raw:AddFieldByFieldName" />
<fieldTypes hint="raw:AddFieldByFieldTypeName" />
• The configuration files allow you to control what goes into
the index and how it is stored with increasing granularity
• Indexes can target all fields, individual types, or particular fields
• You can completely override the analyzer Standard field using
and write a new one if needed a particular analyzer
8.0.0.1 www.sitecore.net/training
Store or Index?
Indexes can store either the value of a field or a pointer to the field
• It’s useful to set the storageType to YES and store the field value if you want to
retrieve this value from the index instead of from the database
Stores a pointer to
the field in the index
Only properties in the result object that map to stored field values will be populated
8.0.0.1 www.sitecore.net/training
Computed Fields
• Simple indexing is when a field value is put into an index without any processing
• Computed fields perform lookups and complex logic to determine what gets put
into the index and they do not have to match up directly to a Sitecore field
• To create your own computed field, add an entry in the search configuration files:
<fields hint="raw:AddComputedIndexField" />
8.0.0.1 www.sitecore.net/training
Exercise 8.2 – Output Content (70 min)
Refactor news listing
Lab 8.2.A Output news articles using Sitecore search API
8.0.0.1 www.sitecore.net/training
Review – Search (Part 1)
Q What defines how Sitecore items Q What is the name of Sitecore’s
should be indexed? default search result class?
Index configuration files in SearchResultItem
/App_Config/Include
Q When building your own search
Q Search is built using a provider result class, how do you account
model. What does this mean? for fields with spaces?
You can plug in whatever search Decorate with [IndexField("Page
provider you want Heading")]
Q What syntax do you use to query Q What method should you use to
an index? return a rich results object?
LINQ .GetResults();
8.0.0.1 www.sitecore.net/training
Review – Search (Part 2)
Q You can configure how fields get Q If you wanted to store the number
indexed by type or… of comments a news article has,
Name what type of field might you use to
perform the calculation?
Q You can include/exclude by
individual field names or… A computed field
Item templates Q Why should you tune your index
Q Which attribute must be set to configuration and not index
‘YES’ in order for values to be everything by default?
stored in the index? Large, unwieldy index as your solution
storageType grows
8.0.0.1 www.sitecore.net/training
Extend
Sitecore Developer Portal
http://dev.sitecore.net
Sitecore Hangouts
http://www.youtube.com/user/SitecorePM
8.0.0.1 www.sitecore.net/training
Beyond the Developer
Environment
Module 9
Caching and Performance
Publishing
Installing and Scaling Sitecore
Team Development and the Development Environment
Basic Security
Workflow
8.0.0.1 www.sitecore.net/training
Caching and Performance
Topic 9.1
By the end of this topic you will be able to:
• When returned from the database, each caching level is regenerated with a more
complex object
• There are more caches for XSL, standard values, paths, registry, etc.
8.0.0.1 www.sitecore.net/training
HTML Cache
For pages assembled from presentation components, each component can be cached
8.0.0.1 www.sitecore.net/training
Clearing Cache
• The HTML cache is cleared by any form of publishing
o At the end of publishing, the HtmlCacheClearer clears
the cache. Found in the publish:end event in the
web.config
• Item and Data caches are cleared only for the items
published
Use ‘Clear all’ to
• Prefetch cache is populated when application starts clear all Sitecore
• When published items get requested for the 1st time, caches
they comes from the database
8.0.0.1 www.sitecore.net/training
Demo 9.1.1 – Clearing Cache
Demo objective
• Navigate to http://traincore/sitecore/admin/cache.aspx
• Notice maximum cache sizes are listed in the right-hand column
• Demonstrate that caches can be cleared using Clear all button
• View cache information in Sitecore Rocks
8.0.0.1 www.sitecore.net/training
Cache Tuning and Configuration
Cache sizes are per database and per site
• Cache settings are defined in multiple places in the web.config
o For example, the default size of the standard value cache:
8.0.0.1 www.sitecore.net/training
Demo 9.1.2 – Various Cache Settings
Demo objective
• Look at the various cache settings in the web.config:
o Default settings
o Cache sizes specified in the <databases> section
o Cache sizes specified on the <site> nodes or below the <sites> section
8.0.0.1 www.sitecore.net/training
Experience Editor Debug Mode
Debug mode – runs against the WEB database
• View the profile, cache settings and HTML output of
individual components in the Experience Editor
Sitecore Glimpse (https://www.nuget.org/packages/Sitecore.Glimpse)
Profile table
Individual
component
summary
Contextual debug
information
8.0.0.1 www.sitecore.net/training
Review – Caching and Performance
Q What are the three layers that Q Cache settings are defined in
the item cache mechanism have? what file?
Item, Data and Prefetch web.config
Q What operation clears the HTML Q Name three places where
cache? component HTML caching
Publishing options can be defined
Definition item, standard values or
Q Which cache is populated when per instance of the component
the application starts?
Q What mode in Experience Editor
Prefetch cache shows profile, cache settings and
Q What is the path for the .aspx HTML output for individual
page that clears all cache? components?
/Sitecore/admin/cache.aspx Debug mode
8.0.0.1 www.sitecore.net/training
Publishing
Topic 9.2
8.0.0.1 www.sitecore.net/training
Types of Publishing
Three publishing modes
• Incremental – publishes changed items in a publishing queue
• Smart publish – compares master DB to web DB. If the RevisionID field is
different then the item gets copied across
• Republish – publishes all items
Each Sitecore interface has publishing options and each invokes
the appropriate publishing wizard
• Desktop’s main menu publish site options – incremental, smart and republish
• Experience Editor’s publish item options - smart and
re-publish (no incremental….why?)
• Content Editor’s publish site and publish item options
8.0.0.1 www.sitecore.net/training
Publishing Restrictions
Change publishing restrictions in the Content Editor
Options are applied to:
• Numbered Version of an item
• The Item itself Numbered
versions
Item
• Targets
Targets
Note: Setting a publish restriction does not automatically publish your items, but simply sets the
restrictions. Publishing still needs to be triggered either manually or scheduled.
8.0.0.1 www.sitecore.net/training
Publishing Strategies
Options for scheduled publishing
• Publishing agent allows you to specify publishing interval and
type of publishing
• Dependent on the Sitecore scheduling agent
• Windows scheduled tasks can be used to run a custom service or page
• See blog for more information: https://www.sitecore.net/Learn/Blogs/Technical-
Blogs/Reinnovations/Posts/2014/03/Publishing-Improvements-in-7-2.aspx
* Workflows covered later
8.0.0.1 www.sitecore.net/training
Demo 9.2 – Publishing Options and Restrictions
Demo objective
• Set up publishing restrictions on an item
8.0.0.1 www.sitecore.net/training
Review - Publishing
Q Name the 3 publishing modes Q Publishing restrictions can be
Incremental , smart and republish applied to _____ , _____ and
_____
Numbered versions of items , the
item itself and targets
8.0.0.1 www.sitecore.net/training
Installing and Scaling
Topic 9.3
8.0.0.1 www.sitecore.net/training
Options for Installing Sitecore
Download installation files at:
https://dev.sitecore.net/
Installation methods:
• Sitecore Installation Wizard
• Sitecore Instance Manager (SIM)
• Sitecore Rocks
• Manual install from a .zip archive
Refer to:
• Installation Guide
• Installation Troubleshooting Guide
• kb.sitecore.net for known issues
8.0.0.1 www.sitecore.net/training
Minimum Recommended
Basic servers
• Higher performance when databases are on their own specific server
• Start with separate CD and CM servers, with a shared dedicated database server
Databases
• CM server has access to core, master and web databases
• CD server(s) have access to the web database
o Access to either core or .NET membership database
xDB
• For example – start with separate collection, reporting and aggregation servers
8.0.0.1 www.sitecore.net/training
Storing Media
Media definition items are stored in the database
• Point to the corresponding database BLOB or file
• Located in the content tree
• Based on a template
oCan be extended
• Need to be published Templates are specific to media type:
image, docx, pdf, etc.
• Note: Media items are cached to the file system when rendered
8.0.0.1 www.sitecore.net/training
Developer Environment
Typically, all elements are on the same computer:
• Content management databases (core, master, web)
• Single Sitecore client (http://<mysite>/sitecore)
• xDB components
8.0.0.1 www.sitecore.net/training
Running MongoDB
Sitecore 8 requires MongoDB running as a service
• Manual install or use Chocolatey.
8.0.0.1 www.sitecore.net/training
Review – Installing and Scaling Sitecore
Q List some benefits of using Sitecore Q Name some features of Sitecore
Installer Instance Manager
Checks prerequisites, correct DLLs, logs,
remove an existing installation Packages, customize, extend,
reinstall & remove instances
Q Can you do a manual installation?
Yes
Q What are the recommended servers
for an installation and which
databases are on each server for a
production environment?
CM with core, master and web
CD with core and web
Separate DB server
xDB with separate collection, reporting
and aggregation servers
8.0.0.1 www.sitecore.net/training
Team Development &
Development Environment
Topic 9.4
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Setting Up a Solution
Development Benefits Drawbacks
model
Inside the web root: • Solution setup is quick • No clear separation of
• You are able to see your changes ownership
almost immediately • Difficult to transform
configuration files
• Development sites may
contain unnecessary artifacts
that may alter site behavior
inadvertently
Outside the web root: • Clear separation between solution • Changes to code typically
and Sitecore files need to be compiled and
• Ability to transform configuration copied to the web root
files within local developer • Initial solution setup can be
environments complex
• Better suited for multi-site
solutions
• Solutions can be bundled easily
for shipment
• Development sites remain clear of
code-behind files
8.0.0.1 www.sitecore.net/training
Patching the web.config
App_Config/Include config files merge into in-memory web.config
• Use specific .config files in the Include folder for each pipelines, events, etc
• You can configure where the nodes merge into the web.config (only works on
<sitecore> portion of the web.config)
• You can version control these include files, which makes Sitecore upgrades easy
• View the final, in-memory, merged web.config with the
http://<yoursite>/sitecore/admin/showconfig.aspx page
Tips
• .config files are applied to the web.config in alphabetical order
o Use prefixes and sub-folders if you would like to control the order
• See Include File Patching Facilities Guide for more information,
http://sdn.sitecore.net/upload/sitecore6/60/include_file_patching_facilities_sc6orlater-usletter.pdf
8.0.0.1 www.sitecore.net/training
Sitecore Packages
Moving Items and Files with Sitecore Packages
• Sitecore packages allow you to move item and file
changes from one server environment to another
• Sitecore distributes most additional software
modules as Sitecore packages
• With the Package Designer, you can manually
select items and files to add or you can add them
dynamically using a query
o You also configure conflict resolution (how the installer
behaves when existing items are found)
Sitecore Rocks
• Rock has an Anti Package
• Allows you to set up dependencies
8.0.0.1 www.sitecore.net/training
Demo 9.4.1 – Create a Package Using Sitecore
Rocks
Demo objective
• Create a package using Sitecore Rocks
• Create an anti package before installing
8.0.0.1 www.sitecore.net/training
Source Control and Serialization
• Sitecore items can be serialized into text files
then added to source control
• Working outside the web root makes it easier
to source control your custom code
• Serialization makes it easier to
synchronize changes across
local development environments Small teams can share
databases – Note: content
Methods of serializing: gets overwritten
• Serialization page - /sitecore/admin/serialization.aspx
• Post-save macro in Sitecore Rocks
• Content Editor’s Developer tab has serialization commands
• Serialization settings in the web.config
• Third party products like Hedgehog’s Team Development for Sitecore
or Unicorn
8.0.0.1 www.sitecore.net/training
Demo 9.4.2 – Serializing Items
Demo objective
• Show the serialization page at http://traincore/sitecore/admin/serialization.aspx
• Serialize an item on the Developer tab in the Content Editor
• See Sitecore Rocks serialization commands
8.0.0.1 www.sitecore.net/training
Continuous Integration
Team Development for Sitecore (TDS) – by Hedgehog
• TDS serializes items to disk and stores references in a .csproj file
• Use a MSBuild project (or pass in additional config info) to deserialize into Sitecore
instance on CI server (Continuous Integration server)
8.0.0.1 www.sitecore.net/training
Update Packages
How to upgrade Sitecore
• Important: do a database backup before upgrading
• Go to http://sdn.Sitecore.net
• Download the update package
• Go to http://<yoursite>/sitecore/admin/updateinstallationwizard.aspx
8.0.0.1 www.sitecore.net/training
Exercise 9.4 – Installing Packages (5 min)
Install a package
• Lab 9.4.A Install a package using Sitecore Rocks
8.0.0.1 www.sitecore.net/training
Review – Team Development &
Development Environment
Q Name two development models Q What are Sitecore packages and
Inside and outside the web root what do they contain?
Q Which is the best practice? Zip files that contain items and code
files
Development outside the web root
Q What are the options to source Q What is the name of the .aspx that
control your items? you go to when upgrading
You can serialize your items for source Sitecore?
control with Sitecore Rocks or use a
product like TDS to do it. /sitecore/admin/updateinstallationwizard
.aspx
Q What is the recommended way of
patching in changes to
web.config?
Patch web.config with include files,
located under /App_Config/Include
8.0.0.1 www.sitecore.net/training
Basic Security
Topic 9.5
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Security Editor and Access Viewer
• Access the Security tools with the Sitecore Launchpad
or the Desktop interface
8.0.0.1 www.sitecore.net/training
Roles
Role inheritance Role
A
• Access rights are cumulative - a user inherits all
Role
access rights from all roles
B
Conflicting access rights Role
• Explicit deny will always take precedence C
8.0.0.1 www.sitecore.net/training
Review - Security
Q Which application is used to view Q Name three permissions that are
the resolved access rights applied to access rights
Access Viewer Allow, deny and not specified = deny
8.0.0.1 www.sitecore.net/training
Workflows
Topic 9.6
8.0.0.1 www.sitecore.net/training
Demo 9.6 – Using a Workflow as an Author
Demo objective
• Push an item through a workflow
8.0.0.1 www.sitecore.net/training
Workflow Name
What Is a Workflow?
Workflow State Name
Used for content approval to ensure
content readiness
• For example, if content needs to Item Name
be approved by different
members of the organization
8.0.0.1 www.sitecore.net/training
Workflow
• Series of Workflow States that item versions must go through
• Versions move between states by Workflow Commands (or Workflow Actions)
• When a version is in a Final Worklfow State and the item is edited again, a new
numbered version gets created
v2 v1
Awaiting v1
v1 Approval Approved
State State
Draft
State Optional
Approve Reject Action
Command Command
Auto Publish
Submit Action
Command Validation Pass
Action Validation
Optional Fail
action Validation v1
v2
8.0.0.1 www.sitecore.net/training
Review - Workflows
Q What are workflows used for? Q When is an item publishable?
Content approval, versioning and In the final state
tracking
Q When is a new numbered version
Q Items go through a series of ____ created?
States When an item’s version is in a final
workflow state and then
Q Each state can contain certain subsequently is edited by a non-
_____ and _______ Administrator.
Commands and actions
8.0.0.1 www.sitecore.net/training
Marketing Functionality
Module 10
8.0.0.1 www.sitecore.net/training
Introduction to the
Experience Platform
Topic 10.1
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Marketing Functionality
Collect, measure, report, personalize and optimize
• Collect visitor behavior, geographical location, visit origin, etc.
• Measure the effectiveness of your site by tracking visitor interaction
• Report information about the site, campaigns, individual visitors, etc.
• Personalize content to adapt it to your visitors’ interest
• Optimize your website using tests
8.0.0.1 www.sitecore.net/training
What Data Is Collected?
• Where are the visitors from? Country, City, Region, Business name
• How do the visitors arrive on the site? Pay-per-click ad, social campaign,
referrer, keyword search, etc.
• Are they known visitors? Have they visited the site before?
• What pages are they visiting? What do they do on those pages? How long
do they spend on each page?
• Are the visitors providing us any data? Form filling, social login
integration?
8.0.0.1 www.sitecore.net/training
How Is Analytical Data Collected?
Experience Database (xDB)
8.0.0.1 www.sitecore.net/training
Data Aggregation
All this data needs to be aggregated for optimal reporting
A customizable aggregation pipeline exists
This can run on dedicated servers
Stores data in a SQL Server reporting database
8.0.0.1 www.sitecore.net/training
Contacts
Sitecore helps you know your visitors better
You can:
• View all information about a visitor in their Contact Record
• See all contacts in the Experience Profile
• Create groups of contacts in the List Manager to target them in campaigns
8.0.0.1 www.sitecore.net/training
Reporting
Experience Profile
• Complete view of individual contacts
• Drill down to information of any interaction
Experience Analytics
• Aggregate data over time
oEngagement value per visit
• Audience: Who are they? Where are they from?
• Acquisition: How did they arrive to the site?
• Behavior: What did they view on the site?
• Conversions: Which desirable actions
did they perform?
8.0.0.1 www.sitecore.net/training
Demo 10.1 – The Experience Profile
Your visitors are Contacts
Demo objectives
• Use the Experience Profile to see information about the latest visitors
• Show the type of information Sitecore captured during a contact interaction
8.0.0.1 www.sitecore.net/training
Review – Introduction to the Experience
Platform
Q What tool will show you all Q How does Sitecore store visitor
contacts that have been to your data?
site? Data is collected in a MongoDB
Experience Profile collection database.
8.0.0.1 www.sitecore.net/training
Engagement Value and Goals
Topic 10.2
8.0.0.1 www.sitecore.net/training
Value vs. Traffic
• Traffic figures (number of hits) are not a true representation of how much a visitor is
engaged with your site – for example, visiting the homepage (low engagement) versus
booking a holiday (high engagement)
• A site that encourages engagement is more effective – for example, 10,000 visits and 10
bookings versus 1000 visits and 100 bookings
• Sitecore introduces the concept of engagement value
o A number that represents how much
quality time a user spent on your website
• The more valuable actions a customer performs on your site, the higher their
engagement value
(for example, request a brochure, fill in the contact form, make booking)
8.0.0.1 www.sitecore.net/training
Engagement Value Is Measured Using Goals
• Goals are defined in the Marketing value
Center and have a value associated
with them
• A goal’s value depends on its value
to the business – for example, a
holiday booking is worth more to the
business than a brochure request
• Goals are either assigned to pages
(for example, the contact form
thank-you page) or
• Triggered programmatically – when
a visitor triggers a goal, the
engagement value for that visit Assign a goal
increases to a page
8.0.0.1 www.sitecore.net/training
Demo 10.2 – Create and Assign a Goal
The Sitecore Cycling Holiday’s site sells cycling holidays, so the
most important task a visitor can perform is booking a holiday
Demo objectives
• Use the Marketing Center to create a goal called Booked a holiday
• Give it a value of 50
• Assign this goal to the booking confirmation page (the book-holiday/thank-you item)
8.0.0.1 www.sitecore.net/training
Review – Engagement Value and Goals
Q Engagement is measured using… Q Goals can be assigned to
Goals specific items and/or…
They can be triggered
programmatically
8.0.0.1 www.sitecore.net/training
Multivariate Testing
Topic 10.3
8.0.0.1 www.sitecore.net/training
Testing
• Allows you to test the effectiveness of your site by seeing…
o Which variation resulted in greater overall engagement value
o The effect on individual goals
• Is Integrated as part of workflow
o Whenever an author makes a change, content or presentation, they have the
opportunity to create a test
• Tests can stop automatically when there is enough certainty that one of the
variations provides better results
o Specific goals or overall engagement value
Start test after a
change
8.0.0.1 www.sitecore.net/training
What Can You Test?
• Change your content – test different versions of your items
• Modify your presentation – change components or data sources
• Swap the entire page – test between multiple different items
8.0.0.1 www.sitecore.net/training
How to Let Your Authors Test?
• Use workflows to add a Launch Create Test Dialog Workflow Action
(Remember workflow does not work as expected if you are an admin)
• Components should be configured to accept datasources
• Make sure the Experience Editor is configured correctly
8.0.0.1 www.sitecore.net/training
Review – Multivariate Testing
Q What is the purpose of testing? Q What to do to make sure your
Establish which content or authors can use the testing
components makes your visitors react functionality?
more favorably Add ‘Launch Create Test Dialog’ to
workflow
Q When can authors start a test?
As part of workflow– whenever they Make sure the Experience Editor
have made a change on a page works and is configured correctly
8.0.0.1 www.sitecore.net/training
Profiling and Personalization
Topic 10.4
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Personalization
Content and component type can be personalized
Change a component’s data source, component type, or hide the component
It is important that you have componentized and made good use of data sources –
otherwise personalization will not work
8.0.0.1 www.sitecore.net/training
Demo 10.4 – Personalize Based on Page Visited
Demo objective
• Set up a personalization rule that changes a homepage General Widget
component data source to Expert Holidays if Battle of the Hills has been visited
8.0.0.1 www.sitecore.net/training
Profiling Content Items
Score items based on the audience you are targeting
Business stakeholders design profiling taxonomy (configuration done by developers)
Authors assign points to items in different categories based on audience being targeted
(or bulk-assign using Profile Cards)
Visitors accrue points based on the content they visit and build up a profile
Profile individual
content items
8.0.0.1 www.sitecore.net/training
Review – Profiling and Personalization
Q What does it mean to profile Q How does componentization and
content? use of data sources support
Assigning points in certain categories personalization?
based on the audience that a content As a visitor navigates around the site,
item is aimed at components can be added / hidden or
their data changed to match a
particular pattern card or profile key
score
8.0.0.1 www.sitecore.net/training
Certification
8.0.0.1 www.sitecore.net/training
Sitecore Certification Center Exam
The exam has 40 questions
• Open Book!
• Pass or No pass
• 28 correct answers (70%) to pass
• Multiple choice with 3 options
• Only 1 correct answer
• 60 minutes
• Retake possible
No going back!
• You cannot change an
answer once you click
Next >
8.0.0.1 www.sitecore.net/training
Course Evaluation
• 11 quick Questions
with space for your
valuable comments!
• Evaluations are
anonymous
• We value your
opinions, so please
share them with us!
8.0.0.1 www.sitecore.net/training
Exam
Go to this URL and log into the test with the
username and password shown
URL: http://scc.sitecore.net
Username: xxx_WND80
Password: xxxxx
8.0.0.1 www.sitecore.net/training
Bonus Topics
Module 11
Branch Templates
Other Item and Template Properties
Pipelines and Events
Rules
Placeholder Overrides
8.0.0.1 www.sitecore.net/training
Branch templates
Topic 11.1
Describe how to create a list of child items for an item in one click
8.0.0.1 www.sitecore.net/training
Branch Templates
• Allow users to insert a number of predefined sets of items at once
• A branch template consist of a branch item with several child items
• All these items will be created during an insert operation
Trip Details
8.0.0.1 www.sitecore.net/training
Demo – Creating a Branch Template
Demo objectives
• Create a branch template in the Template Manager
8.0.0.1 www.sitecore.net/training
Review – Branch Templates
Q What function do branch
templates have?
Allow authors to create an item and a
list of child items in one click
8.0.0.1 www.sitecore.net/training
Topic 11.2
Other Item and Template Properties
By the end of this topic you will be able to:
8.0.0.1 www.sitecore.net/training
Language and Numbered Versions
• Items can have any number of language versions without any extra work
• Each language version can have any amount of numbered versions
• Switch language in browser with:
http://domainname/?sc_lang=da-DK
or
http://domainname/da-DK/<rest of the url>
v2 v2 v2
v3 v3
v4
8.0.0.1 www.sitecore.net/training
Demo – Language, Number & Field Versions
Demo objectives
• Add new language
• Add new numbered versions
• Add 2 numbered versions for DK
• Create new fields to demo field versioning
8.0.0.1 www.sitecore.net/training
Field Versioning
Defining fields on the
data template
Shared field – single value for all numbered versions in all languages
Versioned field (default) – different values for languages and numbered versions
8.0.0.1 www.sitecore.net/training
Demo – Helping Authors
Demo objectives
• Sort fields
• Add help text to fields
• Change the Title of a field to something more intuitive
8.0.0.1 www.sitecore.net/training
Sort Order
Change __Sortorder field on field definition item, or use Template
Field Sorter tool
Right-click inside Editor
Pane and enable Standard
Fields…
8.0.0.1 www.sitecore.net/training
Help Text
Add helper text to field names The helper fields are in the
for authors standard fields
With help text
Standard fields:
__Long description
__Short description
Field
definition
item
8.0.0.1 www.sitecore.net/training
Title Field
• Change the field name that is displayed to authors
• For developers the field name stays the same
Field
definition
item
Title field
What the
user sees
8.0.0.1 www.sitecore.net/training
Exercise 11.2 – Working with Versions, Sorting &
Helping Authors (35 min)
In this exercise you will be working with language and numbered
versions, optional labs for helping authors
Field source
8.0.0.1 www.sitecore.net/training
Review – Other Item and Template
Properties
Q Items exist in a ___ and ___version. Q What is the field called where you
Language and numbered set up field sorting?
Sortorder
Q What does unversioned for field
versioning mean? Q Where is this field found?
Single value per language
Standard fields
Q What does shared for field
versioning mean? Q On what type of item do you do
field sorting?
Single value for all numbered versions in
all languages On the field definition item
Q What is the default field Q Name two fields that you can use
versioning? to help a multi-lingual audience
Versioned – different values for all Long Description and Short Description
languages and numbers fields - also part of the standard fields
8.0.0.1 www.sitecore.net/training
Pipelines and Events
Topic 11.3
By the end of this topic you will be able to:
One of the most important pipelines is the httpRequest Pipeline, which is invoked by
the httpApplication.BeginRequest event
The httpRequest Pipeline performs tasks such as resolving sites and language
Each of the steps is specified as a separate <processor /> within the pipeline
8.0.0.1 www.sitecore.net/training
Processor
Each step in a pipeline is a <processor /> with a type in the format of Namespace,
Assembly
All processors
Implement the Process() method
InsertRenderingsProcessor
8.0.0.1 www.sitecore.net/training
Creating Pipelines Option 1
There are 3 options for using pipelines to customize Sitecore behavior
Decide where your step fits in – for example, if your processor modifies the parameters on a
rendering, you want it to appear after the renderings have been added to the page – such as
after: Sitecore.Pipelines.InsertRenderings.Processors.AddRenderings
Determine whether processors in the pipeline inherit from an abstract class – in the case of the
insertRenderings pipeline, all processors inherit from the abstract
InsertRenderingsProcessor class
8.0.0.1 www.sitecore.net/training
Creating Pipelines Options 2 & 3
Option 2: Override and extend existing processors
Instead of adding extra steps to a pipeline, replace the processor with your own by deleting
the existing processor, using include files and patching in your own
By either:
Inheriting from that processor giving you access to the methods in the original
AddRenderings
Writing a custom processor can involve copying all or some of processor’s code
Option 3: Create new pipelines that you call from your code
8.0.0.1 www.sitecore.net/training
Introduction to Events
An event is something that happens that you can respond to
Events can be extended and overridden with your own event handlers, or you can write
your own
Each event can have any number of <handler /> nodes that specify a type and method:
8.0.0.1 www.sitecore.net/training
Subscribing to Events and Using Event Handlers
Create a class with a method that accepts a sender object and EventArgs
Depending on what event the handler subscribes to, the type of the EventArgs changes –
in this example it is a SitecoreEventArgs
SDN – Using Events
Event handler
that is executed
when an item is
saved
Add your handler to the appropriate event, specifying the namespace, assembly, and
method:
8.0.0.1 www.sitecore.net/training
When Would You Use Pipelines or Events?
If a task is not needed in realtime, Sitecore Jobs can be used to perform
maintenance rather than packing those tasks in the save or publisher pipeline
slowing down the process
Is it a pipeline or an event…
Intercept requests and authenticate the user against an external service PIPELINE
When a news item is saved, automatically move it into to the appropriate year /
month / day folder structure EVENT
8.0.0.1 www.sitecore.net/training
Review – Pipelines and Events
Q What are pipelines? Q What method do all processors
Break down operations into multiple implement?
configurable steps Process()
Q Where are pipelines defined? Q What are the three options for
In the web.config as <processors /> creating pipelines
and <pipelines /> Add processor to existing pipeline
Q In what folder on the file system Override and extend existing
do you store your pipeline processors
configuration files?
Create new pipelines that are called
The Include folder from code
8.0.0.1 www.sitecore.net/training
Review – Pipelines and Events
Q Give an example of an event that
you can subscribe to
Item saved / created / updated /
deleted / moved / renamed / and so on
8.0.0.1 www.sitecore.net/training
Rules
Topic 11.4
Define a rule
Name the two fields that define a rule
8.0.0.1 www.sitecore.net/training
Sitecore Rules Engine & Rules
A rule consists of conditions and actions
Conditional renderings use the rules engine for personalization. A rule example: if a user has 5
value points, then change the datasource of a component
Rules are part of the core Sitecore functionality and can be used everywhere
for example, conditional insert options (if a user is ____, show ____)
8.0.0.1 www.sitecore.net/training
How Does a Rule Work for Authors?
Conditions and actions
User select any number of conditions and actions
Evaluated in succession
8.0.0.1 www.sitecore.net/training
Demo – Implementation of Insert Options Rule
Demo objecitves
• Create an insert options rule that adds Simple Link as an insert option to any item
whose name equals Links
8.0.0.1 www.sitecore.net/training
Review – Rules
Q A rule consists of a ______ and Q In what other scenarios can rules
______ be used, besides personalization?
Condition and action For example, Insert Options
8.0.0.1 www.sitecore.net/training