Saad Ansari (Sitecore Sam)
I am Saad Ansari, #Sitecore #MVP 2019 - 2020, UI/UX, Full Stack & Sitecore Developer. Co-Founder and Speaker of #SUGPAK Pakistan. Photographer and Music lover. A tech geek who loves to delve into new Technologies.
Consumption License is required for JSS
Learn more at Headless Vs. Traditional CMS
Headless allows the web apps to run independent of the backend. Headless CMS delivers content through an API independent to any device.
In Sitecore. Decoupled Headless Platform from allows you to create web apps independent of the Sitecore XP.
Sitecore Platform Architecture is based on three major parts
1
2
3
npm install -g @sitecore-jss/sitecore-jss-cli
jss create my-first-jss-app react
cd my-first-jss-app
jss start
# Create the component
jss scaffold TheStory
You need any OS supported by Node (Mac, Windows, Linux) and sitecore-jss-cli installed
Sitecore Javascript Services follows same, but you can better understand with these.
1
2
3
import {
CommonFieldTypes,
SitecoreIcon,
Manifest
} from "@sitecore-jss/sitecore-jss-manifest";
export default function(manifest) {
manifest.addComponent({
name: "TheStory",
icon: SitecoreIcon.DocumentTag,
fields: [
{ name: "storyHeading", type: CommonFieldTypes.SingleLineText },
{ name: "storyContent", type: CommonFieldTypes.RichText },
{ name: "storyImage", type: CommonFieldTypes.Image }
]
});
}
[my-first-jss-app]\sitecore\definitions\components
fields:
pageTitle: Sitecore JSS
placeholders:
jss-main:
- componentName: TheStory
fields:
storyHeading: Give the gift of shopping
storyContent:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
storyImage:
src: data/media/img/card-img.png
alt: story Logo
[my-first-jss-app]\data\routes\
import React from 'react';
import { Text, RichText, Image} from '@sitecore-jss/sitecore-jss-react';
const TheStory = (props) => (
<div>
<p>TheStory Component</p>
<Text field={props.fields.storyHeading} />
<RichText field={props.fields.storyContent} />
<Image field={props.fields.storyImage} />
</div>
);
export default TheStory;
[my-first-jss-app]\src\components\TheStory
By Saad Ansari (Sitecore Sam)
Introduction to Sitecore JavaScript Services
I am Saad Ansari, #Sitecore #MVP 2019 - 2020, UI/UX, Full Stack & Sitecore Developer. Co-Founder and Speaker of #SUGPAK Pakistan. Photographer and Music lover. A tech geek who loves to delve into new Technologies.