Selaa lähdekoodia

Jekyll doesn't support includes with parameters

Even this is stated both in the Jekyll docs and Liquid docs... http://jekyllrb.com/docs/templates/#includes gives `{% include footer.html param=value variable-param=page.variable %}` as example - doesn't work. https://docs.shopify.com/themes/liquid-documentation/tags/theme-tags#multi-variable-snippet gives `{% include 'snippet', snippet_variable: 'this is it', snippet_variable_two: 'this is also it' %}` as example - doesn't work either. What kind of shitty software is this? What a unbelievable waste of time...
Daniel Rudolf 9 vuotta sitten
vanhempi
commit
da7ab2ecad
3 muutettua tiedostoa jossa 8 lisäystä ja 4 poistoa
  1. 2 1
      _includes/tocItem.html
  2. 2 1
      _includes/tocSubItems.html
  3. 4 2
      _layouts/docs.html

+ 2 - 1
_includes/tocItem.html

@@ -3,7 +3,8 @@
         {% if item[1]._title %}
             <a href="#{{ item[0] }}">{{ item[1]._title }}</a>
             <ul>
-                {% include tocSubItems.html subItems=item[1] %}
+                {% assign subItems = item[1] %}
+                {% include tocSubItems.html %}
             </ul>
         {% else %}
             <a href="#{{ item[0] }}">{{ item[1] }}</a>

+ 2 - 1
_includes/tocSubItems.html

@@ -4,7 +4,8 @@
             {% if subItem[1]._title %}
                 <a href="#{{ subItem[0] }}">{{ subItem[1]._title }}</a>
                 <ul>
-                    {% include tocSubItems.html subItems=subItem[1] %}
+                    {% assign subItems = subItem[1] %}
+                    {% include tocSubItems.html %}
                 </ul>
             {% else %}
                 <a href="#{{ subItem[0] }}">{{ subItem[1] }}</a>

+ 4 - 2
_layouts/docs.html

@@ -31,11 +31,13 @@
                             {% if page.collection %}
                                 {% for item in items %}
                                     {% if item.toc and item.nav > 0 %}
-                                        {% include tocItem.html toc=item.toc %}
+                                        {% assign toc = item.toc %}
+                                        {% include tocItem.html %}
                                     {% endif %}
                                 {% endfor %}
                             {% else %}
-                                {% include tocItem.html toc=page.toc %}
+                                {% assign toc = page.toc %}
+                                {% include tocItem.html %}
                             {% endif %}
                         </ul>