According to the flow, we should have created Services we offer section but those services will need the details page as well so we will create that component as the last component while building the Home page.
Till now if you have any queries then please get in touch with me and give a brief of the issue you are facing so that I can help.
Moving forward with the Safe & Secure tagline section, it is nothing but just a html that we will be storing in Sitecore and Fetching in the View.
- Go to Sitecore >> Content Editor >> Home item.
- Right Click >> Insert >> Insert from template.
- Select the Summary template under the Common folder (/sitecore/templates/Sitecore Demo/Common/Summary) & name it as Safe & Secure tagline.
- Click on the Edit HTML link.
- Copy the HTML markup from the index.html file from the Logistico.zip extracted files.
- Click Accept and publish this item.
- Open Visual Studio, create a View and Name it as “SafeSecureTagLine.cshtml”.
- Add the below code to it.
@using Sitecore.Mvc
@using Sitecore.Mvc.Presentation
@using Sitecore.Data
@using Sitecore.Data.Items
@using DummyWebsite@{
//Extract the current Db
Database currentDb = Sitecore.Context.Database;//Get the value of the Datasource
string datasource = RenderingContext.Current.Rendering.DataSource;//Get the datasource item
Item item = currentDb.GetItem(datasource);
}@Html.Sitecore().Field(Templates.Summary.Fields.Summary_FieldName, item)
- Publish this View.
- Go to the rendering item (/sitecore/layout/Renderings/Sitecore Demo) & create a View Rendering and name it “Safe Secure Tagline”.
- Publish the rendering and Go to the Home item (/sitecore/content/Home).
- Go to the Presentation tab >> Details >> Edit Link.
- Go to Controls & click on Add.
- Select the new Rendering we created and insert “main” in the Placeholder field.
- Click Select. Click on the rendering (Safe and Secure Tagline) and Click Edit.
- In the Data Source field, select the Safe and Secure Tagline item created under Home.
- Click OK >> OK >> OK.
- Publish the Home item & browse the Front end site.
- The component is ready and we go the content as well except the background image.
- If we check in the browser while browsing the index.html, we will understand that the image is coming through CSS.
- Lets download this image and upload in the Media Library.
- Created a folder Common under Sitecore Demo & uploaded the file.
- Note down the id of this image. ie. {753EB491-F9E4-428E-8B02-5BCB9EC530E8}. Now we can browse it using below URL:
-/media/753EB491F9E4428E8B025BCB9EC530E8.ashx - Publish the Common folder with subchild and Go to Safe and Secure Tagline item under Home.
- Click Edit HTML and add the below CSS at the top.
<style>
.contact_action_area {
background-image: url(-/media/753EB491F9E4428E8B025BCB9EC530E8.ashx);
}
</style>
- Click Accept and Publish this item.
- Browse the Front end site.
With the help of above all steps, we have completed the Safe & Secure Tagline component. In the next blog, we will create the testimonial component.
Thank you.. Keep Learning.. Keep Sitecoring.. 🙂
Pingback: Building Home page Components – Featured Services section | Sitecore Dairies