latest 20 messages by jxf
+
[2016-04-30T18:53:27Z]
jxf
Is there a way to interpolate a variable into a Liquid block? For example, if `type: event` is in your frontmatter, is there a way to do {% assign item_type = {{ page.type }} %}?
+
[2016-04-30T18:36:13Z]
jxf
sounds like Jekyll's already parsed it by the time you ask for {{ content }}, and it's in a new context so it doesn't know about your variables anymore
+
[2016-04-30T18:35:49Z]
jxf
when you say "page inline variables are part of {{ content }}" do you mean that it's basically too late if you write "{% assign ..." in the content for a page and expect it to be available?
+
[2016-04-30T18:34:36Z]
jxf
@jaybe they're just document collections
+
[2016-04-30T17:25:35Z]
jxf
the plugin approach seems to work well though
+
[2016-04-30T17:25:21Z]
jxf
jaybe: lol, you're not under any obligation to help. I'm just hacking on this for fun on a weekend 8)
+
[2016-04-30T17:05:50Z]
jxf
We have one layout, `showcase`, and two pages, `animals` and `recipes`. If we set a variable in the pages using `{% assign ... %}`, the `showcase` layout doesn't seem to know about it.
+
[2016-04-30T17:04:36Z]
jxf
https://gist.github.com/fj/9276812e01534b194083109bd48645fc
+
[2016-04-30T17:00:42Z]
jxf
I'll make a gist and maybe that'll make it clearer.
+
[2016-04-30T16:58:14Z]
jxf
I'll probably just write a quick plugin so I can store some metadata and have the layout check for it.
+
[2016-04-30T16:57:55Z]
jxf
So if I have N different possible values, that `if` block needs to explicitly check for each possibility. That seems kind of brittle. It's too bad there isn't an easier way to just pass it.
+
[2016-04-30T16:51:57Z]
jxf
Yes, but the value I want to use is different between `foo` and `bar`. It is a variable -- foo uses site.collection_one, bar uses site.collection_two.
+
[2016-04-30T16:50:55Z]
jxf
jaybe: OK, but if I want to assign `site.some_collection` (a collection of objects, not a string) to a variable that a layout can use, how do I do that? I can't put the Liquid in the frontmatter because it'll be interpreted as a string. And I can't pass the variable to the layout outside of frontmatter because it's lost when I do so.
+
[2016-04-30T16:27:53Z]
jxf
I think the problem is that if I use frontmatter it's converted to a string and I can't do anything else to it. I want the object and not the literal string.
+
[2016-04-30T16:27:27Z]
jxf
@jaybe Hmm... but then I can't use Liquid filters, right? I'd like to be able to write: {% assign some_var = site.some_collection | sort: 'date_range' %}.
+
[2016-04-30T16:20:06Z]
jxf
(By "a variable", I mean that it's created with {% assign some_var = ... %}.)
+
[2016-04-30T16:19:43Z]
jxf
I have two pages `foo.html` and `bar.html` that call a common layout, `layout.html`. I want to pass a variable that's set differently in the pages to the layout. Is that possible?
+
[2015-04-20T06:11:44Z]
jxf
I have an array of strings that I'm looping over. I'd like to add one element to the array before I start. Is that possible? That is, I have `{% for t in page.tags %} ...` and I want to add, e.g., "foo" as the first item in the list of tags. In Ruby I'd just do this with `t + page.tags` and get the result -- what's the right way to do this in Jekyll?
+
[2015-04-15T19:25:57Z]
jxf
namespace: I'm not ignoring you, I'm working and only sporadically checking here :)
+
[2015-04-15T19:13:41Z]
jxf
what's a file that's getting copied that you think shouldn't be getting copied as-is?