getgrav / getgrav/grav-plugin-shortcode-owl-carousel

Twig code in owl-carousel shortcode

Open
#27 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
12
Forks
12
PR merge metrics
No merged PRs in 30d

Description

If I pack twig code within an OWL element, an empty carousel element is created for each div container.

I grab flex objects and go over them in a for loop. There are three elements in the flex.
```
{% set flex = grav.get('flex') %}
{% set directory = flex.directory('news') %}
{% set news = directory.collection() %}

[owl-carousel` items=1 margin=10 loop=false nav=true responsive={0:{items:1},600:{items:2},1000:{items:3}}]

{% for eintrag in news.filterBy({published: true}).limit(0, 10) %}


{{ eintrag.titel|e}}

{% endfor %}

[/owl-carousel]
```

The HTML-Output looks like this:
```








+ + + NEWS + + + SPECIAL + + +






+ + + NEWS + + + SPECIAL + + +







+ + + NEWS + + + NEWS + + +






```

I have no idea, where the `

`'s come from. It looks like a bug.

Many regards!

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Twig loop inside the OWL carousel shortcode using the provided Grav snippet, then inspect the generated carousel HTML and trace where the empty

elements are introduced. Done means the loop renders only the intended news elements without empty carousel items; verify the result against the reported output.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.