Liquid Filters

Because Jekyll uses Liquid for template processing, jekyll-octopod does so, too. Along with the standard liquid tags and filters, Jekyll adds a few of its own and jekyll-octopod adds a few more which are documented on this page.

Filters

CDATA escape

Escapes some text for CDATA

{{ page.content | cdata_escape }}

JSON escape

Escapes HTML entities in JSON strings.

{{ page.some_string | j }}

Expand URLs

Replaces relative urls with full urls

{{ "about.html" | expand_urls }}             => "/about.html"
{{ "about.html" | expand_urls:site.url }}    => "http://example.com/about.html"

Remove Script and Audio tags

Removes unwanted tags from shownotes

{{ page.content | remove_script_and_audio }}

Http Only

changes url from requesting https to http

{{ url | http_only }} => "http://..."

Time to RSS schema

Formats a Time to be RSS compatible.

{{ site.time | time_to_rssschema }} => "Wed, 15 Jun 2005 19:00:00 GMT"

Otherwise

Returns the first argument if it’s not nil or empty — otherwise it returns the second one.

{{ post.author | otherwise:site.author }}

Select audio file from hash

Returns the value of a given hash. If no key is given as a second parameter, it first tries “mp3”, then “m4a” and then it will return a more or less random value.

{{ post.audio | audio:"m4a" }} => "my-episode.m4a"

MIME type

Returns the MIME-Type of a given file format.

{{ "opus" | mime_type }} => "ogg; codecs=opus"

File size

Returns the size of a given file in bytes. If there is just a filename without a path, this method assumes that the file is an episode audio file which lives in /episodes.

{{ "example.m4a" | file_size }} => 4242

Size By Format

Returns the size of a given file in bytes by looking into the front matter The sizes in bytes should be in the front matter for remotely hosted files:

filesize:
   mp3: 123456
   ogg: 234567
   m4a: 345678
{{ "example.m4a" | size_by_format: "mp3" }} => 4242

In Megabytes

Converts a size in Bytes to Megabytes

{{ 123456 | in_megabytes }} => 0.1 MB

Slug

Returns a slug based on the id of a given page.

{{ page | slug }} => '2012_10_02_octopod'

Split chapter

Splits a chapter, like it is written to the post YAML front matter, into the components ‘start’ — which refers to a single point in time relative to the beginning of the media file — and ‘title’ — which defines the text to be the title of the chapter.

{{ '00:00:00.000 Welcome to Octopod!' | split_chapter }} =>
                    { 'start' => '00:00:00.000', 'title' => 'Welcome to Octopod!' }
{{ '00:00:00.000 Welcome to Octopod!' | split_chapter:'title' }}  => 'Welcome to Octopod!'
{{ '00:00:00.000 Welcome to Octopod!' | split_chapter:'start' }}  => '00:00:00.000'

Audio tag

Returns an <audio> tag for a given page with <source> tags in it for every audio file in the page’s YAML front matter.

{{ page | audio_tag:site }}

Web player

Returns the web player for the episode of a given page.

{{ page | podigee_player:site }}

String of duration

Gets a number of seconds and returns a human readable duration string of it.

{{ 1252251 | string_of_duration }} => "00:03:13"

String of size

Gets a number of bytes and returns a human readable string of it.

{{ 1252251 | string_of_size }} => "1.19M"

Host from URL

Returns the host of a given url

{{ 'https://github.com/pattex/octopod' | host_from_url }} => "github.com"

Disqus configuration

Generates the config for disqus integration. If a page object is given, it generates the config variables only for this page. Otherwise, it only generates the global config variables.

{{ site | disqus_config }}
{{ site | disqus_config:page }}

SHA1

Returns the hex-encoded hash value of a given string. The optional second argument defines the length of the returned string.

{{ "Octopod" | sha1 }}    => "8b20a59c"
{{ "Octopod" | sha1:23 }} => "8b20a59c8e2dcb5e1f845ba"

Returns a ready-to-use navigation list of all pages that have navigation set in their YAML front matter. The list is sorted by the value of navigation.

{{ site | navigation_list:page }}

Episode feeds

Returns an array of all episode feeds named by the convention episodes.<episode_file_format>.rss within the root directory. Also it contains all additional feeds specified by additional_feeds in the _config.yml. If an episode_file_format or key of additional_feeds equals the optional parameter, it will be skipped.

{{ site | episode_feeds }}
{{ site | episode_feeds:mp3 }}

Episode feeds HTML

Returns HTML links to all episode feeds named by the convention episodes.<episode_file_format>.rss within the root directory. Also it returns all additional feeds specified by additional_feeds in the _config.yml. If an episode_file_format or key of additional_feeds equals the optional parameter, it will be skipped.

{{ site | episode_feeds_html:'m4a' }} =>
<link rel="alternate" type="application/rss+xml" title="mp3 Episode RSS-Feed"
      href="/episodes.mp3.rss" />
<link rel="alternate" type="application/rss+xml" title="Torrent Feed m4a"
      href="http://bitlove.org/octopod/octopod_m4a/feed" />
<link rel="alternate" type="application/rss+xml" title="Torrent Feed mp3"
      href="http://bitlove.org/octopod/octopod_mp3/feed" />

Episode feeds RSS

Returns RSS-XML links to all episode feeds named by the convention episodes.<episode_file_format>.rss within the root directory. Also it returns all additional feeds specified by additional_feeds in the _config.yml. If an episode_file_format or key of additional_feeds equals the optional parameter, it will be skipped.

{{ site | episode_feeds_rss:'m4a' }} =>
<atom:link rel="alternate" href="/episodes.mp3.rss"
           type="application/rss+xml" title="mp3 Episode RSS-Feed"/>
<atom:link rel="alternate" href="http://bitlove.org/octopod/octopod_m4a/feed"
           type="application/rss+xml" title="Torrent Feed m4a"/>
<atom:link rel="alternate" href="http://bitlove.org/octopod/octopod_mp3/feed"
           type="application/rss+xml" title="Torrent Feed mp3"/>

Font Awesome icons

Returns the HTML tags for a font awesome icon

{% icon fa-camera-retro %} =>
<i class="fas fa-camera-retro"></i>

{% icon fa-camera-retro fa-lg %} =>
<i class="fas fa-camera-retro fa-lg"></i>

Continue reading with The post structure.