Build a Liquid template example using Contentstack .NET SDK

This example is created using Contentstack’s .NET SDK. It uses Contentstack's .NET SDK to create a Liquid template website.

Screenshots

Contentstack Liquid Template Example.png

Quickstart

Here’s a quick guide on how to create a Liquid template example using .NET SDK and Contentstack.

Prerequisites

Note: For this tutorial, we have assumed that you are familiar with Contentstack. If not, then please refer to the docs (Contentstack docs) for more details.

In this tutorial, we will first go through the steps involved in configuring Contentstack, and then look at the steps required to customize and use the presentation layer.

  1. Create a stack

    Log in to your Contentstack account, and create a new stack. This stack will hold all the data, specific to your website. Learn more on how to create a stack.

  2. Add a publishing environment

    To add an environment in Contentstack, navigate to ‘Settings' -> 'Environment', and click on the '+ New Environment’ tab. Provide a suitable name for your environment, say ‘staging’. Specify the base URL (e.g., ‘http://YourDomainName.com’), and select the language (e.g., English - United States). Then, click on 'Save'. Read more about Environments.

  3. Import content types

    A content type is like the structure or blueprint of a page or a section of your web or mobile property. Read more about Content Types.

    For this website, one basic content type is required: Product. 

    For quick integration, we have already created this content type. You can import this content type into your project stack in Contentstack. (You can also create your own content types. Learn how to do this).

    To import the content type, first save the zipped folder of the JSON files given below on your local machine. Extract the files from the folder. Then, go to your stack in Contentstack. The next screen prompts you to either create a new content type or import one into your stack. Click the ‘Import’ link, and select the JSON file saved on your machine.

    Download All Content Types

    Now that all the content types are ready, let’s add some content for your example.

  4. Adding content

    Create and publish entries for the content type

    Add a few dummy entries for the ‘Product’ content type. Save and publish these entries. Learn how to create and publish entries.

    With this step, you have created sample data for your website. Now, it’s time to use and configure the presentation layer.

  5. Clone and configure the application

    To get your app up and running quickly, we have created a sample .NET app for this project. You need to download it and change the configuration. Download the app using the command given below:

    $ git clone https://github.com/contentstack/contentstack-dotnet-liquid-template-example.git

    Now add your Contentstack API Key, Delivery Token, and Environment to the appsettings.json file within your project. (Find your Stack's API Key and Delivery Token).

    "ContentstackOptions": {
        "ApiKey": "api_key",
        "AccessToken": "delivery_token",
        "Environment": "environment"
    }

    This will initiate your project.

  6. Build and run your Liquid template example

    Open the ‘contentstack-dotnet-liquid-template-example.sln’ file to see the project in Visual Studio and install dependencies.

    Now that we have a working project, you can build and run it.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

top-arrow