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

Renders the Podlove Web Player for the current page’s episode, if it has an audio front matter key. This is a tag, not a filter — it reads the current page directly, no arguments needed.

{% podlove_player %}

The player’s share tab is always configured with every channel the player itself supports (Twitter, Facebook, WhatsApp, LinkedIn, Pinterest, Xing, mail, link) — this isn’t configurable per site or post.

If a WebVTT transcript file sits next to the episode’s audio (same basename, .vtt extension — e.g. episode1.mp3 → episode1.vtt in the episodes directory), it’s picked up automatically and fed to the player as its transcript, including Auphonic’s <v Speaker>text</v> voice-tag convention for per-cue speaker names. Use the transcript front matter key (see Post structure) if the transcript file doesn’t share the audio’s basename.

Each voice tag is shown as the speaker’s name above their part of the transcript, with a paragraph break at every change of speaker. To show full names and avatars instead, declare speakers in _config.yml (or per post in its front matter, which takes precedence):

speakers:
  - id: thomas
    name: Thomas Kahle
    voice: Thomas                        # matches <v Thomas>, defaults to name
    avatar: /assets/img/speakers/thomas.jpg

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"

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 feed URL

Returns the full URL of an episode feed: episodes.<episode_file_format>.rss within the root directory, unless episode_feed_permalinks in the _config.yml sets a different path for that format (see Configuration). The episode feed filters above and below use it, too.

{{ site | episode_feed_url:'mp3' }} => https://example.com/episodes.mp3.rss

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"/>

Line Awesome icons

Returns the HTML tags for a Line Awesome icon

{% icon la-camera-retro %} =>
<i class="las la-camera-retro"></i>

{% icon la-camera-retro la-lg %} =>
<i class="las la-camera-retro la-lg"></i>

Continue reading with The post structure.