PostHog / posthog.com

Official docs, website, and handbook for PostHog.
https://posthog.com
Other
433 stars 442 forks source link
design docs gatsby handbook posthog tailwindcss

posthoglogo

PostHog.com - Website, docs, blog, and handbook

PRs Welcome GitHub contributors Join Community GitHub commit activity GitHub closed pull requests

Support - Roadmap - Open an issue - Style guide

This is the repository for the PostHog website. It contains:

Table of contents

Quick start

  1. Pre-installation

    Install Node and Yarn. (If you're on a Mac with Apple Silicon and get an error with -86 in it, you may need to install Rosetta.)

    npm install --global yarn
  2. Start developing

    Clone the repo and navigate into your new site’s directory:

    git clone git@github.com:PostHog/posthog.com.git && cd posthog.com/

    If you're using an Apple Silicon Mac (M1) you'll need to run the following commands:

    rm -rf ./node_modules
    brew install vips

    Then install the site dependencies, and start it up:

    yarn
    yarn start

    Tip: Seeing a discrepancy between local development and staging/production? Preview the production build locally by running gatsby build && gatsby serve

  3. Open the source code and start editing!

    Your site is now running at http://localhost:8001!

    Note: You'll also see a second link: http://localhost:8001/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.

See full instructions on developing PostHog.com locally in our manual.

Advanced setup

Debugging errors on start

  1. Pull the latest changes from master
  2. Run gatsby clean && yarn start or delete node_modules and .cache
  3. Check builds are passing in deployment to Vercel

Working on /docs/api?

The site will load the API schema from US Cloud by default. You can override this to use your local PostHog instance with an env var:

POSTHOG_OPEN_API_SPEC_URL="http://127.0.0.1:8000/api/schema/" yarn start

Want Ashby job listings or GitHub contributors to load?

You’ll need to set environment variables for these. See (private) instructions for this.

Developing the posts section

To see your local version of the posts section, /posts needs to be visited directly (http://localhost:8001/posts)

Developing the merch store

Additional environment variables are needed to develop the merch store:

Currently, these environment variables are excluded from Vercel preview builds to disable merch store node creation and speed up build times on non-merch related PRs.

Dynamic open graph images

To develop a dynamic open graph image:

  1. Run yarn build with both the ASHBY_API_KEY and GITHUB_API_KEY set.
  2. In gatsby/onPostBuild.ts, temporarily comment out the following:
    if (process.env.VERCEL_GIT_COMMIT_REF !== 'master') return
  3. Find the generated open graph image in public/og-images/

Contributing

We <3 contributions big and small. In priority order (although everything is appreciated) with the most helpful first: