Skip to content

Ability to pass in extra contexts for liquid templates #114

@ribose-jeffreylau

Description

@ribose-jeffreylau

Motivation

In the process of converting existing Jekyll liquid templates into Relaton's vanilla liquid templates, I found the need to supply data that was not provided in build_liquid_document():

hash_to_liquid(
depth: 2,
css: stylesheet,
title: bibcollection.title,
date: Date.today.to_s,
metanorma_v: mnv.lines.first&.strip,
author: bibcollection.author,
documents: document_items(bibcollection)
)

Examples include the domain name of the deployed site, for the construction of the canonical URL link element.

Proposals

A. Add a CLI param that accepts a YAML / JSON file, which will be merged into the arguments for hash_to_liquid(...), making its contents available inside custom liquid templates.
B. Allow contents from metanorma.yml to be passed to hash_to_liquid(...).

To me, proposal B sounded simpler (initially), but metanorma.yml is not an input of Relaton, so the proposal reduces to proposal A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions