在具有变体的共享点发布网站中自定义面包屑

发布于 2024-07-24 06:29:51 字数 183 浏览 3 评论 0原文

我有一个具有变体的 Sharepoint 发布网站。 默认情况下,面包屑显示如下:

Variation Root > 英文网站> 某些页面 我想要显示的是: “家”> 某些页面,其中主页指向英文站点根目录。

有没有办法在不创建自定义服务器控件的情况下实现此目的?

I have a Sharepoint publishing site with variations.
The breadcrumb by default shows this:

Variation Root > English Site > Some Page
What I want to display is:
"Home" > Some Page, where Home points to the English site root.

Is there a way to achieve this withouth creating a custom server control to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

背叛残局 2024-07-31 06:29:51

如果您知道确切的级别数,则可以使用 SiteMapPath,例如:

<asp:SiteMapPath runat="server" ParentLevelsDisplayed="1" />

否则,SiteMapPath 总是直接返回当前正在使用的 SiteMapProvider,并且您可能可以挂钩 SiteMapPath 的渲染并进行检查,例如:

protected void SiteMapPath_ItemCreated(object sender, SiteMapNodeItemEventArgs e)
{
    if (e.Item.ItemType == SiteMapNodeItemType.Root ||         
       (e.Item.ItemType == SiteMapNodeItemType.PathSeparator && 
        e.Item.ItemIndex == 1))
    {
        e.Item.Visible = false;
    }
}

这将使您使用 SiteMapPath不显示根节点(和第一个分隔符)。

如果希望您的节点显示“Home”,您可以绑定另一个值,例如:

<asp:SiteMapPath ID="siteMapPath" runat="server"
    Pathseparator="/"
    OnItemCreated="SiteMapPath_ItemCreated">

<NodeTemplate>
    <a href='<%# Eval("url") %>'><%# Eval("description") %></a>
</NodeTemplate>

<CurrentNodeTemplate>
    <%# Eval("title") %>
</CurrentNodeTemplate>    

</asp:SiteMapPath>

如果描述具有将显示的“Home”值。

If you know the exact number of levels you can use a SiteMapPath like:

<asp:SiteMapPath runat="server" ParentLevelsDisplayed="1" />

Otherwise the SiteMapPath always goes direcly agains the SiteMapProvider currently in use and you can probably hook into the rendering of the SiteMapPath a do a check, like:

protected void SiteMapPath_ItemCreated(object sender, SiteMapNodeItemEventArgs e)
{
    if (e.Item.ItemType == SiteMapNodeItemType.Root ||         
       (e.Item.ItemType == SiteMapNodeItemType.PathSeparator && 
        e.Item.ItemIndex == 1))
    {
        e.Item.Visible = false;
    }
}

that will make you SiteMapPath not showing the rootnode (and the first separator).

and if would like your node to display "Home" you can bind against another value, something like:

<asp:SiteMapPath ID="siteMapPath" runat="server"
    Pathseparator="/"
    OnItemCreated="SiteMapPath_ItemCreated">

<NodeTemplate>
    <a href='<%# Eval("url") %>'><%# Eval("description") %></a>
</NodeTemplate>

<CurrentNodeTemplate>
    <%# Eval("title") %>
</CurrentNodeTemplate>    

</asp:SiteMapPath>

if description has a value of "Home" that will be shown.

仅冇旳回忆 2024-07-31 06:29:51

最近,我创建了几个新的菜单控件来解决这个问题。 我的控件接受自定义 ~Variation/ 标记作为起始节点,以便您可以创建从变体的主页而不是网站集的根开始的面包屑。
您可以找到更多信息@ http://blog.mastykarz.nl/templates -based-menu-control-sharepoint/

Just recently I have created a couple of new menu controls which address this issue. My controls accept the custom ~Variation/ token as the StartingNode so that you can create a breadcrumb that starts with the home of your variation rather than the root of your Site Collection.
You can find more information @ http://blog.mastykarz.nl/templates-based-menu-control-sharepoint/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文