更改Umbraco中活动语言的URL 7

问题描述:

我使用Umbraco 7.7制作一个站点,并且我有一个如下所示的内容树。更改Umbraco中活动语言的URL 7

Content Tree

使用Vorto新闻(图像呼号)为所有语言版本作出(目前只有荷兰语版本)

问题是新闻页面的网址。现在,它看起来像这样:

http://localhost/data/nieuws 

我会喜欢这个改变为:

http://localhost/nl/nieuws 

或者,如果我有一个其他语言:

http://localhost/en/news 

这还必须为工作新闻儿童页面。例如:

http://localhost/nl/nieuws/nieuwe-directeur 
http://localhost/en/news/new-CEO 

我试图做一个属性别名为umbracoUrlName但只改变URL的最后一部分,它不可能为其他语言的同一页创建多个网址。

这是结果。我已经输入本文nl/nieuws和URL被改变本作的新闻页面:

http://localhost/data/nlnieuws 

我也尝试了Vorto编辑器为多国语言,但我有这个网址:

http://localhost:51086/data/values-nl-benlnieuws-dtdguid36eceba8-82ce-4362-954b-a870c65adfc1/ 

我应该如何改变依赖于actieve语言的URL

您需要,如果你想个创建自定义UrlProviderContentFinder在。

public class DataUrlProvider : IUrlProvider 
{ 
    public virtual string GetUrl(UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode) 
    { 
     throw new NotImplementedException(); 
    } 

    public virtual IEnumerable<string> GetOtherUrls(UmbracoContext umbracoContext, int id, Uri current) 
    { 
     throw new NotImplementedException(); 
    } 
} 

public class DataContentFinder : IContentFinder 
{ 
    public bool TryFindContent(PublishedContentRequest contentRequest) 
    { 
     throw new NotImplementedException(); 
    } 
} 

实现并不复杂,但也不是那么容易,对于这个答案来说太长了。

为了给你一个想法如何去做检查这个博客帖子:

https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/

+0

发现了一把umbraco论坛更简单的答案。检查这个链接:https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/88635-change-url-dependent-of-the-active-language-in-umbraco-7#评论-280214但谢谢你的帮助:) –

发现了一把umbraco论坛更简单的答案。

随着Vorto,或其他任何东西真的,如果你想在语言/文化的URL蛞蝓只是父节点→点击上单击鼠标右键文化和主机名 →域中栏填入您选择语言→ //mydomain.com/nl//mydomain.com/en/

超级简单。它会将其添加到您选择的节点下的每个页面。

来源:our.umbraco.org forum (Change URL dependent of the active language in Umbraco 7)