-
Is it possible to use filters inside a frontmatter? The previous version has a Transform Content feature that I use to translate emails. Example: ---
title: <raw i18n>Title</raw>
--- I've migrated from I may try to write a custom posthtml plugin, but maybe there is an easier way. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
PostHTML tags don't work inside Front Matter, but you can use a function instead: // config.js
module.exports = {
// ...
uppercase: string => string.toUpperCase()
} ---
title: "{{{ page.uppercase('Some title') }}}"
--- Notice how the variable must be wrapped in double quotes You can also nest the // config.js
module.exports = {
// ...
locals: {
uppercase: string => string.toUpperCase(),
},
} ---
- title: "{{{ page.uppercase('Some title') }}}"
+ title: "{{{ uppercase('Some title') }}}"
--- |
Beta Was this translation helpful? Give feedback.
PostHTML tags don't work inside Front Matter, but you can use a function instead:
Notice how the variable must be wrapped in double quotes
""
.You can also nest the
uppercase
function in alocals
object if you don't like to call if off thepage
object: