getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
59 stars 95 forks source link

Generic compile extension plugin #164

Closed atiro closed 8 years ago

atiro commented 8 years ago

I'd like to add https://hypothes.is support to all pages on my site. It's a trivial addition of a JS include in the header, which I thought I would do cleanly by adding it as a plugin. However, short of hacking in:

site.template_hooks['extra_head'].append('')

directly into the markdown plugin, I can't identify how I can add it as a standalone plugin that it will run as part of the normal build. Is this possible ?

Kwpolska commented 8 years ago

IMO, this is not clean. There are better ways:

  1. Just add it to your conf.py file, which is the easiest way for a single line.
  2. Add it to your base.tmpl/base_helper.tmpl, which makes the most sense if you have a custom template.
  3. If you must, create a ConfigPlugin that uses template hooks. But the first two ideas are much simpler.