# Adding Nunjucks

### ✍️ Objective - To integrate dukaan categories data with the category cards we have created so far

Let's go back to our layout.html file, earlier it was just hardcoded categories, we will now display real categories from our store using Nunjucks.\
\
The categories data of our store comes from a variable called `DUKAAN_CATEGORY_LIST`. It's a list of categories, for now we just need the category name and category image.\
You can find a sample data of it and all other available variable list [here](/dukaan-data.md).

```html
<!-- layout.html -->

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible"
          content="IE=edge"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    {% include './../../dukaan/common/theme-fonts.html' %}
    {{ 'splide.min.css' | css | static }}
    {{ 'layout.css' | css | static }}
    {{ 'styles.css' | css | static }}
    {% include './../../dukaan/common/seo_tags/commonSeoTags.html' %}
    {% include './../../dukaan/common/theme-colors.html' %}
    {% block head %}
    {% endblock head %}
    {{ 'head' | DukaanBlocks }}
  </head>
  {% include './../../dukaan/common/spinner-loader.html' %}
  <body class="flex d-column">
    {% include './../../dukaan/common/hellobar.html' %}
    <main class="flex flex-1 d-column">
      <div class="container">
      {% for category in DUKAAN_CATEGORY_LIST %}
        <div class="category-card">
          <a href="#" class="category-link">
            <div class="category-image-wrapper">
              <img src="{{ category.image }}" alt="{{ category.name }}" class="category-image">
            </div>
            <div class="category-name">{{ category.name }}</div>
          </a>
        </div>
      {% endfor %}
      </div>
      {% block content %}
      {% endblock content %}
    </main>
    {% include '../../dukaan/common/bxgy-sticky-footer.html' %}
    {% include '../../dukaan/common/store-open-sticky.html' %}
    {% block postfooter %}
    {% endblock postfooter %}
    {{ 'footer' | DukaanBlocks }}
    {% include './product-variant-templates.html' %}
    {{ 'variant-utils.js' | js | static }}
    {{ 'dukaan-utils.js' | js | static }}
    {{ 'layout.js' | js | static }}
    {{ 'dukaan-coupons.js' | js | static({ defer: true }) }}
    {{ 'dukaan-offers.js' | js | static({ defer: true }) }}
    {{ 'axios.min.js' | js | static({ defer: true }) }}
    {{ 'splide.min.js' | js | static }}
    {{ 'common-components.css' | css | static }}
    {% include './../../dukaan/common/auth.html' %}
    {% include '../../dukaan/common/multilanguage.html' %}
    {% include './../../dukaan/common/common-scripts.html' %}
    {% include '../../dukaan/common/snackbar.html' %}
    {% block script %}
    {% endblock script %}
  </body>
</html>
```

In this Nunjucks template, we use a `for` loop to iterate over the `DUKAAN_CATEGORY_LIST` variable and create a category card for each item. We use the `{{ }}` syntax to insert the category name and image URL from the data.\
\
You can deploy the change, you can now see your store category data visible in the homepage.

<figure><img src="/files/FBfCJzQUG9bcBThvAX2g" alt=""><figcaption></figcaption></figure>

\
🎉 Awesome, you just displayed your store categories in your own custom theme. You can do more changes as per your requirement, to read more about the data which Dukaan makes accessible using Nunjucks read about [Dukaan Data](/dukaan-data.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydukaan.io/basic-code-editing/adding-nunjucks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
