Surendra Sharma

Surendra Sharma

Search This Blog

Friday, January 28, 2022

Sitecore JSS : Convert YML to JSON

Till yesterday, I knew that to provide content in Sitecore JSS I need to create YML file.

But today I learn that one can also create JSON file as well

Lets suppose we have following Graphql en.yml file

fields:

  pageTitle: GraphQL | Sitecore JSS

placeholders:

  jss-main:

  - componentName: ContentBlock

    fields:

      heading: Using GraphQL with JSS

      content: |

        <p>This is a live example of using Integrated GraphQL and Connected GraphQL with a JSS app.

        For more information on GraphQL use in JSS, please see <a href="https://jss.sitecore.com" target="_blank" rel="noopener noreferrer">the documentation</a>.</p>

  - componentName: GraphQL-Layout

    placeholders:

      jss-graphql-layout:

      - componentName: GraphQL-IntegratedDemo

        fields:

          sample1: Hello integrated GraphQL world!

          sample2:

            href: https://www.sitecore.com

            target: _blank

            text: GraphQL lets you get structured field data too

      - componentName: GraphQL-ConnectedDemo

        fields:

          sample1: Hello connected GraphQL world!

          sample2:

            href: https://www.sitecore.com

            target: _blank

            text: GraphQL lets you get structured field data too

 

I want to convert it to json file which can be easily accopalieshed by visiting https://onlineyamltools.com/convert-yaml-to-json as


I kept this json data in “testymltojson.json” file as 



He is the complete code

{

    "fields": {

        "pageTitle": "GraphQL | Sitecore JSS - YML To JSON"

    },

    "placeholders": {

        "jss-main": [

            {

                "componentName": "ContentBlock",

                "fields": {

                    "heading": "Using GraphQL with JSS - YML To JSON",

                    "content": "<p>This is a live example of using Integrated GraphQL and Connected GraphQL with a JSS app.\nFor more information on GraphQL use in JSS, please see <a href=\"https://jss.sitecore.com\" target=\"_blank\" rel=\"noopener noreferrer\">the documentation</a>.</p>\n"

                }

            },

            {

                "componentName": "GraphQL-Layout",

                "placeholders": {

                    "jss-graphql-layout": [

                        {

                            "componentName": "GraphQL-IntegratedDemo",

                            "fields": {

                                "sample1": "Hello integrated GraphQL world!",

                                "sample2": {

                                    "href": "https://www.sitecore.com",

                                    "target": "_blank",

                                    "text": "GraphQL lets you get structured field data too"

                                }

                            }

                        },

                        {

                            "componentName": "GraphQL-ConnectedDemo",

                            "fields": {

                                "sample1": "Hello connected GraphQL world!",

                                "sample2": {

                                    "href": "https://www.sitecore.com",

                                    "target": "_blank",

                                    "text": "GraphQL lets you get structured field data too"

                                }

                            }

                        }

                    ]

                }

            }

        ]

    }

}


So if you deployed it to Sitecore, this json file will create its item as


Short tip but very useful!!!


Monday, April 5, 2021

The Sitecore Experience Edge Partner Collection

As you know that Sitecore introduce new product Sitecore Hub with Edge.

Sitecore also launched certification course "
The Sitecore Experience Edge Partner Collection" on the same at their eLearning portal.

I registered and follow all the training topics and successfully completed my certification on the same.

Certificate : The Sitecore Experience Edge Partner Collection

 

Tuesday, March 30, 2021

Introduction to the Sitecore ASP.NET Core Rendering SDK

As you know that we can use ASP.NET CORE for developing headless application on Sitecore platform.

Sitecore launched certification course "Introduction to the Sitecore ASP.NET
Core Rendering SDK
" on the same at their eLearning portal.

I registered and follow all the training topics and successfully completed my certification on the same.

 

Sitecore ASP.NET
Core Rendering SDK Certification

 

 

 

Sunday, March 21, 2021

Boxever Advanced Certification

As you know that Sitecore acquired Boxever Ltd. which is a SaaS-based Customer Data Platform (CDP) providing decisioning and experimentation.

Sitecore also launched certification on "Boxever" as their eLearning site.

I registered and follow all the training topics and successfully completed my certification on the same.

Boxever Advanced Certification

 

 

Monday, March 15, 2021

Sitecore forgot password configuration with Sendgrid

Recently I worked on forgot password functionality from where user can get new password in his inbox through SendGrid in case if he forgot the Sitecore login password.

My Sitecore instance is on Azure. 

Open Kudu

I create a patch file at \site\wwwroot\App_Config\Include\zzz\MyPatchFile.config file and in <settings> section add below SMTP details lines.

<setting name="MailServer" value="smtp.sendgrid.net" />

<setting name="MailServerUserName" value="apikey" />

<setting name="MailServerPassword" value="4565655676hkjsd7868jkhkj" />

<setting name="MailServerPort" value="587" />


Save your changes.

If you are using SSL security, you must also add the following setting to the configuration file \site\wwwroot\Web.config:


  <system.net>

    <mailSettings>

      <smtp from="noreply@example.com">

        <network host="smtp.sendgrid.net" password="4565655676hkjsd7868jkhkj" userName="apikey" port="587" />

      </smtp>

    </mailSettings>

  </system.net>

</configuration>

 
Save your changes.

You need to change the sender of the Forgot your Password email to a valid email address. You can also edit the subject and content of the email. To do this, follow these steps:

  • Log in to Sitecore as an administrator.
  • In the Launchpad, open the Desktop, and select the Core database.
  • In the Content Editor, navigate to /sitecore/system/Settings/Security/Password recovery/Password Recovery Email.
  • Enter a valid email address in the Sender email address field, and change the other fields as you need.

Sitecore Forgot Password configuration

Now if any user forgot his password, 

  • Visit to /sitecore/login page. 
  • Click on "Forgot your password?"
  • Enter Sitecore user name
  • Click on Send button

You should receive a email with username with newly generated password.