-
Download https://github.com/dotnet/docfx/releases/download/v2.37.2/docfx.zip
-
Extract docfx.zip
-
Run
docfx init -q
to get a new project -
cd docfx_project
-
Add to
toc.yml
:- name: More dropdown: true items: - name: Item 1 topicHref: /abc - name: Item 2 topicHref: /def - name: Item 3 topicHref: /ghi
-
Run
docfx template export default
to get the default template out of DocFX -
Move
./_exported_templates/default
to./custom_template
-
Remove
./_exported_templates
-
Change
docfx.json -> [build][template]
from'default'
to'custom_template'
-
Replace the contents of
./custom_template/partials/li.html.tmpl
with:<ul class="nav level{{level}}"> {{#items}} <li> {{^dropdown}} {{^leaf}} <span class="expand-stub"></span> {{/leaf}} {{#topicHref}} <a href="{{topicHref}}" name="{{tocHref}}" title="{{name}}">{{name}}</a> {{/topicHref}} {{^topicHref}} <a>{{{name}}}</a> {{/topicHref}} {{^leaf}} {{>partials/li}} {{/leaf}} {{/dropdown}} {{#dropdown}} <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{name}} <span class="caret"></span></a> <ul class="dropdown-menu level{{level}}"> {{>partials/dd-li}} </ul> </li> {{/dropdown}} </li> {{/items}} </ul>
-
Create
./custom_template/partials/dd-li.html.tmpl
and add:{{#items}} <li><a href="{{topicHref}}">{{name}}</a></li> {{/items}}
-
Stop active navbar items showing on the homepage with
./custom_template/styles/docfx.js
, replacing line 394:$(e).addClass(active);
with
if ((window.location.pathname != '/index.html') && (window.location.pathname != '/')) { $(e).addClass(active); }
-
Start site serve with
docfx docfx.json --serve
-
Notifications
You must be signed in to change notification settings - Fork 0
ollie-nye/docfx-dropdown-fix
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Basic fix for DocFX navbar dropdowns
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published