# Adding the HTML

### ✍️ Objective - To display categories in homepage&#x20;

Open the layout.html file

This is how a bare minimum layout.html file would look like, it has some code which is required for a theme to function properly, avoid removing any of this code.

```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">
      {% 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>
```

If we check now, our site would be completely blank. Now, we will try to display a dummy category.

We will display a category image and category name, go ahead and paste this code inside the body tag.

```html
<div class="container">
    <div class="category-card">
      <a href="#" class="category-link">
        <div class="category-image-wrapper">
          <img width="300" height="300" src="https://i.imgur.com/ordhK4e.jpg" alt="Category 1" class="category-image">
        </div>
        <div class="category-name">Category 1</div>
      </a>
    </div>
  </div>
```

This code snippet creates a simple HTML structure to display a category card within a container. The category card includes an image and the category name, for now we have hardcoded a dummy image and category name, both wrapped within a hyperlink element for navigation purposes.&#x20;

\
If you save & preview the changes, you'd see something like this

<figure><img src="https://869317877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpxvKr8371wMxhqFS6hu%2Fuploads%2Fgzv5JIoGS0Vzb6z2MOdW%2FScreenshot%202023-03-30%20at%2018.55.17.png?alt=media&#x26;token=16e2ffce-e0e7-4dd9-b726-3b5e43117430" alt=""><figcaption></figcaption></figure>

Let's try to add some more dummy categories, the updated code would be

```html
<div class="container">
    <div class="category-card">
      <a href="#" class="category-link">
        <div class="category-image-wrapper">
          <img width="300" height="300" src="https://i.imgur.com/ordhK4e.jpg" alt="Category 1" class="category-image">
        </div>
        <div class="category-name">Category 1</div>
      </a>
    </div>
    <div class="category-card">
      <a href="#" class="category-link">
        <div class="category-image-wrapper">
          <img width="300" height="300" src="https://i.imgur.com/ordhK4e.jpg" alt="Category 1" class="category-image">
        </div>
        <div class="category-name">Category 2</div>
      </a>
    </div>
    <div class="category-card">
      <a href="#" class="category-link">
        <div class="category-image-wrapper">
          <img width="300" height="300" src="https://i.imgur.com/ordhK4e.jpg" alt="Category 1" class="category-image">
        </div>
        <div class="category-name">Category 3</div>
      </a>
    </div>
  </div>
```

This is how our site looks now

<figure><img src="https://869317877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpxvKr8371wMxhqFS6hu%2Fuploads%2FTF8pXHFUUuX41W9JINma%2FScreenshot%202023-03-30%20at%2018.56.19.png?alt=media&#x26;token=684aa5e5-12b4-44c0-9904-f840542b0aaf" alt=""><figcaption></figcaption></figure>

Now that we can display dummy data with HTML its time to flare up the tags by spicing it up with some CSS in the next chapter.

<details>

<summary>For reference - The contents of layout.html file after the above changes</summary>

```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">
        <div class="category-card">
      <a href="#" class="category-link">
        <div class="category-image-wrapper">
          <img src="https://i.imgur.com/ordhK4e.jpg" alt="Category 1" class="category-image">
        </div>
        <div class="category-name">Category 1</div>
      </a>
    </div>
    <div class="category-card">
      <a href="#" class="category-link">
        <div class="category-image-wrapper">
          <img src="https://i.imgur.com/ordhK4e.jpg" alt="Category 1" class="category-image">
        </div>
        <div class="category-name">Category 2</div>
      </a>
    </div>
    <div class="category-card">
      <a href="#" class="category-link">
        <div class="category-image-wrapper">
          <img src="https://i.imgur.com/ordhK4e.jpg" alt="Category 1" class="category-image">
        </div>
        <div class="category-name">Category 3</div>
      </a>
    </div>
      </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>
```

</details>
