【发布时间】:2020-07-23 23:46:08
【问题描述】:
我希望能够使用“||”上下文中的 OR 运算符
在架构中,如果字段中的值不是作者,我需要从 JCR 内容中提取两个日期
<script type="application/ld+json" >
"datePublished": "${properties.datePublishedArticle @context="html" ||'yyyy-MM-dd' @ format=currentPage.lastModified }",
"dateModified": "${properties.dateModifiedArticle @ context="html" || 'yyyy-MM-dd' @ format=currentPage.lastModified}"
</script>
org.apache.sling.api.scripting.ScriptEvaluationException:
mismatched input '@' expecting {'}', '.', 'in', '&&', '||', ',', '['} in line 67 where datepublished is located.
换句话说,如果作者没有编写值,它将从 jcr 内容中获取值。单独完成时它们工作正常。 不明白所指示的错误。
【问题讨论】: