Deploy your MarkoPress site to various platforms.
First, build your site for production:
npm run buildThis creates a dist/ directory with static files ready for deployment.
Set these for production builds:
# Site URL (for canonical URLs and sitemap)
export SITE_URL="https://yourdomain.com"
# Build
SITE_URL="https://yourdomain.com" npm run build# Install Vercel CLI
npm i -g vercel
# Build and deploy
npm run build
vercel --prod- Push your code to GitHub
- Import project in Vercel dashboard
- Configure build settings:
- Build Command:
npm run build - Output Directory:
dist - Install Command:
npm install
- Build Command:
Create vercel.json:
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"devCommand": "npm run dev",
"installCommand": "npm install",
"framework": null,
"env": {
"SITE_URL": "https://yourdomain.vercel.app"
}
}# Install Netlify CLI
npm i -g netlify-cli
# Build and deploy
npm run build
netlify deploy --prod --dir=dist- Push code to GitHub
- Import in Netlify dashboard
- Configure:
- Build command:
npm run build - Publish directory:
dist - Install command:
npm install
- Build command:
Create netlify.toml:
[build]
command = "npm run build"
publish = "dist"
[build.environment]
NODE_VERSION = "20"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200Create .github/workflows/deploy.yml:
name: Deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Build
run: |
SITE_URL=${{ steps.pages.outputs.base_url }} \
npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4Configure repository settings:
- Settings → Pages
- Source: GitHub Actions
# Build
npm run build
# Deploy to gh-pages branch
npx gh-pages -d distCreate .gitlab-ci.yml:
image: node:20
pages:
stage: deploy
cache:
paths:
- node_modules/
script:
- npm ci
- SITE_URL="$CI_PAGES_URL" npm run build
- mv dist public
artifacts:
paths:
- public
only:
- main# Build
npm run build
# Sync to S3
aws s3 sync dist/ s3://your-bucket-name --delete
# Invalidate CloudFront cache
aws cloudfront create-invalidation \
--distribution-id YOUR_DISTRIBUTION_ID \
--paths "/*"Create scripts/deploy-s3.sh:
#!/bin/bash
set -e
# Configuration
BUCKET="your-bucket-name"
DISTRIBUTION="YOUR_DISTRIBUTION_ID"
# Build
echo "Building..."
npm run build
# Sync to S3
echo "Deploying to S3..."
aws s3 sync dist/ s3://$BUCKET --delete
# Invalidate CloudFront
echo "Invalidating CloudFront..."
aws cloudfront create-invalidation \
--distribution-id $DISTRIBUTION \
--paths "/*"
echo "Deployed successfully!"Make executable:
chmod +x scripts/deploy-s3.sh
./scripts/deploy-s3.shCreate Dockerfile:
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
RUN npm install -g @marko/run/preview
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/public ./public
EXPOSE 4173
CMD ["marko-run", "preview", "--port", "4173"]# Build image
docker build -t markopress-site .
# Run container
docker run -p 4173:4173 markopress-siteCreate docker-compose.yml:
version: '3.8'
services:
markopress:
build: .
ports:
- "4173:4173"
environment:
- SITE_URL=https://yourdomain.com
restart: unless-stoppedMarkoPress builds to static files, so you can deploy the dist/ directory to any static hosting service.
However, if you want SSR, you can run the preview server:
# Install dependencies
npm install --production
# Start server
npm run previewUse a process manager like PM2:
# Install PM2
npm i -g pm2
# Start
pm2 start npm --name "markopress" -- run preview
# Save process list
pm2 save
# Setup startup script
pm2 startup# Install Surge
npm i -g surge
# Build
npm run build
# Deploy
surge dist yourdomain.surge.sh# Install Firebase CLI
npm i -g firebase-tools
# Initialize
firebase init
# Configure firebase.json
{
"hosting": {
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
# Deploy
firebase deployname: Build and Deploy
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install
run: npm ci
- name: Build
run: |
SITE_URL=${{ secrets.SITE_URL }} \
npm run build
- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID }}
vercel-args: '--prod'stages:
- build
- deploy
build:
stage: build
image: node:20
script:
- npm ci
- SITE_URL="$CI_PAGES_URL" npm run build
artifacts:
paths:
- dist
only:
- main
deploy:production:
stage: deploy
image: alpine:latest
script:
- apk add --no-cache curl
- curl -X POST -d "" $DEPLOY_WEBHOOK
only:
- mainAfter deploying:
- Test homepage loads
- Test navigation links
- Test all documentation pages
- Test blog posts
- Verify RSS feed works
- Check sitemap is accessible
- Verify robots.txt
- Test Open Graph tags (use https://www.opengraph.xyz/)
- Check analytics tracking
- Test dark mode toggle
- Verify mobile responsiveness
- Test search functionality (if enabled)
- Check 404 page (if custom)
- Verify canonical URLs
- Test social sharing cards
Most platforms automatically compress. If not, add:
# nginx example
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;Configure your CDN:
- Cache CSS/JS for 1 year
- Cache HTML for 1 hour
- Cache images for 1 year
- Enable Brotli compression
- HTTP/2 or HTTP/3
After deployment, set up analytics:
- Configure
public/analytics.js - Verify tracking works
- Set up goals/events
- Monitor performance
Point your domain to your hosting:
A Record:
@ → YOUR_IP_ADDRESS
CNAME:
www → your-hosting.com
Most platforms provide free SSL certificates (Let's Encrypt). Enable in platform settings.
# Clear cache and rebuild
rm -rf node_modules dist package-lock.json
npm install
npm run build- Check
basein config - Verify file paths
- Check router configuration
- Test with
npm run preview
- Set
SITE_URLenvironment variable - Check
site.basein config - Verify canonical URLs
- Ensure images are in
public/ - Use correct paths (relative to public/)
- Check case sensitivity
After deployment:
- Use UptimeRobot
- Pingdom
- StatusCake
- Google PageSpeed Insights
- WebPageTest
- Lighthouse CI
- Sentry
- Rollbar
- Bugsnag
- 📖 Read Production Features
- 🎨 Customize Theme
- 🔌 Build Plugins