[英]Docfx 3.0.0 How to get the TOC on the Index.html
這個問題和這個問題一樣。 但是 OP 回答了他自己的問題,但對我沒有幫助。
但是,當我構建項目時,我得到的 index.html 如下所示:
我的配置是這樣的:
我的文件夾配置是:
+MyApp.sln
|-MyApp
MyApp.csproj
docfx.json
toc.yml
index.md
|-_site
|- api
index.md
toc.yml
|-articles
intro.md
toc.md
我可以看到所有文件都在生成,但 TOC 沒有放在 index.html 上。 Docfx 教程不是很有幫助,因為它還沒有升級到最新版本。 例如, docfx init
不運行,我必須使用docfx new conceptual
。 我試過了:
docfx new conceptual
conceptdocfx build
docfx serve _site --port 8182
。 但是,完成后,我的瀏覽器會告訴我檢查代理設置。 在我嘗試做的所有事情中,我可能在一個地方升級了我的 docfx 版本,但不是在 Visual Studio 中,因為在運行docfx serve
我得到以下內容根路徑: 但我不確定如何還原或是否需要還原。
我絕對處於鎖定的安全環境中,我懷疑這與它有關。 有誰知道我可以如何更改哪些文件(如果有的話)以在與 index.html 相同的頁面上獲取 TOC? 如果需要,我不介意手工編寫它,如果我只需要在配置文件中執行一次。
我能夠做到這一點的唯一方法是:
將articles/toc.md 更改為articles/toc.yml:
- name: Home
href: ../index.md (or wherever index.md relative to articles/ is)
- name: Intro
href: intro.md
將此添加到 docfx.json > build > content > files(包含文章的文件):
"**/*.yml",
從 toc.yml 中取出對 home 的引用(在根目錄下):
- name: Articles
href: articles/
- name: API
href: api/
我不完全清楚你的文件結構,但這是想法。
對我來說,有效的是更改根目錄 toc.yml。 文件名如 /index.md 的 href 不起作用,但對於文件夾它起作用。
錯誤:root toc.yml
- name: Articles
href: articles/index.md
- name: API
href: api/index.md
好:root toc.yml
- name: Articles
href: articles/
- name: API
href: api/
topicHref: api/some.md
我終於找到了問題所在。 我的問題是文件夾配置。 我不得不將我的docfx.json
、 toc.yml
和index.md
到我的 .sln 文件所在的頂層,因為它正在訪問多個.csproj
文件。 我沒有意識到頂級toc.yml
只能訪問其當前位置下的文件夾。
此外,頂級toc.yml
只會在頁面頂部創建菜單項。 較低級別的目錄文件將在頁面左側創建目錄。
花了一些時間研究教程才弄明白這一點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.