Deploying
LFP Docs can be deployed anywhere, where static content can be accessed, even as some kind of local knowledge base!
This page assumes the following:
- you ran
npx lfpdocs init --add-scriptsto add the default dev and build commands to./package.json config.dir.inputis set to/docsconfig.dir.outputis set to_site
Test and Build Locally
To test your site before deploying, do the following:
# check for correctness with the local development server
npx lfpdocs dev
# build the project into the output directory
npx lfpdocs build
The build command builds the output into /_site by default. This can be changed with config.dir.output.
Set Base URL
If your site is served from the domain root, you can skip this section.
Otherwise, if you plan on deploying the site from a path other than /, make sure to set config.baseUrl so that LFP Docs can correctly set up internal links to pages and resources.
A document with the input path /guide/get-started.md (relative to config.dir.input) and a base URL of https://example.org/docs would be accessible under https://example.org/docs/guide/get-started/.
Platform Guides
Many providers offer automated build pipelines, where LFP Docs nicely fits in.
Codeberg
This walkthrough for Forgejo Actions is an excellent starting point for hosting with Codeberg's static page hosting service codeberg.page.
name: Publish
on:
push:
jobs:
publish:
# for information on runners: https://codeberg.org/actions/meta
runs-on: codeberg-tiny-lazy
steps:
- uses: actions/checkout@v5
- run: npm i -D && npm run build:docs
- uses: actions/git-pages@v2
with:
site: https://example.org/your/base-url # change to your URL
token: ${{ forge.token }}
source: _site/ # change this to your config.dir.output
GitHub Pages
For GitHub you have to add a custom Action as well, placed at ./.github/workflows/your-deploy-action.yaml:
name: Deploy LFP Docs to Pages
on:
# Runs on pushes targeting the `main` branch. Change if needed
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 26
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: npm ci
- name: Build
run: npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: _site # change this to your config.dir.output
deploy:
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Have a look at GitHub's documentation for different approaches, depending on your setup.
Netlify/Vercel/Cloudflare Pages/AWS Amplify/Render
Set up a new project and change these settings using your dashboard:
- Build command:
npm run docs:build - Output directory:
_site(or yourconfig.dir.outputsetting) - Node version: 22 (or above)
Your site should get built whenever you pushed to the branch specified in your provider's settings as trigger.