kentico v9页面别名没有按预期工作(kentico v9 page alias not working as expected)

编程入门 行业动态 更新时间:2024-10-28 17:23:14
kentico v9页面别名没有按预期工作(kentico v9 page alias not working as expected)

我有一个自定义页面类型和两个转换的转发器。 第一个转换在表格布局中列出我的自定义页面。 我的选定项目转换使用相同的模板来显示页面详细信息。 本节“CEO Direct”位于名为Auxiliary Nav的节点内。

例如,这是测试的URL: http:// localhost:8080 / Auxiliary-Nav / CEO-Direct / Questions / test.aspx

我原以为: http:// localhost:8080 / CEO-Direct / Questions / test.aspx

辅助导航节点已取消选中显示导航和站点地图。

这也影响了我的搜索结果,所以我希望一举两得。

这是一个显示URL和面包屑的屏幕截图:

I have a repeater with a custom page type and two transformations. The first transformation list my custom pages in a table layout. My Selected Item Transformation uses the same template to show the page details. This section 'CEO Direct' sits within a node named Auxiliary Nav.

For example, this is the URL for a test: http://localhost:8080/Auxiliary-Nav/CEO-Direct/Questions/test.aspx

I was expecting it to be: http://localhost:8080/CEO-Direct/Questions/test.aspx

The Auxiliary Nav node has show navigation and site map unchecked.

This also affect my search results, so i'm hoping to kill two birds with one stone.

Here's a screen shot showing the URL and the breadcrumbs:

最满意答案

Josh是正确的,您需要编写一个宏来选择路径中存在的第一个Node Alias。

虽然编写自定义宏方法可能更干净并且允许您重复使用,但您可以暂时使用以下宏:

{%(CurrentDocument.Aliases.Count> 0?CurrentDocument.Aliases.FirstItem.AliasURLPath:CurrentDocument.RelativeURL)#%}

请注意,上面只会抓住第一条路径,没有真正的Alias Ordering,所以如果你把它放在1以上,它可能会抢到最新的。

Josh is correct, you need to write a macro that will pick the first Node Alias is present for the path.

Although writing a custom macro method may be cleaner and will allow you to re-use, you can use the following macro for the time being:

{% ( CurrentDocument.Aliases.Count > 0 ? CurrentDocument.Aliases.FirstItem.AliasURLPath : CurrentDocument.RelativeURL) #%}

Note that the above will just grab the first path, there isn't really Alias Ordering so if you put more than 1, it will probably grab the most recent.

更多推荐

本文发布于:2023-07-28 12:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1305224.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:别名   页面   工作   kentico   alias

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!