I have an directory called /patterns
in my Jekyll site, whose structure generally looks generally like this:
_includes
_layouts
_site
/patterns
index
I improved the plugin that @Jeremy Lynch referred to. Here is the documentation:
include_absolute
Jekyll's built-in include
tag does not support including files outside of the _includes
folder.
This plugin supports 4 types of includes:
/
)..
or /
).~
).PATH
(preface with !
).{% include_absolute path [ optionalParam1='yes' optionalParam2='green' ] %}
The optional parameters can have any name. The included file will have parameters substituted.
Copy include_absolute.rb
into /_plugins
and restart Jekyll.
Include files without parameters; all four types of includes are shown.
{% include_absolute '../../folder/outside/jekyll/site/foo.html' %}
{% include_absolute 'folder/within/jekyll/site/bar.js' %}
{% include_absolute '/etc/passwd' %}
{% include_absolute '~/.ssh/config' %}
Include a file and pass parameters to it.
{% include_absolute '~/folder/under/home/directory/foo.html' param1='yes' param2='green' %}