【问题标题】:How do I remove the .html extension from the output of cmsfn.link?如何从 cmsfn.link 的输出中删除 .html 扩展名?
【发布时间】:2020-05-13 04:32:07
【问题描述】:

cmsfn.link 模板函数在其输出中包含一个 .html 扩展。

例如:

${cmsfn.link(exampleNode)}

输出:

https://examplesite.com/example-page.html

如何删除.html 扩展?

【问题讨论】:

    标签: freemarker magnolia


    【解决方案1】:

    很遗憾,这无法通过 Magnolia 配置和 Magnolia "won't be able to address this issue in the foreseeable future" 完成。但是有三个 FreeMarker 内置选项:

    选项 1:replace

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

    选项 2:split

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

    选项 3:remove_ending

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-20
      • 1970-01-01
      • 1970-01-01
      • 2013-01-09
      • 2017-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多