Skip to content

Extra <p> in collection list #3764

@jcubic

Description

@jcubic

Operating system

Fedora 41

Eleventy

3.0.0

Describe the bug

When you have a for loop and list of at least 2 elements from collection and render content of that collection, you end up with <p> inside <p> and when you add IdAttributePlugin in config you end up with empty <p></p> at the end of each list item.

NOTE: When there is only one element in the list, the <p> tags are correct. But when there are at least two elements in the list, the text before {{ post.content }} have its own <p> tag that makes the issue visible.

Reproduction steps

  1. clone repo https://github.com/jcubic/eleventy-p-tag
  2. npm install
  3. npx @11ty/eleventy --serve
  4. empty <p></p> in every list item

Expected behavior

No extra <p></p> tag at the end.
No <p> inside <p>.

Reproduction URL

https://github.com/jcubic/eleventy-p-tag

Screenshots

Image

Additional Notes

The project use Liquid templates. You can comment out the adding of IdAttributePlugin to observer nested <p> tag. I'm not sure if they are valid HTML.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions