~adnano/kiln-discuss

1

[question] Is it possible to pass parameters from the frontmatter to an HTML template?

Details
Message ID
<20210518100839.053456cb@shaka>
DKIM signature
pass
Download raw message
Hi!

In Jekyll it is possible to pass parameters from the frontmatter to
Liquid templates. In particular I am very interested in doing the
following through gmnitohtml:

post.gmi

---
title: Foo
params:
  description: bar
---

output.html

<meta name="description" content="{{ .Params.description }}" />

if this is already possible, could you be so kind as to tell me how to
do it?

Best regards.
-- 
«Si no puedo seguir el ritmo de todo lo que me vaya llegando, voy a
tratar de mantenerme al día de todo lo que pueda. Si no puedo responder
a todos los mensajes que deseo responder, responderé únicamente
algunos, a medida que me vayan llegando.»

Fingerprint: 026D B8BE 3F5C 1533 FF9D 4CC2 DBB4 A5B9 17E5 72DE
Details
Message ID
<CBGHY2L74WNU.L50LR72XRMJ8@nitro>
In-Reply-To
<20210518100839.053456cb@shaka> (view parent)
DKIM signature
pass
Download raw message
This should already be possible using the exact method you posted,
though it requires the use of HTML templates.

I assume you are using gmnitohtml as a postprocess command. Instead,
you can use it as a preprocess command and use kiln to layout the
content in a template, where you can then access the .Params field.

Your configuration could look something like:

	[[tasks]]
	input = [".gmi"]
	output = ".html"
	template = ".html"
	preprocess.gmi = "gmnitohtml"
	output_dir = "public/https"

And then you can rename your HTML template to base.html. You might also
need to create the page.html and index.html templates for pages and
indexes to be rendered, but you can leave them empty to use the
base.html template unchanged. Eventually you shouldn't need to create
these templates for the base template to be used.
Reply to thread Export thread (mbox)