Published 2020-10-03.
    Last modified 2024-07-26.
            
Time to read: 1 minutes.
 
  This page is part of the 
jekyll_plugins collection.
  Jekyll_basename_dirname is a Jekyll plugin that provides four filters, which return portions of a string:
basename– Filters a string containing a path, returning the filename and extension.dirname– Filters a string containing a path, returning the portion before the filename and extension.basename_without_extension– Filters a string containing a path, returning the filename without the extension.- 
    
wbr– Adds a <wbr> element after every "/" character in a string; this causes strings containing long paths to wrap in an HTML page. 
Installation
  Jekyll_basename_dirname is packaged as a Ruby gem.
  Add the following line to your Jekyll project’s Gemfile.
Gemfile
group :jekyll_plugins do gem 'jekyll_basename_dirname' end
  Install the jekyll_basename_dirname gem in the usual manner:
Shell
$ bundle
Syntax
HTML or markdown
{{ "blah/blah/filename.ext" | dirname }} => blah/blah
{{ "blah/blah/filename.ext" | basename }} => filename.ext
{{ "blah/blah/filename.ext" | basename_without_extension  }} => filename
{{ 'a/very/long/path/oh/so/very/long/filename.ext' | wbr }} => a/very/long/path/oh/so/very/long/filename.ext
{{ 'a/very/long/path/oh/so/very/long/filename.ext' | wbr | escape }} =>
a/<wbr>very/<wbr>long/<wbr>path/<wbr>oh/<wbr>so/<wbr>very/<wbr>long/<wbr>filename.ext