Suppress the use of "lang" in front mattter

bep is referring to a superfluous warning that we recently removed.

In your case, given this front matter in a .pdc file:

---
title: Post 1
lang: fr
---

Hugo emits this warning:

WARN deprecated: lang in front matter was deprecated in Hugo v0.144.0 and will be removed in a future release.

We emit a similar warning if you specify kind or path in front matter. We will continue to warn until approximately v0.159.0 at which point we will throw an error. More about deprecation here.

To pass a lang attribute when running the pandoc exec, you need to do this:

---
title: Post 1
params:
  lang: fr
---

Then create a pandoc filter:

map-lang.lua (base file name is irrelevant)
function Pandoc(doc)
  local meta = doc.meta
  if meta.params.lang then
    meta.lang = meta.params.lang
  end
  return doc
end

Then run pandoc with the filter. For example:

pandoc content/posts/post-1.pdc --lua-filter map-lang.lua --standalone 
3 Likes