0% found this document useful (0 votes)
66 views

Sitecore 10.2docx

Uploaded by

Saad Bin Shafi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Sitecore 10.2docx

Uploaded by

Saad Bin Shafi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 62

Sitecore 10.

2
Download
Go to https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx
Select any version
From Download options for On Premises deployment
Download Graphical setup package for XP Single

Installation
Unzip the downloaded file in Local Disk C
Copy the license file in the same directory
Add a user Everyone to access the directory and give full control
Open the SSMS and connect to the server with sa
And run the following commands
EXEC sp_configure 'contained', 1
RECONFIGURE

Configure your IIS


Go this link then https://www.microsoft.com/web/downloads/platform.aspx, download and
install WebPlatformInstaller.msi
Restart your PC
Now run the Sitecore setup as admin and follow the wizard
Once done launch the Sitecore
Sitecore JSS
Install the package from https://dev.sitecore.net/Downloads/~/link.aspx?
_id=B5D60A30ADD1495C9B011E793AF6884F&_z=z depending on the Sitecore version
Upload to Sitecore
Open Windows PowerShell in Admin mode
Then run the following commands
npm i -g @sitecore-jss/sitecore-jss-cli

npx create-sitecore-jss@ver<version-number> nextjs

cd my-first-jss-app

jss start

After that create an API Key with meaningful name and the following settings
CORS Origins = *
Allowed Controllers = *
Impersonation User - Anonymous users will be impersonated as this user = extranet\
anonymous
If you are using a local instance, you must map the desired hostname to your localhost in
a host’s file entry.
After adding the hostname entry, add it as a binding on your IIS instance as well
Go to Sitecore > User Manager
Give Admin rights to JssImport user

In a terminal, run the JSS command jss setup and follow the prompts.

The jss setup process generates the /scjssconfig.json file containing the connection
strings for your JSS application

Now run the command jss deploy config

Copy the API_KEY, SECRET and HOST to .env file against the respective keys

The script copies the config patch files from the sitecore/config folder to the
Sitecore App_Config/Include/zzz folder.

This part is not implemented in VAD and ZNM and DET


Deploy the app to the sitecore by running the command

jss deploy items --includeContent --includeDictionary

To run the app run following command

jss start:connected

https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/walkthrough--
connecting-a-code-first-jss-next-js-application-to-sitecore.html
https://sandeeppote.com/category/sitecore/jss/

Working with JSS Forms


Add a form from Sitecore XP > Marketing Applications
You can create any type of form by adding controls and actions
After creating a form and saving it publish the form
On your nextjs app run the following commands
npm install @sitecore-jss/sitecore-jss-forms @sitecore-jss/sitecore-jss-react-forms
jss deploy component Form --allowedPlaceholders jss-main
jss scaffold Form

This will add a form to your nextjs app


Go to Form.tsx file and replace the code with
From terminal run jss deploy app
In the Sitecore Content Editor, navigate to the rendering item that was created
(/sitecore/layout/Renderings/Project/$yourappname/Form)
Set the Datasource location field to /sitecore/forms.
Set the Datasource template field to /sitecore/templates/System/Forms/Form.
Set the Rendering Contents Resolver field to Sitecore Forms Resolver. This causes JSS to deliver
form data to the component instead of item data.
Add the form to your jss-app content and set the presentation settings
https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/walkthrough--
using-a-sitecore-form-in-jss-applications.html
https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/implement-a-
sitecore-form-in-a-jss-next-js-app.html

Sitecore Item Presentation Details


Pass Sitecore item data to any client with
Url = hostname/sitecore/api/layout/render/jss?item=item_id&sc_lang=en&sc_apikey={apikey}
http://sitecore-jss-app.dev.local/sitecore/api/layout/render/jss?item=5288D54B-295E-5FED-
9225-D9A08F763234&sc_lang=en&sc_apikey={77D16C24-E660-4EBF-B33C-
FF0A0C1BAC3E}

Creating Component
https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/walkthrough--
creating-a-new-component-in-a-jss-next-js-app-using-the-sitecore-first-development-
workflow.html
Create the JSON rendering in Sitecore.
Verify the rendering's JSON output.
Create the component in the Next.js app.
Fill out values in the Experience Editor.

Role Management and Permissions


Roles are used to manage website authorization
They are nothing but collection group
To add a new Role
Go to Role Manager under Access Management in Sitecore XP
Add new role
Role name
Domain
After adding a role add inbuild role to it – rights from Member Of
Now add access permission to your role from access viewer
Creating a user
Go to User Manager under Access Management in Sitecore XP
Click New
Fill the details and save
Try login with your users
Project Flow

Code can be submitted to Source Control and after building it can be deployed to Environment
with some scripts
Packages can be deployed manually on Sitecore locations
Tools like TDS, Unicorn can be used to avoid Manual deployment
These tools allow developers to automatically move content items (templates, layouts,
renderings, etc.) between instances and store them as part of source control
Helix
Sitecore Helix is a set of guidelines and best practices for building scalable and maintainable
Sitecore solutions. It provides a structured approach to development that ensures a consistent
architecture and promotes reusable code. Helix emphasizes modular development and separation
of concerns, making it easier for teams to manage and maintain Sitecore websites over time. By
following the Helix principles, organizations can reduce the risk of technical debt and improve
the overall quality of their Sitecore solutions.

The Sitecore Helix architecture has three main layers:

Foundation layer: This layer includes the basic building blocks that are common to all Sitecore
solutions, such as site configuration, content templates, and global assets.

Feature layer: This layer contains the functional components that are specific to a particular
solution. Features may include modules such as search, navigation, and user management.
Project layer: This layer encompasses the solution-specific customizations, such as branding,
specific content, and custom functionality.
Unicorn
The idea behind using Unicorn is to serialize only items that you need, by adding the Sitecore
item paths to Unicorn configuration files. When the item is controlled by Unicorn, all the child
items can be serialized automatically unless excluded, which is very convenient because the
developer does not have to remember to serialize items manually after every change, they make
in Sitecore Content Editor. The newly created items should be reserialized in order to be stored
in the file system correctly – it is called initial serialization and Unicorn will complain during the
next sync if it is missed.
If you are following the helix architecture, then you need to add a project for Serialization under
Foundation layer. You can add a new empty MVC project.
E.g., Sitecore.Foundation.Serialization.csproj
Steps

 Right click on the newly added project and select “Manage NuGet Package”.

 In the NuGet window, select the “Browse” tab if it isn’t selected already and search for
“unicorn”.
 Select the latest version available, install the package.
Follow any prompts or instructions appeared during the installation
Solr Indexing
Solr is an indexing technology. Sitecore supports Lucene and Solr.
In Solr we have index database of our main database.
In Sitecore whenever we perform searches it is done from Indexing databases.
Whenever we publish anything, it will index in Solr.
Go to https://localhost:8983/solr/#/
Select any index_db and perform query
Resolver
 Item Resolver: Sitecore checks the requested URL and decide which Sitecore Item from
Sitecore content tree need to server to the client.

 Content Resolver: Content Resolver has business logic to generate content (JSON for
layout service) for the rendering/component.
Key terms and Definitions
New Features
 Containers
 Serialization
 Dot NET Core Rendering SDK
Atomic Design
Everything around us is made up of atom
Atom + atom = molecule
molecule + molecule = more complex organisms

Atom: Smallest item on a page – link, button, para


Molecule: Combination of 2 or more atoms – header, footer
Organism: Combination of 2 or more molecules – container
Templates: All organism in one place – final mockup
Page: Product of a template – final UI

To add atomic design pattern, update the file scaffold-component.ts under scripts
Exam Preparation
https://learning.sitecore.com/learn/mycourses
https://www.youtube.com/playlist?list=PLt519PJr4jF8Zz4fUSEdIiW3YgrgqKcEk
https://learning.sitecore.com/learn/course/766/play/957:342/sitecorer-10-net-developer-
certification-exam-study-guide
https://www.youtube.com/playlist?list=PLt519PJr4jF-BN4MbDovbwNoKs35lr1fF
https://www.youtube.com/playlist?list=PLLYksLXV8OcG3-fKtMJgDixBFo3kfeCpD
https://doc.sitecore.com/xp/en/developers/92/platform-administration-and-architecture/
architecture-overview.html - Arch
https://enjoysitecorewithjitu.blogspot.com/2020/10/sitecore-mvc-vs-jss-vs-sxa.html
https://chrisperks.co/2018/03/04/create-a-custom-solr-index-in-sitecore-9/ - Add Solr Index
SXA – JSS – MVC
https://docs.google.com/spreadsheets/d/1QOLEYRD8qNbUTDa1rxnoZ416H8Q-S-7-sL-
TJ3uEZTw/edit?usp=sharing Matrix
https://www.youtube.com/watch?v=9kQ8o9ODoQM Navan
https://www.youtube.com/watch?v=y1ic_b7I424 Passed One
https://mydatahack.github.io/sitecore-exam-prep/ Dummy
https://www.youtube.com/watch?
v=OfxsBBq8mNA&list=PLt519PJr4jF8Zz4fUSEdIiW3YgrgqKcEk&index=4
Add Site to Sitecore (MVC)
Add Site definition
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sites>
<site name="sitecore_demo" patch:before="site[@name='website']"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content"
startItem="/home"
hostname="sitecoredemo.local"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
disableClientData="false"/>
</sites>
</sitecore>
</configuration>

Add host entry


Add website binding
Adding New Layout (MVC)
Add a basic layout (.
In content editor add a new layout under /sitecore/layout/Layouts/Project
In the path add path to your MVC Layout page: /Views/BasicLayout.cshtml

Adding Partial View (Component) for dynamic website


Create a partial View
@using Sitecore.Mvc
@using Sitecore.Mvc.Presentation
@model RenderingModel

@if (Model != null && Model.PageItem != null)


{
<!-- Page Header Start -->
<div class="page-header">
<div class="container">
<div class="row">
<div class="col-12">
<h2>@Html.Sitecore().Field("Title", Model.PageItem)</h2>
</div>
@*<div class="col-12">
<a href="">Home</a>
<a href="">About Us</a>
</div>*@
</div>
</div>
</div>
}

Add placeholder to layout

@Html.Sitecore().Placeholder("main") – main is placeholder name


Sitecore MVC Context Objects
Page Context: requested item, the current device, the page definition, page view
Rendering Context: current rendering and the associated data
Request Context: URL, form values, and route
Placeholder Context: current placeholder information
Add Patch File
In Sitecore path files are used to edit the default configuration i.e. sitecore.config file. To update
it we need to create a patch file (a conf file)

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

<sitecore>

Settings here

</sitecore>
</configuration>

 patch:before – insert the element before the specified


 patch:after – insert the element after the specified
 patch:attribute – update the attribute of specified element
 patch:delete – delete the specified element
 patch:instead – replace the specified element
Debug Sitecore Code in VS
1. Open VS in Admin mode
2. Go to Debug
3. Attach to process
4. Search for w3w
5. And select the sitecore instance
Item URL with Link Manager
Sitecore.Links.LinkManager.GetItemUrl(Item, options) – return url of an item

ItemUrlBuilderOptions options = new ItemUrlBuilderOptions();


options.LanguageEmbedding = Sitecore.Links.LanguageEmbedding.Never;
Getting Home Item
Sitecore.Context.Site.StartPath – return combination of (root path + start item)
Sitecore.Context.Database.GetItem(path) – will return Item

Navigation in Sitecore
Tree Data Source
Build by crawling the tree Build by reading Data Source
Tree and Navigation will be same Tree and Navigation can be different
Useful if we have simple tree Useful for complex tree
Adding Processor
Define a class that will inherit PipelineArgs
public class CustomPipelineArgs : PipelineArgs
Define a class and create a method process and pass CustomPipelineArgs
public void Process(CustomPipelineArgs args)
Define configuration for sequence
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<customPipeline>
<processor></processor>
</customPipeline>
</pipelines>
</sitecore>
</configuration>

To invoke the pipeline write the below code


CorePipeline.Run(“Name”, args)
Extras
Every time a new language is added it should be added in next.config.js + styleguide.js
For debugging/troubleshooting add this line in .env file
DEBUG=sitecore-jss:*

For a folder template always inherit it from System/Common/Folder


Exam Material
Competencies

Competency Percentage No. of Questions

Sitecore structure & 12 6


platform
Security & user 16 8
management
Item management 20 10

Layout & placeholders 10 5


Components, controls, & 26 13
renderings
Sitecore Content 10 5
Serialization
Containers 6 3
C1 - Structure and Platform
Define Sitecore-specific terminology in a Developer context. Terms include Content Editor,
Experience Editor, component, rendering, placeholder, template, layout, item, and
serialization.

 Content Editor:
The Content Editor is a user interface within Sitecore that allows
content administrators and editors to manage and create content on
the website. It provides a tree-like structure representing the content
hierarchy.

 Experience Editor:
The Experience Editor is a Sitecore tool that allows content authors to
edit the content of a webpage in a more visual, WYSIWYG (What You
See Is What You Get) manner. It enables users to make changes
directly on the page itself.

 Component:
In Sitecore, a component is a modular and reusable unit of content or
functionality. It is often associated with a rendering and can represent
various elements on a webpage, such as a slider, a form, or a content
block.

 Rendering:
A rendering in Sitecore defines how a component is displayed on a
webpage. It specifies the presentation details and the associated logic
for rendering the content. Renderings are linked to components.

 Placeholder:
A placeholder is a designated area on a layout where components can
be dynamically added or removed. It provides flexibility for content
authors to customize the layout and structure of a page.

 Template:
A template in Sitecore defines the structure and fields that make up a
particular type of item. Items are based on templates, and templates
help maintain consistency across content types.

 Layout:
A layout in Sitecore determines the overall structure and arrangement
of components on a webpage. It is associated with a presentation,
specifying how the content from the associated item and its sub-items
should be displayed.

 Item:
An item in Sitecore is a fundamental unit of content. It represents a
piece of content or data within the content tree and is based on a
specific template. Items can include pages, media, or any other
content type.

 Serialization:
Serialization in Sitecore refers to the process of converting Sitecore
items, templates, and other configuration elements into serialized files
(usually XML or JSON). This allows version control and the ability to
transfer configurations between different Sitecore instances. It's
commonly used for source control and deployment purposes.

Differentiate between Sitecore MVC and Sitecore Headless Development methods, tools,
and processes at a high level.
Sitecore MVC:
Method:
 Monolithic Architecture
 Server-Side Rendering (SSR)
 Integrated Rendering Engine (Razor)
 Full-Stack Development
 Traditional Web Development
Tools and Processes:
 Sitecore MVC Framework
 Razor View Engine
 Layouts and Renderings
 Integrated Development (Frontend and Backend)
Sitecore Headless Development:
Method:
 Decoupled Architecture
 API-Driven
 Client-Side Rendering (CSR) or Static Site Generation (SSG)
 Specialized Frontend Technologies
 Headless CMS
Tools and Processes:
 APIs (RESTful or GraphQL)
 Frontend Frameworks (React, Angular, Vue.js)
 Content as a Service (CaaS)
 Microservices Architecture

Identify the different deployment options for a Sitecore Experience Platform environment
(e.g., on-premise, containers, Managed Cloud).

With Sitecore, the choice is yours: managed cloud, self-managed cloud, or on-premises
deployment.

Managed cloud deployment


A fully managed cloud environment from Sitecore. You’ll get Sitecore software, Microsoft
Azure-hosted infrastructure, and Sitecore managed services. You can purchase the following
products for cloud deployment

Self-managed cloud deployment


If you want to manage Sitecore software yourself but without providing your own data centers,
self-managed cloud deployment is right for you. You’ll get the software license for your
environment and can self-manage it in the cloud. You can purchase the following products for
self-managed cloud deployment

On-premises deployment
If you’re looking to manage Sitecore software yourself and have the infrastructure to host it, on-
premises deployment is right for you. You’ll get the software license for your environment and
can then deploy it in your data centers. You can purchase the following products for on-premises
deployment

Container-based Sitecore development


There are a number of reasons why the use of containers is attractive for Sitecore development,
and it becomes even more attractive as Sitecore moves towards a micro services-based
architecture. Containers lend themselves very well to this architecture (and in fact encourage it).

Other reasons are:

 No install - no installation using SIF (Sitecore Installation Framework), SIM (Sitecore


Instance Manager), and so on. Sitecore provides container images ready to use. You can
get an instance up and running with docker-compose up, and container images will
download automatically.

 Multi-project efficiencies - you can run multiple Sitecore instances simultaneously


without worrying about things like conflicting versions of SQL and Solr. You can start
and stop entire instances quickly when jumping between projects.
 Simplified onboarding - the onboarding process is as simple as: install prerequisites,
clone your code repository, run docker-compose up.

 Environment consistency - eliminate issues due to environment inconsistencies. When


you containerize your build, you have complete control of the build environment.
C2 - Security and User Management
Users:
 Authors: Manage the content of web site, create pages, upload media, define taxonomy,
publishing, user management and workflow
 Marketers: Design Campaigns, Analytics and Reporting, Personalization, A/B testing
 Developer: Develop components, define data structures, assemble multiple entities, build
framework for authors and marketers
There are default user accounts that should not change
sitecore/admin: admin
sitecore/anonymous: access to login screen
sitecore/ServiceAPI: default role for Sitecore.Services.Client
extranet/anonymous: access free parts of website
default/anonymous: user without domain
creator/owner: item/owner field

Using User Manager we can create users and manage their roles
Using Role Manager we can create new roles

Sitecore Domains are the collection of security accounts (users and roles).
 Extranet: User accounts that are visitors
 Sitecore: Internal Security Domain, Sitecore client roles that corresponds to the internal
users
 Default: Virtual domain that only exist in memory.
 Domain manager tool can be used to manage domains

Security Roles
https://doc.sitecore.com/xp/en/developers/93/platform-administration-and-architecture/the-
security-roles.html
Author: Item editing feature
Designer: Presentation Tab
Developer: Content Editor Ribbon
EXM Roles: Roles for managing Emails
Analytics Roles: Roles for managing Marketing related stuff
Client Roles: To manage activities

Security Tools
 Domain Manager: create domain, edit existing domain
 Role Manager: Create role, edit role, add members to roles
 User Manager: Manage users
 Security Editor: Define access rights to a user or role on an item
 Access Viewer
o Read: User can see Item
o Write: User can edit item
o Rename: User can rename Item
o Create: User can create item and it’s child
o Delete: User can delete item
o Admin: User can control access rights
o User can control security rights

Conflicting Rules
Denied override Allowed
When an access right is not specified, it is denied
If nothing is specified for the inheritance access right, inheritance is allowed
User assign roles will be consider between user and role
C3 – Item Management
Standard Values: The standard values item, like any item based on the data template, contains
all the fields defined in the data template itself, plus any fields inherited from base templates.
The standard values item contains default field values for items based on the data template.
Standard values are used when a field value for an item is set to NULL. When viewing an item in
the Content Editor, any field that contains a standard value is indicated by the token [standard
value] immediately next to the field title.

Insert Options: Insert Options determine which templates can be used to create child items
under a specific item. It controls the allowed template types for child items.

Item GUIDs: Globally Unique Identifiers (GUIDs) are unique identifiers assigned to each item
in Sitecore. They are used to uniquely identify items across different environments and instances.

Fields: Fields represent individual pieces of data within a Sitecore item. Each field corresponds
to a specific piece of information (e.g., a text field, date field, etc.).

Field Types: Field Types refer to the different types of data that a field can store, such as Single-
Line Text, Rich Text, Date, etc.

Source Values: Source Values define the allowed locations from which content authors can
select data. This is often used in fields like Droplink or Treelist.

Inheritance: Inheritance in Sitecore refers to the way in which templates and their field values
are passed down to items based on those templates. It allows for consistency in data structure.

Locate where search indexes are managed: Indexing Manager


Package Creation and Installation: Developer Tools
C4 – Layout and Placeholders
Layouts are the scaffolding for your web pages, and will usually include the <head> and <body>
tags for the markup. They often pull in styling and javascript code but have little markup
themselves, instead having multiple placeholders in which one can plug component renderings.
In DOT NET
Layout is a simple .cshtml file inside the Views/Shared folder
Placeholder is the content that will later replace by the component. This helps in building a
dynamic page
Placeholders are Sitecore controls that are used in layouts and sub layouts and are used to define
where components can dynamically be bound. The key attribute identifies the placeholder. A
typical placeholder looks like this:
@Html.Sitecore().Placeholder("maincontent")
In Sitecore
There are a few ways to create a new layout in Sitecore. The first way would be inside the
instance. Simply navigate to the content editor, then to the Layout section. Expand this section
and open the “Layouts” section inside. Create or navigate to a folder here, and right-click the
folder to add a new Layout item. You’ll need to provide a path to a corresponding razor view
(.cshtml) file, which you should create in a project somewhere in your solution.
Placeholders within a page must be unique
Static vs Dynamic Placeholders
The problem with this Static placeholder is, that if you add a placeholder to the same page more
than once, that model has a problem. Sitecore's "map" will no longer be sufficient, as there is no
way to distinguish for Sitecore between the two.
When you use dynamic placeholders, you can add the same placeholder name several times. You
can do this across multiple renderings, and you can even use the same placeholder multiple times
in a single rendering.
Dynamic placeholders mean that:
 Unique keys are guaranteed across different renderings and within one rendering.
 You can build functionality that generates multiple placeholders within the same
rendering dynamically.
Unlike a regular Sitecore placeholder that uses placeholder name as a placeholder key, a
dynamic placeholder generates a unique key. The dynamic placeholder key looks like this:
{placeholder key}-{rendering unique suffix}-{unique suffix within rendering}
https://sitecorediaries.org/2019/12/09/sitecore-dynamic-placeholders/
DynamicPlaceholder(string name, int count = 1, int maxCount = 0, int seed = 0)
Presentation Details on Standard Values
Assigning presentation details on standard values are recommended and important because
whatever you will assign on standard value it will automatically assigned on item which you will
create with the reference of that data template.
In other words I would say if you will assign the presentation details on template it's completely
waste because it will not inherit by the item which you will create with that template. That's the
reason we assign presentation details on standard value, not on template.
Also not only presentation details but other things like Insert options also should be assign on
standard value these are the best practices of Sitecore development.
PLD: Presentation Layout Details
Final Layout Changes are for specific language but shared is for every language.
C5 - Components, controls, & renderings
View Renderings:

 Definition: View Renderings are used to render the presentation layer of a component
using a Razor view file (.cshtml).

 Usage: They are suitable for rendering HTML markup and incorporating dynamic
content using Razor syntax.

 Example Scenario: Creating a rendering to display a list of news articles with images and
summaries.

Controller Renderings:

 Definition: Controller Renderings are used to render content through a controller action,
typically returning a ViewResult.

 Usage: Useful when you need more complex logic in the presentation layer, such as
retrieving data from external sources or performing complex calculations.

 Example Scenario: Building a rendering that fetches data from a custom API and then
renders it using a Razor view.

JSON Renderings:

 Definition: JSON Renderings are used to output JSON data directly without the need for
a Razor view. They are used to create data endpoints for client-side applications.

 Usage: Suitable for building APIs or providing data to client-side frameworks like
Angular or React.

 Example Scenario: Creating a JSON Rendering to expose a set of data, such as product
details, in a structured JSON format.

Compatible Renderings:

A Compatible Rendering is simply a component that can be replaced with another


component providing both use the same data source type (or no data source at all).

Compatible renderings are pretty straightforward;


1. In the Content Editor, locate the rendering or sublayout for
example/sitecore/layout/Renderings/Item
2. Click on the book icon

3. From the dropdown select Compatible Renderings

4. Using the multilist field, Locate the rendering or sublayout you wish to make compatible
with this one

5. To confirm its set up open the Experience Editor, add / find the rendering on the page and
click that rendering you should see recycle icon on the toolbar

That’s it! We now have two components that can switch between one another. You can have any
number of Compatible Renderings.

Configure HTML caching

 The HTML cache is an output cache that caches renderings, not whole pages. You use
the HTML cache to improve the performance of websites.

 To enable the HTML output cache:

 Patch the site specification of predefined sites in the sites node of the \App_Config\
Sitecore.config\App_Config\Sitecore\CMS.Core\Sitecore.Sites.config file and set the
cacheHtml property of sites to true to enable the HTML output cache for that site.

Note

The website default site set up during installation is already there. You must specify this setting
for any site you create yourself and that you want HTML caching for.

You can specify the size of each cache in the htmlCacheSize property of a site node.

Add caching options to the renderings Sitecore caches output for. You can do this in two ways:

 Locally by specifying the options every time you use a rendering. To do this, open the
item in the Content Editor, and on the Presentation tab, click Details, and then click the
rendering you want to set options for.
 Globally by specifying the options in the definition item of the rendering. This is then the
default setting for all uses of this rendering. To do this, open the rendering definition item
in the sitecore/Layout/Renderings part of the content tree, and navigate to the options in
the Caching section.

The options are:


 Cacheable

Specifies if Sitecore caches the rendering or not.

 Clear on Index Update

Sitecore clears the cache when it updates the content search index.

This is important if your Sitecore instance uses HTML caching for renderings, controls,
or sublayouts that contain code, and this code depends on an index. For more
information, see Index-dependent HTML caching.

 Vary by Data

Sitecore caches output based on the item accessed. This is useful when content is highly
consistent, for example: headers and footers.

 Vary by Device

Sitecore caches output for each device separately.

 Vary by Login

Sitecore caches two copies of the output: one for authenticated users, and one for
unauthenticated users.

 Vary by Parameters

Sitecore caches output for each parameter the rendering accepts.

 Vary by Query String

Sitecore caches output for each unique combination of query string parameters.

 Vary by User

Sitecore caches output for each authenticated user.

In a standard Sitecore installation, Sitecore clears the cache on each publish. This is specified for
the default website. If you add websites, you must patch the Sitecore.config setting

<event name="publish:end">
<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel"
method="ClearCache">
<sites hint="list">
<site>website</site> <!-- the default site -->
<site>yoursite</site> <!-- your site(s) -->
</sites>
</handler>
<handler type="Sitecore.Publishing.RenderingParametersCacheClearer,
Sitecore.Kernel" method="ClearCache" />
</event>

Sitecore clears caches for all sites you configure with the value of the cacheHtml property as
true. The publish:end event handler is configured like this in a standard installation:

If you do not want the cache for a site to be cleared when you publish you can add the
preventHtmlCacheClear attribute to the site definition like this:

<site name="custom_website" cacheHtml="true" preventHtmlCacheClear="true" … />

Headless Services lets you configure a Rendering Contents Resolver on each rendering, to
determine how a rendering and its associated data are serialized. Rendering Contents Resolvers
are configured in /sitecore/system/Modules/Layout Service/Rendering Contents Resolvers. By
default, Headless Services provides the following resolvers:

 Datasource Resolver - the default behavior. It serializes the rendering's datasource item.

 Datasource Item Children Resolver - serializes the children of the datasource item.

 Context Item Resolver - serializes the context item instead of the datasource item.

 Context Item Children Resolver - serializes the children of the context item.

 Folder Filter Resolver - serializes the descendants of the datasource item, excluding
folders.
Sitecore ASP.NET Core Rendering SDK

Works with Sitecore Headless Services

Features

 Client API for Layout Service

 Placeholder Rendering

 Field Helpers

 Routing Mapping

 Model Binding

 WYSIWYG

Request  Controller  Action  Rendering Attr  Rendering Engine  Layout Service


Request  Layout Service Client  Sitecore Content Delivery
C6 – Content Serialization
https://www.youtube.com/watch?v=CzQbwvKX1Cc&t=119s

Sitecore Content Serialization (SCS) is a system for serializing, sharing, and deploying content
items, as well as keeping them in version control.

Sitecore for Visual Studio

The Sitecore for Visual Studio plugin acts as a graphical user interface for Sitecore Content
Serialization.

The plugin provides:

 Visual configuration of modules and environments.

 Visual synchronization of items, including conflict handling.

 Visual configuration of automated item synchronization at build time.


Basic Competencies
 What is the name of feature that makes WCM possible in Sitecore
Experience Management
 What do you need to take full advantage of the Sitecore XP
Experience Database
Experience Management
 What is the primary location for all the digital assets in your solution’
Media Library
 What is the name of Component architecture guideline of Sitecore
Helix
 Which of the editors are used to modify an image in Sitecore
Content Editor, Image Editor, Experience Editor
 What are the Developer focus features added in Sitecore 10
Containers, Serialization, .NET Core Rendering SDK
 What are different options for Sitecore Serialization in 10
Using VS plugin or using CLI
 Benefits of Developer focused-features
Increased developer productivity, lower cost of ownership, faster onboarding for new
developers
https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/100/Sitecore
%20Experience%20Platform%20100/Release%20Notes
 Are all items pages in Sitecore Project?
No, items that are pages have presentation details
 Why does Sitecore recommend using a static HTML page as a friendly response for
a 500 error
To protect site from getting stuck in a loop
 Interface used to add additional languages in Sitecore
Control Panel
 How does Sitecore support each of the CMS pillars: Data definition, Content and
Presentation?
DD: Templates, Content: Items, Presentation: Layouts
 What three pieces of information do you require to create an item
Name, Template, Location (Parent)
 How to define data structures within Sitecore?
By using templates
 What is the purpose of template section
To group related fields together
 What does template inheritance ensure
Reusability and Maintainability
 Suppose you have a title field in two different templates, what is the best practice to
use this field?
Create a base template and inherit the two from that
 To provide a rich user experience, what are some recommended practices you
should use when creating templates
Provide default values, use friendly names and icons, use validations, use configure
settings
 Template B inherits from Template A and Template C inherits from Template B, Is
there and relationship between A and C
In-direct inheritance
 What could be done if there are parameters in two or more templates that need to
be assigned to a single component definition item
Inheritance
 What item settings needs to be configured for authors to be able to add content
Insert Options
 What happens if you don’t set any insert options
Only admins and privileged users can create content
 Where should we set the insert options?
In standard values
 What is the function of source field of a template
Where the content comes from, It is used to define the data source in cases of tree-list,
multi-list etc.
 Drop list vs Multi list
Drop list is for selecting single item, whereas multi list is for selecting multiple items
 How to ensure that a field in a view model is still editable
Fieldrenderer.Render(Item, name)
 Html.Sitecore.Field() cannot be used for?
Complex fields like checkbox
 Which field allow to enter HTML fragment?
Rich text
 Which fields can be rendered in line editable in Experience Editor
Single line text, Image, Datetime
 How do you display the contents of a field in a code
@Html.Sitecore().Field("Name")

 What can be used to translate fields and Help text in Sitecore Client
Dictionary entries
 What happens if FieldRenderer.Render() is used for a Multilist field?
GUID pipe separated
 What class would you use to retrieve the content of Treelist
MultilistField
 What is the name of pop up in Exp Editor that can be used to edit fields?
A field editor
 How to enable the use of a Field Editor
By add a button
 When using field helper if the field is not to be made editable inline
DisableWebEdit
@Html.Sitecore().Field("Field Name", new { DisableWebEdit = true })

 How to edit treelist in Experience Editor


Use edit frame and add buttons
 What is Field Editor buttons
A button that can be added in any toolbar shown in the Experience Editor
 If parent and child have same fields what will happen
Confusion, and difficult to manage
 Why multlist field is unable to render using Render()
It contains IDs and not readable content
 Purpose of Field Source
Source of data
 Shared vs Un-versioned vs Versioned
Shared: Same for all lang and all versions
Versioned: Specific version and Lang
Un-versioned: Same for all versions in same language
 Content in the content tree that needs to be reused in more than one site
Should be kept outside the root of the sites
 What are the different Sitecore Roles
CD, CM, Processing, Reporting & Standalone
 What are the some attributes that can be configured in site node
https://sitecorexpblog.wordpress.com/2016/07/31/sitecore-site-definition-attributes/
 Which tag is used in Layers.config to define the execution of config files
loadOrder – initially it runs in alphabetical order

 How to patch changes in Sitecore section of web config

Put a .config patch file in the App_Config/Include folder

 How are component parameters stored in Sitecore DB

As clear text in URL query string

 How can we retrieve a Data source in a view rendering with the default model

By using Model.Item

 With a particular rendering an editor can only select items of one particular type

By setting the template id in the data source template field

 What property will automatically prompt a user to choose a data source when
adding a component in the experience editor

Datasource Location
 How can you force a Sitecore control to output the content of an item’s datasource

Set the data source or item property

 Why would you set the component on the standard values and override the data
source on the item

When the component has to appear on every page but has a different data source for a
specific page

 When you add @Html.Sitecore().Placeholder(“main”) to your rendering, what do


you need to do to make this placeholder selectable.

Create Placeholder setting

 Can you use placeholder inside the placeholders

This cannot be done directly

 Dynamic placeholder syntax


{placeholder key}-{rendering unique suffix}-{unique suffix within rendering}

 Purpose of Standard Values of a template

To provide default value when the item is created or to have a fallback when a field has a
NULL value

 Why would you need to use the data source in a component

Data source allows you to build more flexible and reusable components

 How to show toolbar in a random part of the page

Using an edit frame

 What templates must be used as a base template for your parameters template

Standard Rendering Parameters

 What is the default model used by View Renderings and optional by Controller
Renderings

RenderingModel

 What are the two other names of components


Renderings and Controls

 Why would you use custom view component

The site needs a component that will integrate with third party source

 What can be used to replace one component from another

Compactible renderings

 How do you bind a controller to deal with the post of a View rendering

By filling the form controller name and form controller action fields in the definition item
of view rendering

 What do you need to do so that Field() extension method retrieves the content from
the data source

Default

 Why storing media in the Sitecore databases an advantage

It makes publishing easier as both are published

 The customer wants to change the layout for the temporary purpose what should he
use

Versioned layout

 What is mandatory for presentation details

Layout

 Describe the anatomy of a Sitecore Layout

A code file on file system and definition item on content tree

 What happens when you request a page that has no layout defined

Layout not found error

 How to specify static component in cshtml file

HTML.Sitecore().Renderings(“path”)
 Advantages of using components

Presentation artifacts are more reusable

 In Sitecore MVC how to make a field non editable

DisableWebEdit

 How to optimize the process for an author to prevent removing the renderings if
they just want to switch the view

Add a rendering to compatible rendering

 What do you need to create when you have a view rendering

A razor view

 Which .dll relates to presentation? Which dll is required to get rendering context

Siteore.MVC.dll

 Http request properties

Sitecore.context.request

 What are the properties that are available in the Sitecore.Context class

User, Database, language

 Danger of using Axes.Descendants

It retrieves all the children if invoked at root can create performance issues

 GetChildren vs GetDescendants

Get children will bring direct children and get descendants will bring every item under

 How to put an item in an editing state

Creating and Editing Context

 What methods do you invoke when begin and finishing editing

BeginEdit

EndEdit
 How to skip certain items when you build a nav

By using LINQ to filter by template or the value of a particular field

 What is used to create key-phrase pairs that can be used globally

Dictionary Items

 How to run part of code with a set of privileges different from those of the context
user

Use UserSwitcher or SecurityDisabler

 What is an item bucket

A container that allows you to hide items, while still being easily retrievable

 How to find items in buckets

Content Search API

 What part of Sitecore generates URL

Link manager

 Where can you customize how URLs are rendered globally

Link manager section in the web.config

 How can you get Sitecore to produce translated URLs

By setting Link Manager to use items display name

 In which cases would you want to change the Links that are generated for an
individual link

If you need to force the language of content that is to be rendered from Sitecore

 How to change characters in URLs that are generated from Sitecore

encodeNameReplcament

 How to disabled .aspx being added to all URLs

By changing the addAspxExtension in LinkManager


 How to access Cache.aspx

Sitecore/admin/cache.aspx – Default size 25MB

 Why should you never cache a component that displays personal information

Another user can see that info

 How to enable caching

cacheHtml=true

 What is stored in prefetch cache?

Items that Sitecore need to access during and just after the initialization of an instance

 Why disable cache

The cycle of caching and prefetching too many items puts load on SQL Server which will
degrade the startup time of application

 If a component needs to be cached anywhere it is used then

Cache setting is defined on component definition

 Workflow – A business defined process to be followed when new item versions are
created

True

 What are workflow made of

States – different stages, Commands – from one state to another, actions – performed
automatically when an item in a particular stage

 How are workflow defined

Through definition items under Sitecore/settings/workflow

 How to bind a particular workflow with a certain type of items

By setting the initial workflow in data templates standard values

 What are the two consequence of making a state final

Items can be published


Sitecore creates a new version when non admin user edits it

 What can you find Ina a workbox

Available commands on items grouped per workflow

 Point of workflow state write access rights

To override the write permissions while it is in a particular workflow state

 Purpose of extranet/domain

To provide access to the website for specific roles and users

 User is locked how to resolve this

Use the unlock button to unlock the user

 What is the best practice for setting permissions for a user

Permission should set on roles and assign that to user

 Which role access right have precedence

Deny

 What are the two types of accounts

Users and Roles

 Sitecore Security Apps

Access Viewer

Role Manager

User Manger

Security Editor

 Which user is bound to unauthenticated request to the front-end web

Extranet/anonymous

 What role is required to login to the Sitecore


Sitecore client user

 Access rights are stored

Standard filed on items

 If no access rights

Sitecore will consider parent

 Security best practices

Don’t define rights on users

Avoid explicit denies

 What is the default implementation of a class to use in Search that Sitecore provides

SearchResultItem

 When to use computed field

To use field data to calculate different value to be stored in index, done with complex

 Why you need item bucket

Large amount of content

 Search facets

To filter results after an initial search

 Group by clause is not supported by Sitecore search API

 Selection Mode – design settings on form elements ensures that users can select
more than one option

True

 In what order are language settings applied

Query string, Url, Cookie, project config file

 As a developer you are asked to enable item level language fallback

Specifying item language fallback rules and enabling site level fallback
 xConnect has what two services

Collection and Search

 If no @Html.Sitecore.VisitorIdentification()

Visitor’s info will not be stored in xDB

 How does Sitecore track a device

Tracking cookie

 How does Sitecore initially identify a contact

Identify() method

 What Sitecore use to identify a user

Sitecore.Analytics.Tracker.Current.Identifier(email)

 How to get data from xDB

xConnect

 How Sitecore knows you are a returning customer

By calling Identify() method

 What other DBs are required for xDB

Collection DB, Reporting, Session State

 A profile card is used to profile content, it acts as a preset of profile keys and values

 Pattern cards define archetypes to compare with the current profile of a contact

 What is the purpose of Sitecore Support Package

Sitecore can replicate the issue without access to your environment

 Why to use Attach to process


To ensure we are attaching to a Sitecore site

 What is the difference between publishing and deploying?

Publishing is master – web, deploying is vs – folder


JSS
 Sitecore supports Headless
Rest API, JSS – true headless, SXA – true headless

 API Only mode does not support Experience Editor

 Code First Approach


This allow developers to develop JSS app by using local mock content and later import
application into Sitecore

 Sitecore First Approach


First create design elements in Sitecore and later connects to the JSS app

 Sitecore has following


JSS Rendering SDK and .NET Core Rendering SDK

 Layout Service
It is the REST endpoint which provides data for Sitecore JSS apps

 Sitecore Layout Request Model


DTO that supports reading and writing of arbitrary properties

 Import Service

It is used to import JSS application build in code first approach

 Media Handler

Supports configuring how Sitecore handle media

 GraphQL

It is designed to be generic GraphQL service platform, not simply a content API and can
serve any data, it present it via GraphQL queries

 Rendering Engine

Render content and layout data returned by Sitecore layout service from Sitecore

Node.js, HTTP Rendering Engine


 Tag helpers

sc-img, sc-placeholder, sc-date

 Terms – Rendering Engine

ISitecoreRenderingEngineBuilder – Return type

ComponentRendererDescriptor? DefaultRenderer – default component renderer


descriptor object for handling Sitecore component rendering, null by default

AddViewComponent – maps a Sitecore layout component name to a view component


rendering

AddModelBoundView – maps a Sitecore layout component name to the default view


component rendering

AddPartialView – maps Sitecore layout component name to a partial rendering

 What is the role of CD in headless setup

It provide layout and content through API

 What outline the benefits of working with a headless Rendering Host for Sitecore

You can run the rendering host directly in VS

 Why would you use JSON rendering item

For headless JSON is used

 Custom Rendering Resolver

Access to more complex data from within Sitecore for the component you are creating

 Content Resolver

Allow to write custom C# code to affect the layout service output

 Sitecore Rendering Host

Operates outside of the CD and is the front end application

 When to use .NET Core Rendering over other

If the customer requires customized from end and has some complicated business logic
 Name of method used to register a model bound view

.AddModelBoundView

 Where do you register the view for a component

In the Startup class under configure service

 Why register a view

To provide Sitecore placeholder with a component to be rendered when combined with


output from layout service

 Benefits of Headless Development

Developing maintaining and scaling Sitecore solutions with efficiency

 .NET Rendering does not support SXA


Serialization
Process which converts DB items to text files

TDS and Unicorn

Move and Share items from one environment to another

Sitecore 10 - CLI and VS

CLI

sitecore.json – project config

name_of_module.module.json – module config

Scope:

 SingleItem

 ItemandChildren

 ItemAndDescendants

 DescendatsOnly

 Ignored

Rules

 Path

 Scope

 Alias

 Operations

PQ

 Why do you use Sitecore content serialization for

To easily move content between different env

 What is the purpose of module.json


Set the path of module to be serialized

 What if the module is not defined in Sitecore.json file

The content won’t serialized

 If serialization is to be done for an item and its descendants

Scope

 What file is generated wit Sitecore CLI

dotnet-tools-json

 TDS features not in VS

File deployment, Web deployment, Code generation, Validators and Environmental


Validations
Containers
 Benefits

Light, Isolation, Portability, Loose coupling and Scalability

 Sitecore

No installation using SIF get the image and run

Multi project efficiencies

Immutable, docker-compose-up and down

 Hyper V is required for containers

 Docker-compose.yml

Main configuration file use by docker compose command it contains information about
different containers and their config

 .env

Environment variables file

 Dockerfile

Contains the instructions that docker uses to assemble a Docker image and run it.

 XDT

It is used for patching in files like web.config, domains.config

 Solution Transform

Apply to all roles

 Role Transform

Apply to specific server roles

 ENTRYPOINT Script

It provides command to execute when the container runs first


 Watch Script

Watches source path for file changes and updates the destination path accordingly

 When creating custom Sitecore images for your solution what you should do

Include Sitecore runtime dockerfile for each container that makes up the topology

Layer build outputs from your solution

 Benefits of using Docker Tools ENTRYPOINT and watch script

Faster development, overcoming limitations of mounted folders and clean separation of


solution

 To run the init script and getting started template you need?

Path to valid Sitecore license

Password

 Module asset images don’t run directly

 Which docker compose file has additional containers and specs for a docker
container deployment of Sitecore

Docker-compose-override

 What environment does not include in an XP0 Docker container deployment

CD

 How do you deploy code in CM instance when using the Getting started template

Publish the platform project from VS

 What is view window that is associated with Sitecore for VS

Sitecore module explorer

 What docker command is used for pulling the logs for the rendering container

docker-compose-logs -f rendering
 How to debug the CD that’s running in a docker

w3wp process

 What is the Sitecore container registry

Docker images for development and prod purpose

 When to use HOST_LICENESE_FOLDER instead of SC License

If the license compression fails, SC License has value while this has path

 What is not necessary for using the getting started template

Command Prompt

 What is the purpose of clean.ps1 script

To clear the environment of all persistent data

 Getting started installs XP0

 What are the identified Sitecore supported topologies for docker

o XP Workstation

o XM Server

o XP Server
 When you want to refer to a specific placeholder in the presentation details, which
identifier do you use?

Placeholder Key

 In a non-SXA website, you have created a layout definition item and want to
designate the layout as part of the presentation details. According to Sitecore best
practices, where should you set presentation details?

Standard values

 You have configured a new role for graphic designers at your company. How would
you add multiple existing users to the role?

Go to the Role Manager and use the Members tool to add users as members of the role.
Sitecore 10.4
https://developers.sitecore.com/downloads/Sitecore_Experience_Platform/104/
Sitecore_Experience_Platform_104

Use Installation Assistant for Installing Sitecore XP0 on your local machine

Step by Step Installation guide

https://insightswithvishalkhera.wordpress.com/2024/04/30/install-sitecore-xp-10-4-using-
sitecore-install-assistantt/

https://buoctrenmay.com/2024/05/02/sitecore-xp-10-4-initial-release-installation-sif-way/

You might also like