11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.

Home Page:https://www.11ty.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data from collection not showing on template

clluiz opened this issue · comments

Operating system

ubuntu 22

Eleventy

2.0.0

Describe the bug

I have a project with the following structure:

src
|-_data
|----projects.json
|-_includes
|----portfolio.njk

<ul>
    {% for project in projects %}
    <li>
        <p>{{ project.name  }}</p>
        <p>{{ project.data.description | i18n }}</p>

        {% for tech in project.data.tech %}
            <span class="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">{{ tech }}</span>
        {% endfor  %}
    <li>
    {% endfor %}
</ul>

In my index.njk I have the code:

...
<section>
   {% include "portfolio.njk" %}
</section>
...

When I render my application the data on projects.json don't show up.

What I'm doing wrong?

Solved. I little typo in my code.