从cmsfn.link输出中删除.html扩展名?

问题描述 投票:0回答:1

cmsfn.link模板功能在其输出中包含cmsfn.link扩展名。例如:

.html

如何删除${cmsfn.link(exampleNode)} → https://examplesite.com/example-page.html 扩展名?

freemarker magnolia
1个回答
0
投票

[不幸的是,这不能通过Magnolia配置和.html完成。因此,您有多个FreeMarker内置选项:

选项1:替换

they have no plans to create this functionality anytime soon

来源: ${cmsfn.link(exampleNode)?replace(".html", "")}

选项2:拆分

https://freemarker.apache.org/docs/ref_builtins_string.html#ref_builtin_replace

来源: ${cmsfn.link(exampleNode)?split(".html")[0]}

选项3:remove_ending

https://freemarker.apache.org/docs/ref_builtins_string.html#ref_builtin_split

来源: ${cmsfn.link(exampleNode)?remove_ending(".html")}

© www.soinside.com 2019 - 2024. All rights reserved.