Limit plugin to template

How can I limit the use of a plugin to a certain template?

Thanks in advance!

A plugin is always loaded, no matter if you ever need it or not. What exactly does the plugin do?

The plugin modify the headings adding and ID this is the link https://github.com/fitzage/headid
But I only want to use it on the blog template because it generates some conflicts in other pages.
I’ve seen before plugins that can be configured in php config to only act in some templates. Like footnotes https://github.com/distantnative/footnotes with this code

c::set('plugin.footnotes.templates.allow', array(
  'about',
  'blog',
  'project'
));

This is a general setup or a specific code of that plugin?

I often use a controller to feed the template with data.

Me too but how this apply to this case?

I’d just put an if statement in the kirbytext post filter.

Sorry I don’t understand.

Oh, forget about that suggestion :blush:

But you can put the plugin code into the template or controller where you want it to be effective, instead of using it as a plugin.

1 Like

Now it works!! Thanks!