docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Generate a restapi page with submenu to navigate different page, no scrolling

Open vverrastro opened this issue 9 years ago • 12 comments

Hi all, I'm trying to generate a personal template with mustache. I'm using the start project "docfx-seed-master" to do some test.

I would like to get a page "Api Reference" like this (this is my page now):

restapi

without "right affix" / "right menu", i read that it uses <h1-h2-h3....> tag from current document. But have a submenu under every left item, like this: (with different page for heach tag h1-h2-h3)

apidoc

For example:

Left Menu Search....

PetStoreAPI - AddPet - UpdatePet - FindPetsByTags - DeletePet ........ ContactsAPI - Get Contacts - Get Contact By Id .........

For heach submenu (Addpet, UpdatePet etc ...) a different page. I studied so much the system for creating a custom template, but it's really difficult. I hope that someone could help me please, I don't know how to solve alone. Kind regards, Vito

vverrastro avatar Apr 06 '17 09:04 vverrastro

Hi @vverrastro , in current design (sample page), left navigation is to navigate to different pages, right navigation is to navigate to in-page h1-h3 tags. Do you mean to move h1-h3 tag navigation from right affix into left affix?

hellosnow avatar Apr 07 '17 10:04 hellosnow

Hi @hellosnow, yes. But I need to create a different page for heach item menu (h1.h2.h3) instead of scrooling.

vverrastro avatar Apr 07 '17 10:04 vverrastro

Is it expected to split member level pages to separate pages, so that each method is in one page (it's supported for managed reference, rest api doesn't support it yet)? If yes, nuget package memberpage may help you on this, source code is here SplitClassPageToMemberLevel.cs. @vicancy would know more details.

hellosnow avatar Apr 07 '17 11:04 hellosnow

Hi @hellosnow, I tested the package that you have shown me. It works good with api documentation, but in Restapi it not works, i don't know why. Here the exemple: (Without memberpage - API Documentation)

prima

(With memberpage package - API Documentation)

dopo

This is my Restapi page with no package memberpage effect

restapi

vverrastro avatar Apr 10 '17 09:04 vverrastro

Yes Rest doesn't support split by operations now, one swagger file is generated as one html currently...

hellosnow avatar Apr 10 '17 09:04 hellosnow

I understood. You were kind and helpful. Thank you.

vverrastro avatar Apr 10 '17 09:04 vverrastro

@vverrastro we will consider to add such option for REST to be more flexible, will let you know our schedule if it's decided.

hellosnow avatar Apr 10 '17 09:04 hellosnow

Great! I will follow all the news about this.

vverrastro avatar Apr 10 '17 09:04 vverrastro

@vverrastro we plan to split the rest api into operation groups by Tag rule first, take this rest page as an example, the overall API will be grouped into Pet, Store,Users and Other Apis(not grouped), and we will modify these 4 tags into left navigation, the inner operations such as addPet and updatePet will be kept in right navigation. Is this scenario meet your requirement?

hellosnow avatar Apr 14 '17 03:04 hellosnow

Hi @hellosnow, in your exemple I don't see any change change from the initial sample project. My scenario is (like api documentation with memberspage package):

Left Navigation exemple: (Without big one page with scroll)

  • Petstore Api AddPet (single page) DeletePet (single page) GetPet (single page)

Now if I click on petstoreapi, in navigation bar I have: restapi/petstore.html In my scenario could be restapi/petstore/addpet.html etc

Maybe I dont' understeand your plan :)

vverrastro avatar Apr 14 '17 07:04 vverrastro

@vverrastro I didn't update the referred rest page, just to provide some information. If you read the right navigation of the this rest page , you'll find all operations are not in flat, but group by tags, refer to docfx document Tags to organize the sections of apis.

For splitting the pages, we will move tags group in left toc, and keep each operation inside the tag group in right navigation in first step.

hellosnow avatar Apr 14 '17 07:04 hellosnow

We deliver the split logic via #1827 and #1872 , and the documentation #1895 . Please have a try on it:

  1. With rest.tagpage plugin enabled, operations with the same tag are grouped into one page.
  2. With rest.operationpage plugin enabled, each operation is splitted into single page.
  3. With both rest.tagpage and rest.operationpage plugins enabled, the REST model will be splitted to tag level first, then split to operation level.

Refer Plugins dashboard for more details (It will be refreshed after docfx version upgraded)

hellosnow avatar Jul 20 '17 03:07 hellosnow