jordwalke / paradoc

One Click Docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Render current page while loading the other pages

thangngoc89 opened this issue · comments

Since Paradoc loads documents in a waterfall order, it takes around 5 seconds to render locally (using file:// protocol) or 30 seconds remotely.
The project contains 46 pages.

I would suggest displaying the current page first then load the rest of the pages later.

After digging into the codebase, I would suggest a change to page configuration.

  • Root page (usually README.html or index.html) would has a new yaml header called pages that would list all pages in order.
  • Child pages only need to define rootPage.

Benefits of this procedure :

  • This allows easily move files around and re-ordering pages
  • Deterministic sticky page headers order.
  • Load pages in parallel

One other benefit of this:
There's a workflow where you add a new page entry to the pages: yaml key in the root page. On page reload (or live reload), it detects you've added a new page that doesn't yet exist on disk (the fetch fails). It then has a little notification in the corner saying "You've added a new page. Click to download the new page and save it alongside your existing pages".
When you click it, it downloads the page with a page title, the script header, and the rootPage: already set to the main root page.

I'm not even sure the rootPage is necessary if development mode always loads through the main entrypoint page.

Yeah. Notify about a missing page would be a nice benefit of this.
The rootPage is necessary because it needs to know where to find pages header.