Edgio
Edgio

MkDocs

MkDocs is a fast, simple and downright gorgeous static site generator that’s geared towards building project documentation. Follow the steps below to deploy your MkDocs site to Edgio.

Example

Connector

This framework has a connector developed for Edgio. See Connectors for more information.

System Requirements

Sign up for Edgio

Deploying requires an account on Edgio. Sign up here for free.

Install the Edgio CLI

If you have not already done so, install the Edgio CLI.

With npm:

Bash
1npm i -g @edgio/cli

With yarn:

Bash
1yarn global add @edgio/cli

Create your MkDocs site

If you don’t have an existing MkDocs site, you can create one by following:

Bash
1# https://www.mkdocs.org/getting-started
2
3pip3 install mkdocs
4mkdocs new my-mkdocs-app
5cd my-mkdocs-app

Initializing your project with Edgio

Then, in the root folder of your project, run:

Bash
1edgio init --connector=@edgio/mkdocs

This will automatically add all of the required dependencies and files to your project. These include:

  • The @edgio/core package
  • The @edgio/cli package
  • The @edgio/mkdocs package
  • edgio.config.js- Contains various configuration options for Edgio.
  • routes.js - A default routes file that sends all requests to the MkDocs. Update this file to add caching or proxy some URLs to a different origin.

Routing

The default routes.js file created by edgio init sends all requests to MkDocs server via a fallback route.

JavaScript
1// This file was automatically added by edgio deploy.
2// You should commit this file to source control.
3
4const { Router } = require('@edgio/core/router')
5const { mkdocsRoutes } = require('@edgio/mkdocs')
6
7export default new Router()
8 // Prevent search engines from indexing permalink URLs
9 .noIndexPermalink()
10 .use(mkdocsRoutes)

Running Locally

To test your app locally, run:

Bash
1edgio run

You can do a production build of your app and test it locally using:

Bash
1edgio build && edgio run --production

Setting --production runs your app exactly as it will be when deployed to the Edgio cloud.

Deploy to Edgio

Deploy your app to the Sites by running the following commands in your project’s root directory:

Bash
1edgio deploy

See Deployments for more information.