You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apparently, in certain situations the content is not coming through as String. The error that gets thrown is:
`Error` was thrown:
Error: cheerio.load() expects a string
The crux of the problem, in the words of @netmikey
I found out that this happens when you try to use content on a content template itself. I guess you have to use this outside the content, e.g. on the layout template.
Solution
Need to find out what kind of object content is when used in a content file. Then turn it into the expected string (if possible) before passing it to cheerio.
The text was updated successfully, but these errors were encountered:
Eleventy doesn't have a content variable available inside a content file. In a content file, it's undefined: content doesn't exist until a layout template has incoming content to process. If you've got ideas on how to handle this better, I'd love to hear how you're aiming to solve it. Thanks!
It's not something I personally have a problem with, but recorded the issue so that it can be tracked and hopefully a solution can be reached.
If there is no content available in the content file, perhaps documentation for other approaches is the best solution. For example, adding something like this to the READMEs: jdsteinbach#21 (comment)
Background
This comes from an issue in the upstream fork:
jdsteinbach#21
Problem
Apparently, in certain situations the
content
is not coming through as String. The error that gets thrown is:The crux of the problem, in the words of @netmikey
Solution
Need to find out what kind of object
content
is when used in a content file. Then turn it into the expected string (if possible) before passing it to cheerio.The text was updated successfully, but these errors were encountered: