Sunday, April 11, 2021

Sitecore 10 features

  Hi Sitecore Family

 I have explain the few things in sitecore 10


1.Sitecore 10 features

2.Installing sitecore 10 using getting started template

3. Content serialization overview

4. Content serialization - Sitecore CLI

5.Content serialization - VS plugin


Happy Sitecoring!!!!

Content Serialization with Visual Studio

 

Step 1:

Set up the project solution.We have gotten the project from the Getting started template itself.

Øset up the folder structure to organize your modules. Modules are sets of includes—rules that determine what you want to serialize and how you want to interact with things you pull and push in your solution.

ØCreate a folder titled TestModule

Create/Edit Module with Sitecore for Visual Studio

right-click on Modules, select New Module, and set the Namespace to SVSTestModule.


Right-click the SVSTestModule and click view code , you can see the code

Configure Item Include

Create Include with Sitecore Module Explorer

 In the Sitecore Module Explorer, right-click on SVSTestModule.


Define Rules


Keep Alias blank, and Allowed Push operations as (empty). 

Right click the Flowers include and click view code,the code should looks like the one which we created in TestModule



{

  "namespace": "SVSTestModule",

  "items": {

    "includes": [

      {

        "allowedPushOperations": "createUpdateAndDelete",

        "name": "Flowers Include",

        "path": "/sitecore/content/MySC10Project/Flowers",

        "scope": "itemAndDescendants",

        "rules": [

          {

            "path": "/Rose",

            "scope": "ignored"

          }

        ]

      }

    ]

  }

}

Serialize Items


Pull Items


In the Sitecore Module Explorer, right-click on Sitecore Configuration Root.





ØI got this popup message.Then I made some changes on the item under the Flowers items, then click again the pull items from Sitecore.

ØI just created a new item Iris and update the item lotus, so those two displayed here.

ØThen select and click sync










Content Serialization with Sitecore CLI

 

Create/Edit Module with a Text Editor

Step 1:

Set up the project solution.We have gotten the project from the Getting started template itself.

Øset up the folder structure to organize your modules. Modules are sets of includes—rules that determine what you want to serialize and how you want to interact with things you pull and push in your solution.

ØCreate a folder titled TestModule

Step 2:

ØOpen the MyProject project in Visual Studio Code. 

ØNavigate to the sitecore.json file.

Change this to "src/*/*.module.json"

Note: The Sitecore.json file is used to control how Sitecore serialization behaves. The modules section of this file is used by Sitecore serialization to locate all modules in your solution. The default configuration only refers to a single module, but we can change it to use wildcards (*/*) to locate all modules in your solution.

Step 3:

Under the src\TestModule node in your project, create a file for your module named TestModule.module.json.

add the following  code:

{
"namespace": "TestModule"
}

You have now created a module called TestModule.


 

Note: When developing a solution, make sure that the location of your module matches the path of the glob in your sitecore.json file (default glob is src/*/*.module.json). If it does not, add the path to the sitecore.json file.

Configure Item Include

Step 1:

Open the TestModule.module.json file and add it

{

  "namespace""TestModule",

  "items": {

    "includes": [

      {

        "name""Colors include",

        "path""/sitecore/content/MySC10Project/Colors"

      }

    ]

  }

}


This include indicates that this module will serialize the Plants item and its descendants (the scope is set to Item and Descendants by default).

Define Rules

Open the TestModule.module.json

Add this rule

"rules": [

          {

            "path""/Purple",

            "scope""ignored"

          }

        ]

 

Then the whole json would look like this

{

  "namespace""TestModule",

  "items": {

    "includes": [

      {

        "name""Colors include",

        "path""/sitecore/content/MySC10Project/Colors",

        "rules": [

          {

            "path""/Purple",

            "scope""ignored"

          }

        ]

      }

    ]

  }

Serialize Items

dotnet sitecore ser -h

Pull Items

When we run the serialization command, it will execute the includes and rules of the modules we have created. 

First , test the functionality before proceeding

dotnet sitecore ser pull -w

The -w allows you to see what would be executed, without actually executing. 

Run dotnet sitecore ser pull.


I have added the rules for ignoring purple color so it’s not serialized.







Content Serialization

  Sitecore Content Serialization allows you to easily put items into source control, build deployment scripts that push items to various environments, and create packages for later deployment.

Sitecore Content Serialization Feature

The new tool has two parts:

the Sitecore Command Line Interface (CLI), and

the Sitecore for Visual Studio plug-in.

Why Content Serialization?

ØContent serialization allows Developers to push and pull data, such as content items, templates, and renderings, from a controlled shared area when needed or supported in the local workstation. Serialization is also important for sharing Developer artifacts through source control and for deploying changes to production. This source control would also be the authoritative place to look for items necessary to the Sitecore production instance. 

ØHistorically, Unicorn was integrated into your Sitecore instance and required you to deploy configuration files directly to your Sitecore instance to function. On the other hand, TDS (which is headless) integrated with your Visual Studio project. However, these tools required all Developers on the team to collectively choose between the two products, as they are not compatible with one another. 

Sitecore Content Serialization

ØThe Sitecore Content Serialization tool brings together the best of TDS and Unicorn alike. It has two parts: the Sitecore Command Line Interface (CLI) and the Sitecore for Visual Studio plug-in. These two options operate independently, allowing you to choose your preferred development style without being restricted to using the same tool as other Developers on your team.


If you are a Developer who prefers the command line and doesn't mind working directly with configuration files, the Sitecore CLI will meet your needs. If you prefer a graphical user interface (GUI), or a tool that integrates directly into your Visual Studio workspace, the Sitecore for Visual Studio plug-in is for you. Sitecore Content Serialization works with JSON-based module configuration that stays within your source control and is local to where the CLI runs. The Sitecore for Visual Studio plug-in provides a GUI wrapper around the command line functionality. Any remote Sitecore instance, such as a production or quality assurance instance, doesn't need to be aware of the serialization configuration. It just needs to react when the CLI sends a push or pull command. 





Installing Sitecore 10 using getting started template - Docker

 

Install the prerequisites

.NET Core 3.1 SDK (check your installed version with the dotnet --version command)

.NET Framework 4.8 SDK (see the Microsoft procedure for checking .NET Framework versions)

Visual Studio 2019

Docker for Windows (with Windows Containers enabled)

PowerShell 5.1 (PowerShell 7 is not supported)

Step 1:

ØCreated source folder and point the folder in powershell

ØRun it - > dotnet new -i Sitecore.DevEx.Templates --nuget-source https://sitecore.myget.org/F/sc-packages/api/v3/index.json



ØCheck if you have Internet Information Server running on port 443:

Get-Process -Id (Get-NetTCPConnection -LocalPort 443).OwningProcess

ØIf you do, you must to stop it:

iisreset /stop

ØCheck if you have Internet Information Server running on port 8984:

Get-Process -Id (Get-NetTCPConnection -LocalPort 8984).OwningProcess

Step 2:

ØCreate new project

dotnet new sitecore.aspnet.gettingstarted -n MySC10Project

ØSet certificate path

.\init.ps1 -InitEnv -LicenseXmlPath "<path to your license.xml file>" -AdminPassword "<your Sitecore administrator password>"

ØYou use the provided init.ps1 script to prepare the following items for the Sitecore container environment:

.\up.ps1

Step 3:

ØSitecore instance automatically opens in browser, we have to give the credential.

Øhttps://cm.mysc10project.localhost/sitecore/client/Applications/Launchpad?sc_lang=en#dateFrom=22-12-2020&dateTo=22-03-2021

Øhttps://id.mysc10project.localhost/ points to the mysc10project_id_1 container with a Sitecore instance hosting Sitecore Identity Server.

 https://cm.mysc10project.localhost/ points to the mysc10project_1 container with a Sitecore instance hosting Content ManagementContent Delivery, and Sitecore Layout Service.

Øhttps://www.mysc10project.localhost/ points to the mysc10project_rendering_1 container with the rendering host.

 Useful Comments

ØOnce you resume your work after this installation, you can use the below comments for creating new healthy containers

docker-compose stop

docker-compose down

iisreset /stop

docker-compose up -d

 













Steps to follow when using a PowerShell script to modify the goals in Sitecore

I have previously utilized PowerShell for item creation, modification, deletion, and presentation details in Sitecore.   Ø Recently, I attem...