如何创建在共享点网站模板中使用的相对链接
我们正在创建一个站点模板,其中包含一个包含许多子文件夹的文档库和一个包含指向 DocLib 深度的快捷方式链接的链接列表。在制作网站模板时,我们选中“包含内容”框。我们正在使用 Sharepoint 2010。没有 MOSS。
我们的问题:一旦我们从模板创建了一个网站,快捷链接就不起作用了。虽然链接 URL 的第一部分被重写,但原始站点名称的一部分仍然隐藏在 URL 中。
我的问题:有没有办法创建指向网站内部内容的相对链接,以便不包含网站名称?或者是否有一个变量可以用来代表当前站点?或者我是否必须在创建链接后以编程方式“修复”链接?或者其他更好的选择?
We are creating a site template that among other things has a Document library with MANY sub folders and a Link list that contains shortcut links to the depths of the DocLib. While making the Site template we are checking the box to 'Include Content.' We are using Sharepoint 2010. No MOSS.
Our problem: Once we make a site from the template, the shortcut links don't work. While the first part of the link URL is rewritten, there is a portion of the original site name still buried in the URL.
My Question: Is there a way to create a relative links to content inside of the site, so that the the site name isn't included? or is there a variable I can use to represent th current site? or do I have to programmatically 'fix-up' the links after it's created? or some other better option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一种方法,但您必须在母版页中完成工作。以下标记在 sharepoint 2010 母版页中呈现为 ahref,并且相关性将传递到作为模板创建的网站。
There is a way, but you will have to do your work in master pages. The following tag is rendered in a sharepoint 2010 master page as ahref, and the relativity is passed on to sites created as templates.
我认为您可能遇到了使用模板的众多限制之一。我不知道使用模板时有什么方法可以改变这种行为。
但是,您提到了编程。如果您正在部署自定义项,您可能会研究站点定义或使用代码装订功能来填充列表。
在无代码方面,如果站点的执行具有一定的灵活性,您可能有一些选择。如果您确实需要子文件夹和模板方法,您可能会考虑用页面替换链接列表。如果页面内容是链接列表,则它们将是相对的。如果您的结构灵活,另一个选择是删除子文件夹。您可以为类别添加一个字段,您可以根据该类别进行分组。或者,您可以创建单独的文档库而不是使用文件夹。
I think you may have come across one of the many limitations of using templates. I don't know of any way to change this behavior when using templates.
However, you mentioned programming. If you are deploying customizations, you might look into site definitions or feature stapling with code to populate the list.
On the no code side, you might have some options if there is some flexibiility in execution of the site. If you really need the sub folders and the template method, you might look at replacing the link list with a page. If the page content is a list of links, they will be relative. If your structure is flexible, another option is to remove the sub folders. You could add a field for category that you can group by instead. Or, you could create seperate document libraries instead of using folders.