Skip to content

New Page Guide

Luke Ferguson edited this page Nov 18, 2016 · 1 revision

Adding a new page to the docs

This guide will cover how to create a new page in the docs and how to structure said new page.

Creating the markdown file

The documentation is based on a node.js express app. This has multiple routings set in app/index.js

app.get('/', getIndexRoute);
app.get('/docs/:category/:page?', getDocsRoute);
app.get('/login', getLoginRoute);
app.post('/login', postLoginRoute);
app.get('/register', getRegisterRoute);

You'll note that for the /docs path we pass in :category and :page as request params. This allows us to have the structure of the /docs directory dictate the routing of the URL.

If you take a look at the rest-api directory you'll note the file names match the URL.

So you have the following URL's

// loads the index markdown file
docs/rest-api

// and the rest
docs/rest-api/event-booking
docs/rest-api/service-booking
// etc etc

This also has the benifit of being able to organise the menu as you like.

the menu can be editied in templates/components/menu.twig for the rest API we can create the static template like so.

<li>
    <span><i class="fa fa-fw fa-terminal">&nbsp;</i>REST API</span> 
        <ul> 
            <li><a href="docs/rest-api">Overview</a></li>
            <li><a href="docs/rest-api/authentication">Authentication</a></li>
            <li><a href="docs/rest-api/service-booking">Service Booking Guide</a></li>
            <li><a href="docs/rest-api/event-booking">Event Booking Guide</a></li>
            <li><a href="docs/rest-api/queuing">Queueing System</a></li>
            <li><a href="docs/rest-api/permissions">Permissions</a></li>
            <li><a href="docs/rest-api/sso">Single Sign On</a></li>
            <!-- <li><a href="">Packages and Bulk Purchases</a></li>
            <li><a href="http://apidocs.bookingbug.com/" target="_blank">API Reference</a></li>
        </ul>
</li>

you will note here that because we are not generating the menu items we can make one of the an external link to the API ref.

Clone this wiki locally