verbb / comments

A Craft CMS plugin for managing comments directly within the CMS.
Other
137 stars 33 forks source link

Unable to find the template in "_includes/avatar" #297

Closed vonscriptor closed 3 months ago

vonscriptor commented 3 months ago

Describe the bug

I'm trying to {% include '_/partials/example' %} from inside _comments/_includes/avatar.twig and get the following error: Unable to find the template “_/partials/example” in "_includes/avatar" at line 20.

Steps to reproduce

  1. Use Custom Templates
  2. Try to include a template that lives outside the templateFolderOverride location

Craft CMS version

4.8.2

Plugin version

2.0.11

Multi-site?

No

Additional context

No response

engram-design commented 3 months ago

So yes, it's going to try and find that template relative to _comments, because that acts as the template root.

Using the commentsSiteInclude() Twig function should work to resolve that, and is identical to the include tag.

{{ commentsSiteInclude('_/partials/example') }}
vonscriptor commented 3 months ago

Perfect, that worked. I didn't see that mentioned in the docs, so might be nice to add! 😁 Thanks!