如何在我的json模式中使用nunjucks set?
{
"@context": "https://schema.org",
"@type": "WebSite",
"url": "{{ metadata.url }}",
"potentialAction": {
"@type": "SearchAction",
"target": "{{ metadata.url }}/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
像这样使用:
<script type="application/ld+json">
{{ search | jsonMinify | safe }}
</script>
注意:我想用它来启用pretty-data的json缩小功能。
抱歉,在nunjucks github issues处解决了!