Including File Browser Plugin on page

I’m trying to use the file browser plugin on my page. The way the readme says to use the plugin is that each page has to be set to the file_browser_plugin.html.twig page template. I want to create 1 page with multiple different instances of the file browser. I have tried using {% include ‘plugins://file-browser/templates/file_browser_plugin.html.twig’ %}, but this results in a crash saying page not found. How can I have atleast 2 instances of the file browser on my page? I only can adjust the file browser page by editting the .html.twig in the plugin folder as well.

Sorry for bad english in advanced. Cheers.

@seanparko, The plugin is not intended to be use with multiple instances on a single page. It’s hardcoded to find only a single instance of each required HTML element.

Contact the author if you have a feature request.

By the way:

  • You shouldn’t include the mentioned template.
    That template extends `base.html.twig, hence including that template will duplicate the page’s entire structure.
  • Including a template is done differently:
    {% include 'file_browser_plugin.html.twig' %}

Okay, what about having individual pages with file browsers on them? How can I have multiple file_browser_plugin.html? Thanks for your help.

@seanparko, From your questions I sense a lack of insight in the concepts of Grav, at least about the working of templates and how templates are assigned to page files.

I think you’ve misinterpretted what I meant. If I only have 1 instance of file_browser_plugin.html.twig, and I can’t include the file browser in any other template instance, that means I can only have 1 page configuration with the file browser on it. Is there some way I can have multiple instances of that file so I can have different page layouts that have the file browser. Thank you.

@seanparko, That’s how the plugin has been designed… Its template is designed to be a toplevel page template and not as a partial that can be included in any other template like default, blog, modular/module.

Unfortunately, I’m not the author and not a user of the plugin. So I have not much more to contribute…

You could:

  • Create your own multiple versions of file_browser_plugin_xyz.html.twig and design them to your own liking.
  • Refactor the template into a partial.
  • Contact the author if you have a feature request.

Update: Issue created by OP: Trouble using it as a partial #19