Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

cmegown/jekyll-transclude

Repository files navigation

jekyll-transclude

Update: I'd long since given up on trying to learn enough Ruby to try writing a plugin myself, but Hugo Manrique found a need for it and wrote a plugin.

A while back I created an issue in the official Jekyll repository to start a discussion around adding transclusion to the native include tag. The idea being that there are cases where you need to pass a block of formatted content to the included file, rather than just a simple string. While this is possible with capture blocks, this method relies on consistently using the same capture-include pattern in every instance, which seems prone to error.

I recommend reading through the issue thread but the feedback was essentially this: good idea for a new tag via plugin. Ok, great! Let's give it a shot:

  • Create a new transclude block tag.
  • This new tag will have the exact same functionality as include.
  • This new tag will allow a block of formatted content to be passed to the target file.
  • A new variable will be created to define a "transclusion slot" in the target file (e.g. transclude_content).

Proposed syntax:

{% transclude example.html %}
  <select>
    <option>Select...</option>
    <option>Alpha</option>
    <option>Bravo</option>
    <option>Charlie</option>
  </select>
{% endtransclude %}

Links

About

An attempt to prototype a new Jekyll tag.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published