Fluid error: wrong number of arguments

I am trying to create a simple Jekyll plugin:

class MonthlyArchives < Liquid::Tag def initialize(tag_name, text, tokens) super @text = text end def render(context) "#{@text} #{Time.now}" end end Liquid::Template.register_tag('monthly_archives1', Jekyll::MonthlyArchives) 

When I try to run it on the page as follows:

 {% monthly_archives1 %} 

I get a Liquid error: the wrong number of arguments (2 for 0). Any ideas?

+4
source share
1 answer

I had no chance to build something with Liquid, but the Jekyll wiki page about creating my own plugins has the whole class surrounded with the module before registering, which

 module Jekyll ...your code... end Liquid::Template.register_tag('monthly_archives1', Jekyll::MonthlyArchives) 

This can be a problem.

+2
source

All Articles