What does "Liquid error: private method `gsub' called for nil:NilClass" mean on a posterous blog?
Asked Answered
L

1

6

I have faced an issue with this message on the right side of my blog. Could you please help me out?

Lawrence answered 13/6, 2010 at 5:47 Comment(0)
S
11

I just ran into this error too. You're probably running a liquid filter on a value that is coming up nil. I had something like this on my jekyll site:

<title>{{ page.title | xml_escape }}</title>

And on my root page, the title was not set. You can fix it by making sure that the value is set, or you can hack around with with something like this to force the nil into a string:

{{ page.title | append:' ' | xml_escape }}

Hope this helps you out.

Seavey answered 27/6, 2010 at 20:58 Comment(1)
Typically, you want to check if page.title exists. A better solution would be {% if page.title %} <title>{{ page.title | xml_escape }}</title>Picofarad

© 2022 - 2024 — McMap. All rights reserved.