Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How to disable plugins

Started by Muut Archive 11 years ago · 4 replies · 835 views
11 years ago

Hi, I 'm just trying out Grav for a personal blog site. So far I have got the git commit publishing working and I really like the lightweight feel of Grav.

However, I'm wondering how do I disable plugins on the blog page?
For example, I would like to disable the random plugin in the sidebar.
I found the partial and it checks to see if the plugin is enabled, so I tried adding various lines to my YAML front matter in my blog.md but none of them seems to disable the plugin.

I have tried the following in blog.md:

plugins:
random:
enabled: false

and also:

random:
enabled: false

Do I have to physically delete the random plugin folder or is there a way to disable it in config?

Thanks,

Charles

11 years ago

Hi Charles, I can confirm that your settings in blog.md doesn't work. However you can disable the random module (completely) by setting

TXT
enabled: false

in the user/plugins/random/random.yaml file.

11 years ago

Thanks for that, I will give it a try.

So is there really no way to disable a plugin for an individual page?

Also, I'm a little unsure which files I should or should not be changing? For example I searched on here about adding Google Analytics, and the answer seems to be modifying a partial within the theme. Isn't this going to get lost when the theme gets updated?

Similar to modifying the random plugin, won't those changes be lost if it ever gets updated?

Just trying to establish some best working practices to make my life easier in the future.

11 years ago

Certain plugins can be disabled for a certain page. This logic needs to be provided by the plugin itself. Smartypants for example has this capability:

https://github.com/getgrav/grav-plugin-smartypants#options

It requires the plugin to merge the page header with its regular configuration:

https://github.com/getgrav/grav-plugin-smartypants/blob/develop/smartypants.php#L88-L94

This is the preferred approach.

If you are looking to make modifications to the theme while still allowing upgradeability of said theme, you should read my blog post on theme inheritance

11 years ago

Ok thanks for the clarification.

Might be nice to see some more consistency in the behaviour of plugins in this respect, but the theme inheritance sounds great, I will switch over to this method.

Thanks for the help.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1318 9 years ago
Archive · by Muut Archive, 9 years ago
2 915 9 years ago
Archive · by Muut Archive, 9 years ago
2 4044 9 years ago
Archive · by Muut Archive, 9 years ago
1 2920 9 years ago
Archive · by Muut Archive, 9 years ago
3 1104 9 years ago