Closed digitalformula closed 3 years ago
Anyone?
hey, this is currently not supported, and I don't plan to add this feature, since this is not about custom fields, but about conditional rendering of the template.
perhaps you could try to achieve the same with CSS?
Hi - I'm not sure where else to post this, so hoping an issue is OK.
Can we add custom fields to
search.json
? For example, all my pages have "is_book: yes" or "is_book: no" and I'd like to pass that variable through tosearch.json
so that it can be evaluated when the JS is embedded. I'm also trying to pass a variable calledsubtitle
.For subtitle - using
{subtitle}
in the script just returns literally{subtitle}
even if the variable is set. Foris_book
I get a Javascript error that says "Uncaught TypeError: str.trim is not a function" on line 86 ofsimple-jekyll-search.json
, but that line is only triggered ifstr
is not false. That suggests the string is being passed through.Here's the relevant part of my
search.json
:Interestingly, if I make an intentional type and say
{{page.isbook}}
(incorrect variable name), the JS error is not thrown. That suggests it is something to with the parsing/evaluation of that specific variable. Having{{page.subtitle}}
there, while it doesn't work, doesn't throw an error.Then, in the markdown file that embeds the script, I'd like to use something like this:
Can that be done? If so, how?