Installation

# Install globally
npm install -g @discordlink/cli

# Or use npx
npx @discordlink/cli export --help

Commands

discordlink init

Initialize a new DiscordLink project with interactive prompts.

discordlink init

Creates discordlink.config.json with your configuration:

{
  "serverId": "123456789",
  "apiUrl": "http://localhost:3000",
  "template": "faq",
  "output": "./dist",
  "build": {
    "clean": true,
    "generateSitemap": true,
    "generateRss": true
  }
}

discordlink export

Export Discord content to static HTML files.

discordlink export [options]

Options

Option Description Default
-s, --server <id> Server ID to export From config
-t, --thread <id> Export single thread -
-c, --channel <id> Export specific channel only -
-o, --output <dir> Output directory ./dist
--template <name> Template: faq, changelog, kb, blog faq
--base-url <url> Base URL for generated links -
--api-url <url> DiscordLink API URL http://localhost:3000
--clean Clean output directory first false

Examples

# Export entire server
discordlink export --server 123456789 --output ./dist

# Export with custom template
discordlink export --server 123456789 --template changelog

# Export single thread
discordlink export --thread 987654321

# Export with base URL for production
discordlink export --server 123456789 --base-url https://faq.example.com

discordlink sync

Verify API connection and show server status.

discordlink sync [options]

Options

Option Description Default
-s, --server <id> Server ID to check From config
--api-url <url> DiscordLink API URL http://localhost:3000

Output Structure

After running discordlink export, you'll have:

dist/
├── index.html          # Main listing page
├── threads/
│   ├── how-to-auth.html
│   ├── getting-started.html
│   └── ...
├── sitemap.xml         # Sitemap for SEO
├── feed.xml            # RSS feed
└── robots.txt          # Robots.txt

Deployment

The output is static HTML that can be deployed anywhere:

Netlify

# netlify.toml
[build]
  command = "discordlink export --server YOUR_ID"
  publish = "dist"

Vercel

# vercel.json
{
  "buildCommand": "discordlink export --server YOUR_ID",
  "outputDirectory": "dist"
}

GitHub Pages

# .github/workflows/deploy.yml
name: Deploy
on:
  push:
    branches: [main]
  schedule:
    - cron: '0 */6 * * *'  # Rebuild every 6 hours

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - run: npm install -g @discordlink/cli
      - run: discordlink export --server ${{ secrets.SERVER_ID }} --api-url ${{ secrets.API_URL }}
      - uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist

Configuration File

The discordlink.config.json file supports:

{
  "serverId": "123456789",          // Required
  "apiUrl": "http://localhost:3000", // API endpoint
  "template": "faq",                 // Default template
  "output": "./dist",                // Output directory
  "build": {
    "clean": true,                   // Clean before build
    "generateSitemap": true,         // Generate sitemap.xml
    "generateRss": true              // Generate feed.xml
  },
  "seo": {
    "titleSuffix": " - My FAQ",      // Append to page titles
    "defaultDescription": "..."      // Default meta description
  }
}