
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
octopress-include-tag
Advanced tools
This replaces Jekyll's include tag and adds support for conditional rendering, in-line filters and including partials from Octopress Ink plugins.
If you're using bundler add this gem to your site's Gemfile in the :jekyll_plugins
group:
group :jekyll_plugins do
gem 'octopress-include-tag'
end
Then install the gem with Bundler
$ bundle
To install manually without bundler:
$ gem install octopress-include-tag
Then add the gem to your Jekyll configuration.
gems:
-octopress-include-tag
Use this just like the regular Jekyll include tag.
{% include foo.html %} // renders _includes/foo.html
{% include foo.html happy="yep" %} // samea as above but {{ include.happy }} == "yep"
Include partials stored as a variable.
{% assign post_sidebar = "post_sidebar.html" %}
{% include post_sidebar %} // renders _includes/post_sidebar.html
Include partials conditionally, using if
, unless
and ternary logic.
{% include sidebar.html if site.theme.sidebar %}
{% include comments.html unless page.comments == false %}
{% include (post ? post_sidebar : page_sidebar) %}
Filter included partials.
{% include foo.html %} //=> Yo, what's up
{% include foo.html | upcase %} //=> YO, WHAT'S UP
Yes, it can handle a complex combination of features… but can you?
{% include (post ? post_sidebar : page_sidebar) | smart_quotes unless site.theme.sidebar == false %}
It's easy to include a partial from an Ink theme or plugin.
Here's the syntax
{% include [plugin-slug]:[partial-name] %}
Some examples:
{% include theme:sidebar.html %} // Include the sidebar from a theme plugin
{% include twitter:feed.html %} // Include the feed from a twitter plugin
Plugins and themes use this tag internally too. For example, the octopress-feeds plugin uses the include tag to render partials for the RSS feed.
{% for post in site.articles %}
<entry>
{% include feeds:entry.xml %}
</entry>
{% endfor %}
If you want to make a change to the entry.xml
partial, you could create your own version at _plugins/feeds/includes/entry.xml
.
Now whenever {% include feeds:entry.xml %}
is called, the include tag will use your local partial instead of the plugin's partial.
Note: To make overriding partials easier, you can copy all of a plugin's partials to your local override path with the Octopress Ink command:
$ octopress ink copy [plugin-slug] [options]
To copy all includes from the feeds plugin, you'd run:
$ octopress ink copy feeds --includes
This will copy all of the partials from octopress-feeds to _plugins/feeds/includes/
. Modify any of the partials, and delete those that you want to be read from the plugin.
To list all partials from a plugin, run:
$ octopress ink list [plugin-slug] --includes
Note: When a plugin is updated, your local partials may be out of date, but will still override the plugin's partials. Be sure to watch changelogs and try to keep your modifications current.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that octopress-include-tag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.