如何在 Sandcastle 文档网站中创建类似 MSDN 的链接?
我已经用 Sandcastle 生成了我的项目的网站文档。 该网站使用框架,因此当我单击网站时,浏览器中的 URL 不会更改。
当我浏览使用 Sandcastle 生成的网站文档时,我希望在浏览器中更改 URL。 为什么? 因为我想链接到我的开发人员环境其他部分的具体文档子页面。
更进一步,我希望这个链接永久存在。 因此,当我从项目的新版本再次生成文档时,链接不会更改,因此我不需要将所有链接更改为新链接。
这可能吗?如何实现?
I've generated a website documentation of my project with Sandcastle. This website uses frames so when I click though sites my URL in browser does not change.
I would like to have URL changed in browser when I browse through website documentation generated with Sandcastle. Why? Because I would like to link to concrete subpages of documentation from other parts of my developer environment.
And further more I would like to have this links permanent. So when I generate once again documentation from new version of my project, links will not change so that I will not need to change all links to new.
Is this possible and how to acomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您将下面的代码添加到
SplitScreen.js
的顶部,浏览器将“注入”TOC 框架并专注于您直接链接到的内容(使用 Vitaly Shibaev 展示的技巧)。如果文档位于网站的根目录下,则此代码有效 - 如果您将其放在子文件夹中,则需要展开“/?topic”并从路径名部分中删除子文件夹部分。
通过此更改,您可以使用“直接链接”。 我还希望通过 Google 找到您的人获得更好的体验(获得他们搜索的内容和目录栏)。
If you add the code below to the top of
SplitScreen.js
the browser will "inject" the TOC frame and focus on the content you linked directly to (using the trick Vitaly Shibaev showed).This code works it the documentation is placed at the root of your website - if you have it in a sub-folder you need to expand on "/?topic" and remove the sub-folder part from the pathname part.
With this change you can use the "direct links". I also expect people who find you via Google get a better experience (getting the content they searched for AND the TOC bar).
为了创建指向文档特定子页面的正确链接,您可以使用类似的请求:$DOCUMENTATION_ROOT$/Index.aspx?topic=html/$TOPIC_ID$
.htm http://www. ewoodruff.us/shfbdocs/Index.aspx?topic=html/8dcbb69b-7a1a-4049-8e6b-2bf344efbbc9.htm
而不是 http://www.ewoodruff.us/ shfbdocs/html/8dcbb69b-7a1a-4049-8e6b-2bf344efbbc9.htm
In order to create correct links to specific subpages of documentation you may use similar request: $DOCUMENTATION_ROOT$/Index.aspx?topic=html/$TOPIC_ID$.htm
E.g. http://www.ewoodruff.us/shfbdocs/Index.aspx?topic=html/8dcbb69b-7a1a-4049-8e6b-2bf344efbbc9.htm
instead of http://www.ewoodruff.us/shfbdocs/html/8dcbb69b-7a1a-4049-8e6b-2bf344efbbc9.htm
Vitaliy 和 mawtex 已经解决了“如何链接到您问题的文档子页面部分。
您的问题的“使链接永久化,以便在重新生成文档时不会更改”部分会自动解决,因为默认情况下创建的 html 文件名基于主题名称的哈希值。 即,如果您不更改正在记录的代码部分,那么它将使用相同的文件名。
您可以更改 html 文件名的生成方式,但所有给定的方法都基于成员名称或主题 ID 的哈希值,因此如果代码未更改,链接不应中断。
请参阅 Sandcastle 帮助文件生成器的 命名方法 文档以获取更多信息。
Vitaliy and mawtex have solved the 'how to link to documentation subpages' part of your question.
The "making links permanent so they do not change when regenerating documentation" part of your questions is solved automatically, since the html file names created are based on a hash of the topic name by default. I.e. If you do not change the part of your code that you are documenting, then it will use the same file name.
You can change the way that html file names are generated, but all given methods are based on the member name or a hash of the topic ID, so links shouldn't break if the code hasn't changed.
See Sandcastle Help File Builder's NamingMethod documentation for more info.