2

我对 Umbraco 很陌生,所以我的问题可能很简单,但我无法在网上找到任何简单的指南。

我正在构建一个具有一个域和结构的简单网站,如下所示

Content

- en
-- products
-- contacts

- cs
-- produkty
-- kontakty

等等。我的第一个问题是:由于我想在 SEO 中取得一些不错的结果,我需要 (i) 将元语言分配给“en”和“cs”节点的内容以及一些关键字。我该怎么做?

第二:假设将来,我决定添加一种新语言,例如。俄语。所以我需要做的是制作“en”节点及其内容的副本,而新创建的副本中包含的链接应该被重写为指向副本而不是原始节点(原始节点是 /en/anotherpage , 应重写为 /ru/anotherpage)。这可能吗?

谢谢, Ondrej

4

3 回答 3

2

You could build the content structure as a single root node and then have multiple Language homepage nodes directly beneath the content root.

To assign a language, you could create a custom datatype that simply displays all the .Net cultures, e.g. en-GB, fr-FR etc. Include that data type as a field on the language homepage document type and then output this value in the markup on the homepage and each descendant.

In the Language homepage document type, you can add a textstring property called 'umbracoUrlName'. You can then use this property to override the Url name. E.g. So you could call the page www.domain.com/en/ instead of www.domain.com/en/english-home/

With regards to duplicating the site at a later date, this is a difficult one. If the links are created using data types like the media picker and uComponent's multi node tree picker, then you will have no option but to inherit the links from the copied branch. However, if the links are created dynamically in the Razor or XSLT, then you should be able to make the links relative to the Language homepage or the current page. E.g. in XSLT getting the children of the parent language homepage would be something like $currentPage/ancestors-or-self::* [@level = '2']/child::* . In other words you can avoid hard coding links by using a clever bit of relative traversal.

于 2012-07-09T17:04:55.517 回答
0

要设置语言元数据,我会将其存储在语言根节点上的属性中,例如:/en/ 以从任何页面获取语言页面属性:

var langNode = new Node(int.Parse(node.Path.Split(',')[1]));
langNode.GetProperty("languageCode");

至于将英文版复制到俄文版并修复所有链接,我不知道 umbraco 中有什么可以帮助您解决此问题,您可以自己编写一些东西来查找所有链接和节点引用并修复它们。您可以使用关系 API来跟踪从哪里复制到哪里的内容。您需要注意,您最终可能会多次复制节点。

如果您没有太多数据,手动修复链接可能会更快。

于 2012-07-10T01:37:22.743 回答
0

这将为您在 Umbraco 创建多语言网站提供一个良好的开端

http://our.umbraco.org/wiki/how-tos/running-multi-lingual-sites-under-a-single-domain

如果您将来要创建俄语版本,您将完全按照上面提到的方式进行操作,就这么简单。

于 2012-07-04T14:45:11.540 回答