pagehaus

Preview, check and deploy with the pagehaus tool

pagehaus is a small, free command-line tool for Windows, macOS and Linux. It shows your site on your computer exactly as Pagehaus will, checks it for broken links, and uploads it in one command. It's open source.

Install it

With Homebrew (macOS or Linux), the easiest way to stay up to date:

brew install pagehaus/tap/pagehaus

macOS without Homebrew (Apple silicon; on an Intel Mac use osx-x64):

curl -L https://github.com/pagehaus/cli/releases/latest/download/pagehaus-osx-arm64.tar.gz | tar -xz pagehaus
sudo mv pagehaus /usr/local/bin/

Linux (on Arm use linux-arm64):

curl -L https://github.com/pagehaus/cli/releases/latest/download/pagehaus-linux-x64.tar.gz | tar -xz pagehaus
sudo mv pagehaus /usr/local/bin/

Windows: download pagehaus-win-x64.zip, unzip it, and put pagehaus.exe in a folder on your PATH (or run it from where it is).

With .NET (any system with the .NET 10 SDK): dotnet tool install -g pagehaus

Check it works with pagehaus --version. A Mac may refuse a copy downloaded with a browser; run xattr -d com.apple.quarantine pagehaus once (the curl commands above don't need it).

Preview your site: pagehaus serve

In your site's folder:

pagehaus serve

Open http://localhost:8080. Pages are shown as Pagehaus serves them: Server Side Includes filled in, index.html for folders, your 404.html for missing pages. Every page reloads by itself when you save a file. Forms show what would be emailed to you instead of sending it. Add --open to open the browser, or --port 3000 for another port.

Find mistakes: pagehaus check

pagehaus check

It lists links and images that point to nothing, links whose capital letters don't match the file (Photo.JPG linked as photo.jpg: fine on your computer, broken on a web server), links to files on your own computer, includes that fail, files over 25 MB, and pages without a title or description. Problems are listed with every page they're on.

Upload your site: pagehaus deploy

  1. Make an API token at Account → API access. For Access, choose yoursite: read and write. Copy the token: it's shown once.
  2. Run pagehaus login and paste it. It's saved on your computer, readable only by you.
  3. In your site's folder:
    pagehaus deploy --dry-run   # what would change
    pagehaus deploy             # upload

deploy runs check first and stops if it finds problems (add --force to upload anyway). It uploads every file except hidden ones such as .git, and lists what's new and what it replaced. Files you deleted on your computer stay on your site: delete them in the dashboard's Files tab. If your token can reach several sites, say which: pagehaus deploy --site yoursite. Every upload is in your site's version history, so a bad deploy can be undone.

Deploy from GitHub

Keep your site in a GitHub repository and deploy on every push with the Deploy to Pagehaus action. Add the token as a repository secret named PAGEHAUS_TOKEN (Settings → Secrets and variables → Actions), then add .github/workflows/deploy.yml:

name: Deploy
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pagehaus/deploy-action@v1
        with:
          token: ${{ secrets.PAGEHAUS_TOKEN }}
          site: yoursite

If your site is in a folder of the repository, add folder: public; to see what would change without changing anything (on pull requests, say), add dry-run: true. In any other CI, install the tool and set the PAGEHAUS_TOKEN environment variable instead of logging in.

Prefer SFTP?

Everything still works the way it did: SFTP, the sftp and scp commands, the API and the dashboard.