Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Empty include parameter when assign a forloop attribute to it. #9569

Open
srcid opened this issue Mar 27, 2024 · 0 comments
Open

[Bug]: Empty include parameter when assign a forloop attribute to it. #9569

srcid opened this issue Mar 27, 2024 · 0 comments

Comments

@srcid
Copy link

srcid commented Mar 27, 2024

Operating System

Ubuntu 22.04

Ruby Version

ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x86_64-linux]

Jekyll Version

jekyll 4.3.3

GitHub Pages Version

No response

Expected Behavior

I expect that assigned parameter to be not empty as the value passed can't be empty.

Current Behavior

Include parameter is empty when assigned a value from forloop attribute.

Relevant log output

No error on the build time.

Code Sample

If a pass the forloop it works, but if I pass a attribute of it, it doesn't work.

include code

<div>
    <h1>{{ index }}</h1>
    <h2>{{ forloop.index | append: ". " | append: paper.title }}</h2>
    <time class="text-slate-600" datetime="{{ page.date }}">
        {{ paper.date | date: "%d/%m/%Y" }}
    </time>
    <p>{{ paper.content | markdownify }}</p>
    <a class="not-prose btn btn-link float-right" href="{{paper.link}}" target="_blank" rel="noopener noreferrer">acessar</a>
</div>

where I'm calling it

---
layout: papers
title: "Publicações"
permalink: "/papers"
---

{% assign sorted_papers = site.papers | sort: 'date' | reverse %}
{%- for paper in sorted_papers -%}
    {% include paper_item.html index=forloop.index forloop=forloop paper=paper %}
{%- endfor -%}

Final result in browser

Screenshot from 2024-03-27 15-25-38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant