Add some more docs on `include_relative`

This commit is contained in:
Garen Torikian 2014-09-07 21:24:05 -07:00
parent 0675f2a423
commit 5fe73a6671
1 changed files with 10 additions and 4 deletions

View File

@ -292,16 +292,22 @@ These parameters are available via Liquid in the include:
{% raw %}{{ include.param }}{% endraw %} {% raw %}{{ include.param }}{% endraw %}
{% endhighlight %} {% endhighlight %}
### Including files relative to another file #### Including files relative to another file
You can also choose to include files relative to the current file: You can also choose to include file fragments relative to the current file:
{% highlight ruby %} {% highlight ruby %}
{% raw %}{% include_relative somedir/footer.html %}{% endraw %} {% raw %}{% include_relative somedir/footer.html %}{% endraw %}
{% endhighlight %} {% endhighlight %}
You won't need to place your included content within the `_includes` directory. You won't need to place your included content within the `_includes` directory. Instead,
All the other capaibilities of the `include` tag are available to the `include_relative` tag. the inclusion is specifically relative to the file where the tag is being used. For example,
if `_posts/2014-09-03-my-file.markdown` uses the `include_relative` tag, the included file
must be within the `_posts` directory, or one of it's subdirectories. You cannot include
files in other locations.
All the other capaibilities of the `include` tag are available to the `include_relative` tag,
such as using variables.
### Code snippet highlighting ### Code snippet highlighting