简体   繁体   English

在Umbraco CMS中制作依赖域的内容的方法

[英]Approach to make domain dependent content in Umbraco CMS

One of my clients wants a "section" in the content tree where local news articles can be created by local users (from within Umbraco) The site structure is as follows: 我的一位客户希望在内容树中有一个“部分”,本地用户可以在本地树中创建本地新闻文章(从Umbraco内部)。网站结构如下:

Content
     - mysite.com (Current hostname: mysite.com (english))
            - Frontpage
            - Some text page
            - Some text page
            - News
            - Local news
                 - Denmark
                      - News item 1
                 - Sweden
                      - News item 1
                 - England
                      - News item 1
                 - Norway
                      - News item 1

Now, on the News page they want to create a link to ie the swedish (Sverige) local news page, but only if a user visits their site with the domain: mysite.se and not .com which is the standard site. 现在,他们希望在“新闻”页面上创建指向瑞典(Sverige)本地新闻页面的链接,但是仅当用户访问其域为mysite.se而不是标准网站.com的站点时才可以。

What exactly would the best approach be to create this? 最好的方法到底是什么? "Problem" is that the main navigation is rendered using the mysite.com hostname which is set on the site-node in Umbraco. “问题”是使用在Umbraco的站点节点上设置的mysite.com主机名呈现主导航。 So if I enter the site with domain: mysite.se and I click on a menu item (ie the News link), I'll get "redirected" to the .com domain. 因此,如果我输入域为mysite.se的站点,然后单击菜单项(即“新闻”链接),则将“重定向”到.com域。

Any input is greatly appreciated! 任何输入,不胜感激! :-) Let me know if some of the above needs to be elaborated. :-)让我知道是否需要详细说明上述内容。

Thanks in advance. 提前致谢。

All the best, 祝一切顺利,

Bo

I think I would solve this by using the build-in UrlRewrite option in Umbraco (/config/UrlRewriting.config) 我想我可以通过使用Umbraco(/config/UrlRewriting.config)中的内置UrlRewrite选项来解决此问题

First I would move the news folders outside of the root of the website if it is not neccessary to have them inside one site. 首先,如果不需要将新闻文件夹放在一个站点内,则将其移动到网站根目录之外。

Second I would create a general newsoverview and newsdetail page in umbraco. 其次,我将在umbraco中创建一个常规的newsoverview和newsdetail页面。

To make this work I would create links to the news overview and newsdetail page in this kind of form /newsdetail/title-of-my-newsitem/nodeId-of-my-newsitem.aspx 为了完成这项工作,我将以/newsdetail/title-of-my-newsitem/nodeId-of-my-newsitem.aspx形式创建指向新闻概述和newsdetail页面的链接。

I then would let the UrlRewrite module redirect my url to the newsdetail.aspx page and add the nodeID to the querystring with this rewrite rule: 然后,我将让UrlRewrite模块将我的URL重定向到newsdetail.aspx页,并使用此重写规则将nodeID添加到查询字符串中:

<add name="swedish_newsdetail_page"
 virtualUrl="^~myurl.se/news/(.*)/(.*)"
 rewriteUrlParameter="ExcludeFromClientQueryString"
 destinationUrl="~myurl.se/newsdetail.aspx?nodeId=$2"
 ignoreCase="true" />

A similar construction can be created for the newsoverview page. 可以为newsoverview页面创建类似的构造。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM