Admin Features

Feb 04, 2021

Once you have your blog set up and deployed to a host like Netlify, it’s entirely possible to write, edit, and publish new blog posts without needing to touch the Git repository.

Still, you might want to share a link with someone else for proofreading or review. (Or, maybe you just want to take a quick peek at how your draft is coming along before pressing Publish.)

Backlit keyboard

With a few additional configurations, you can create a simple admin-like setup for managing your content:

  • Show unpublished drafts
  • Display “Edit this post on Portway” links on individual blog posts
  • Expose a Build button to trigger manual builds — Coming soon!

Example — To get an idea of what this looks like in practice, take a peek at the “secret” admin deployment for this site.

Admin deployment

Creating a second “admin” deployment on Netlify allows you to enable admin tools in an environment that’s identical to your actual site!

  1. In the Netlify dashboard, click the New site from Git button
  2. Select your Git provider
  3. Find and select the Git repo for your blog created during initial setup

Once you’ve created a second deployment, use the environment variables described below to enable admin features. Heads up! — Unless you don’t mind random people stopping by to read your drafts, your admin deployment should use a secret, unguessable URL 🤫

Enabling admin features

A few admin features are controlled by special environment variables.

In Netlify, these can be found and managed under Site Settings → Build & deploy → Environment.

Environment variables in Netlify

Tip — After adding, removing, or updating configuration environment variables, be sure to rebuild your site for the changes to be reflected

Show Drafts

To show unpublished posts on your admin deployment, add an environment variable PORTWAY_SHOW_DRAFTS with a value of true.

Note — Take care not to enable this on your production site, or blog posts may appear before they have been published.

To change this behavior on your local machine, add the following line to your .env file:


As a convenience, you can configure your admin site to show “Edit this post in Portway” links at the bottom of each blog post like this:

To enable this feature, add the environment variable PORTWAY_SHOW_EDIT_LINK with a value of true:

To change this behavior on your local machine, add the following to your .env file:


Show “Build” button

Coming soon!

Previewing draft updates

Since automatic deployment via webhook only happens when you click Publish in Portway, incremental edits to a document won’t automatically be reflected on your admin site.

In general this is desirable, since you probably don’t want to trigger a build each time you make a minor change. But it means we have to take an extra step to manually build your admin site to reflect your latest edits.

Deploying manually from Netlify

To kick off a build of your site to display the latest changes:

  1. Open the Sites tab in the Netlify dashboard
  2. Click or tap your admin deployment
  3. Open the Deploys tab
  4. Click or tap the Trigger deploy button
  5. Select Deploy site
Netlify dashboard showing deploy site button

Click “Build”

Coming soon!