Edgio

Jekyll

Jekyll is a static site generator. It takes text written in your favorite markup language and uses layouts to create a static website. You can tweak the site’s look and feel, URLs, the data displayed on the page, and more.

Create your Jekyll site

If you don’t have an existing Jekyll site, you can create one by running:
Bash
1gem install bundler jekyll
2jekyll new my-jekyll-site
3cd my-jekyll-site

Add Edgio

Bash
1# First, globally install the Edgio CLI:
2npm i -g @layer0/cli # yarn global add @layer0/cli
3# Next, create a stub package.json:
4npm init
5# Then, add Edgio to your Jekyll site:
60 init

Update your Edgio Router

Paste the following into routes.js:
JavaScript
1import { Router } from '@layer0/core'
2
3const ONE_DAY = 60 * 60 * 24
4const FAR_FUTURE = ONE_DAY * 365 * 10
5
6export default new Router()
7 // Prevent search engine bot(s) from indexing
8 // Read more on: https://docs.layer0.co/applications/cookbook#blocking-search-engine-crawlers
9 .noIndexPermalink()
10 .match('/assets/:path*', ({ serveStatic, cache }) => {
11 cache({
12 browser: {
13 maxAgeSeconds: ONE_DAY,
14 },
15 edge: {
16 maxAgeSeconds: ONE_DAY,
17 staleWhileRevalidateSeconds: FAR_FUTURE,
18 },
19 })
20 serveStatic('_site/assets/:path*')
21 })
22 .match('/:path*', ({ serveStatic, cache }) => {
23 cache({
24 browser: false,
25 edge: {
26 maxAgeSeconds: ONE_DAY,
27 staleWhileRevalidateSeconds: FAR_FUTURE,
28 },
29 })
30 serveStatic('_site/:path*')
31 })

Deploying

Deploy your app to the Sites by running the following commands in your project’s root directory:
Bash
1# Create a production build of your Jekyll site
2bundle exec jekyll build
3
4# Deploy it to Sites
50 deploy