Coder Social home page Coder Social logo

sitecore.helix.constgenerator's Introduction

Sitecore Helix ConstGenerator

This NuGet Package will generate (via T4 template) the static fields representing all templates and relating fields of an Sitecore Helix Module. It uses the Sitecore Item WebAPI v1 in order to retrieve the template information.

Dependencies

  • log4net 2.0.8
  • Newtonsoft.Json v6.0.8 -> in accordance to Sitecore's version
  • RestSharp 105.2.3
  • Sitecore.Kernel.NoReferences 8.2.170407
  • Sitecore.ItemWebAPI.NoReferences 8.2.170407

Getting started

In your Helix module install the NuGet package

Via the package manager

Install-Package Sitecore.Helix.ConstGenerator

How to set it up

After installing the NuGet Package, the following files are added to the project:

  • Templates.tt
  • App_Config/Include/WebApiDefinition.config

Patch config

First, update the config file by entering your site name in the patch node

...
<site name="[YOUR_SITE_NAME]">
...

Then publish this configuration file to your website. Sitecore Item WebAPI is now active.

Template config

Open the Template.tt. Enter the correct values in the below sections.

/************************************************************
*															*
*						Settings							*
*															*
************************************************************/
  const string baseUrl = @"http://YOUR_URL_HERE";
  const string templateRootPath = @"/your/path/here";

/************************************************************
*															*
*					 Authentication							*
*															*
************************************************************/
  const bool useAuthenticatedRequest = false;
  const string userName = @"";
  const string password = @"";

An example could be:

/************************************************************
*															*
*						Settings						    *
*															*
************************************************************/
  const string baseUrl = @"http://habitat.dev.local";
  const string templateRootPath = @"/sitecore/templates/Feature/Media";

/************************************************************
*															*
*					 Authentication						    *
*															*
************************************************************/
  const bool useAuthenticatedRequest = true;
  const string userName = @"admin";
  const string password = @"b";

NOTE: It is mandatory to set your credentials if in the config file the 'AllowAnonymousAccess' has been set to false.

Troubleshooting

sitecore.helix.constgenerator's People

Watchers

James Cloos avatar Edouard Riviere avatar Steve Bridges avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.