Last reviewed: March 17, 2025

Connect Content Publisher To An Existing Site Using the SDK/StarterKit

This document contains instructions for developers to install the Content Publisher SDK and starter kit on an existing website using the command line. This will enable you to connect your website to Content Publisher and publish content.


Prerequisites

To install the Content Publisher SDK and starter kit, you will need access to an existing site (NextJS) and the site's repo.

Connecting An Existing Site To Content Publisher

Step 1

Navigate to the site's directory that you want to connect to Content Publisher. Add the SITE ID and API key environment variables to the “./[your site name]/.env.local. "

  • PCC_SITE_ID This is the ID used to connect a site in the add-on to your actual site.
    1. If you don’t know the site ID, you can obtain it via the add-on by selecting your site and viewing the Site Metadata properties.

  • PCC_TOKEN will be provided or available via the PCC CLI by running:

pcc token list

  • You can generate a token, if one isn’t listed, by running:

pcc token create

Your .env.local file will look like this using the values you just retrieved:

PCC_SITE_ID="your site id"

PCC_TOKEN="your token"

Step 2

Try to run the site using

yarn dev

How do I view my site:

ReactJS http://localhost:3000

Note if port 3000 is already being used, check your console output to find the URL where your site is accessible on yarn dev.

Now, you are ready to publish content on your site.


Additional references

The starter kit consumes this SDK, but you can also use it in your project and only check the starter kit’s implementation for reference.

  • Content Publisher Starter Kit (NextJS): GitHub