Embedding in Existing Sites
Sourcey's output is static HTML that can be dropped into any existing website's public directory. This is how sourcey.com itself works: these docs are built with sourcey and served from /docs/ alongside the Astro marketing site.
Subfolder deployment
Build the output directly into your site's public directory:
sourcey build -o ./public/docsYour existing site framework (Astro, Next.js, Hugo, plain Nginx) serves the public/ directory as static files. The sourcey output at /docs/ is completely self-contained: its own CSS, its own JS, its own search index. No conflicts with your main site's styles or scripts.
Build script integration
Add a build script to your package.json:
{
"scripts": {
"build:docs": "cd docs && npx sourcey build -o ../public/docs"
}
}This assumes your sourcey config and markdown live in a docs/ subdirectory. Adjust paths to match your project layout.
Embeddable output
For iframe embedding, use the --embed flag. This strips the <html>, <head>, and <body> wrappers, producing bare content suitable for injection into an existing page.
sourcey build --embed -o ./embedEmbedded output expects its CSS and JS files to be served from the same directory. Make sure the output directory is accessible at the path the iframe src points to.
Real-world example
This documentation site is itself built with sourcey. The setup:
- A
docs/directory in the sourcey.com repo containssourcey.config.tsand all markdown files npm run build:docsrunssourcey build -o ../public/docs- The Astro site serves
public/docs/as static files at/docs/ - The "Docs" link in the navbar points to
/docs/
The marketing site and the documentation site are independently built and independently styled. They share a URL but nothing else.
