Skip to content

liquid.filters.jekyll

module

liquid.filters.jekyll

Provides jekyll filtersSee: https://jekyllrb.com/docs/liquid/filters/

Functions
  • absolute_url(env, value) Get absolute url based on site.baseurl</>
  • array_to_sentence_string(array, connector) (str) Join an array of things into a string by separating with commas and theword "and" for the last one. </>
  • cgi_escape(input) (str) CGI escape a string for use in a URL. Replaces any special characterswith appropriate %XX replacements. </>
  • date_to_xmlschema(env, value) Convert date to xml schema format</>
  • find(value, attr, query) Find elements from array using attribute value</>
  • find_exp(env, value, item, expr) Find elements using expression</>
  • group_by_expr(env, value, item, expr) Group by data using expression</>
  • jekyll_slugify(input, mode) (str) Slugify a string</>
  • jekyll_sort(array, prop, none_pos) Sort an array in a reverse way by default.</>
  • jsonify(input) (str) Convert the input into json string</>
  • markdownify(value) Markdownify a string</>
  • normalize_whitespace(value) Replace multiple spaces into one</>
  • number_of_words(input, mode) (int) Count the number of words in the input string.</>
  • relative_url(env, value) Get relative url based on site.baseurl</>
  • sample(value, n) Sample elements from array</>
  • uri_escape(input) (str) URI escape a string.</>
  • where_exp(env, value, item, expr) Where using expression</>
  • xml_escape(input) (str) Convert an object into its String representation</>
function

liquid.filters.jekyll.relative_url(env, value)

Get relative url based on site.baseurl

function

liquid.filters.jekyll.absolute_url(env, value)

Get absolute url based on site.baseurl

function

liquid.filters.jekyll.date_to_xmlschema(env, value)

Convert date to xml schema format

function

liquid.filters.jekyll.where_exp(env, value, item, expr)

Where using expression

function

liquid.filters.jekyll.find(value, attr, query)

Find elements from array using attribute value

function

liquid.filters.jekyll.find_exp(env, value, item, expr)

Find elements using expression

function

liquid.filters.jekyll.group_by_expr(env, value, item, expr)

Group by data using expression

function

liquid.filters.jekyll.xml_escape(input)

Convert an object into its String representation

Parameters
  • input (str) The object to be converted
Returns (str)

The converted string

function

liquid.filters.jekyll.cgi_escape(input)

CGI escape a string for use in a URL. Replaces any special characterswith appropriate %XX replacements.

Parameters
  • input (str) The string to escape
Returns (str)

The escaped string

function

liquid.filters.jekyll.uri_escape(input)

URI escape a string.

Parameters
  • input (str) The string to escape
Returns (str)

The escaped string

function

liquid.filters.jekyll.jsonify(input)

Convert the input into json string

Parameters
  • input (any) The Array or Hash to be converted
Returns (str)

The converted json string

function

liquid.filters.jekyll.array_to_sentence_string(array, connector='and')

Join an array of things into a string by separating with commas and theword "and" for the last one.

Parameters
  • array (sequence of str) The Array of Strings to join.
  • connector (str, optional) Word used to connect the last 2 items in the array
Returns (str)

The formatted string.

function

liquid.filters.jekyll.jekyll_slugify(input, mode='default')

Slugify a string

Note that non-ascii characters are always translated to ascii ones.

Parameters
  • input (str) The input string
  • mode (str, optional) How string is slugified
Returns (str)

The slugified string

function

liquid.filters.jekyll.number_of_words(input, mode=None)

Count the number of words in the input string.

Parameters
  • input (str) The String on which to operate.
  • mode (str, optional) Passing 'cjk' as the argument will count every CJK characterdetected as one word irrespective of being separated by whitespace. Passing 'auto' (auto-detect) works similar to 'cjk'
Returns (int)

The word count.

function

liquid.filters.jekyll.markdownify(value)

Markdownify a string

function

liquid.filters.jekyll.normalize_whitespace(value)

Replace multiple spaces into one

function

liquid.filters.jekyll.jekyll_sort(array, prop=None, none_pos='first')

Sort an array in a reverse way by default.

Note that the order might be different than it with ruby. For example, in python "1abc" > "1", but it's not the case in jekyll. Also, it's always in reverse order for property values.

Parameters
  • array The array
  • prop (str, optional) property name
  • none_pos (str, optional) None order (first or last).
Returns

The sorted array

function

liquid.filters.jekyll.sample(value, n=1)

Sample elements from array