Reputation: 996
Okay, I'm working with jekyll for 3 days now, so I'm stil a huge noob.
I would like to know if something like the following is possible.
I making a game, and I would like to add two different versions of the game. In one version you have acess to all tools, in the other version you have access to only 3 tools.
My page name is LevelX.html and is converted by jekyll to LevelX/index.html
Now I want one version of the game hosted there, and the other version I want to have hosted here: hard/LevelX/index.html
The difference between the two version is only one code of LevelX.html file, the one page should have:
parameters.customToolBar = "501 | 5 | 15 | 18 | 10 | 100001 | 100002 | 9 | 4 | 3 | 100003 | 53";
and the page with difficulty hard should have:
parameters.customToolBar = "501 | 5 | 15
Is it possible to easily add some line to my LevelX.html file so that jekyll will do exactly this ?
Upvotes: 0
Views: 206
Reputation: 52799
In your config.yml add :
#...
parameters:
customToolBar:
easy: "501 | 5 | 15 | 18 | 10 | 100001 | 100002 | 9 | 4 | 3 | 100003 | 53"
hard: "501 | 5 | 15"
Create a LevelX.html page
---
title: Level X Easy
layout: default
---
{# passing the easy toolbar #}
{% include _levelX.html customToolBar=site.customToolBar.easy %}
Create a hard/LevelX.html page
---
title: Level X Hard
layout: default
---
{# passing the hard toolbar #}
{% include _levelX.html customToolBar=site.customToolBar.hard %}
And finally the include (include/_levelX.html) :
{# transform you string to an array #}
{% assign toolBarArray = include.customToolBar | split: "|" %}
<ul>
{% for tool in toolBarArray %}
<li>{{ tool }}</li>
{% endfor %}
</ul>
Et voilà !
Upvotes: 1