ReadMe Documentation

ReadMe Documentation

Welcome to the ReadMe Documentation, where you'll find comprehensive guides and community support to help you start working with ReadMe as quickly as possible!

Get Started

Reordering Pages

Reorder Pages in the ReadMe Dash

Reordering pages is simple in the ReadMe backend. Hover over the page you want to reorder and handlebars should appear to the left that you can click, then drag the page to the position that you want.

You can also reorder pages to be subpages of another page by following these steps:

  1. Move the desired subpage below the parent page.
  2. Click and hold the three dashes on the desired subpage and move it directly to the right.

To undo this, simply move the subpage above the parent page and it will become a normal page.

How to Reorder Pages Via API

How Ordering works in our API

To insert docs, you would use our Create Docs API
The way our docs ordering works is that each doc has an order attached to it and it works similar to how a z-index works in CSS. The numbers do not have to be consecutive, they are just sorted from low to high to determine the order.
By default, when a page is created it is set to 999. When multiple docs have an order of 999, we fall back to sorting by date created, so that newer pages always come last.

Our Update Docs API allows you to send us the order like so:

curl https://dash.readme.io/api/v1/docs/page-slug -X PUT \
 -u _api_token_here_: \
 --header 'x-readme-version: 1.0.0' \
 --header 'content-type: application/json' \
 --data '{"order": 1}'

So if you had a tree returned from a category that looked like this:

[
 {
  _id: 123,
  slug: 'getting-started',
 },
 {
  _id: 789,
  slug: 'another-page'
 }
]

To reorder these two pages so that some other page is first, you would issue two requests to the update page API (some headers omitted for brevity):

curl https://dash.readme.io/api/v1/docs/another-page -X PUT \
 --header 'content-type: application/json' \
 --data '{"order": 0}'
curl https://dash.readme.io/api/v1/docs/getting-started -X PUT \
 --header 'content-type: application/json' \
 --data '{"order": 1}'

The order is always returned from the API, so you will be able to determine what the current order is either from the tree (which will be correctly ordered), or from a single document.

Subpages

We have another property called parentDoc, which you assign to a document when you create/update it to determine what the parent is. So given the following tree:

[
 {
  _id: 123,
  slug: 'getting-started',
 },
 {
  _id: 789,
  slug: 'another-page'
 }
]

To create a nested doc underneath getting-started, you would issue the following request:

curl https://dash.readme.io/api/v1/docs -X POST \
 -u _api_token_here_ : \
 --header 'x-readme-version: 1.0.0' \
 --header 'content-type: application/json' \
 --data '{"parentDoc": 123, "category": "category-id" "title": "New nested doc" }'

Which requires the parentDoc id, as well as the category id.


Did this page help you?