How to Capture a Docusaurus Documentation Site in Go

How to Capture a Docusaurus Documentation Site in Go

author

Snapshot Site Team

05 Mar 2025 - 02 Mins read

Docusaurus is a common choice for open-source and developer-facing documentation, and teams that maintain it — often the same ones running backend services in Go — sometimes need automated screenshots for release notes, visual QA after a docs theme change, or archiving a specific version of a page.

Why Docusaurus Sites Have Their Own Quirks

  • Versioned documentation means the same conceptual page can exist at several URLs (one per version), and capturing the right one matters if the point is documenting a specific release's docs.
  • Client-side search integration (Algolia DocSearch or similar) loads after the initial page render and rarely affects a plain page capture, but is worth knowing about if a capture seems to include a search overlay unexpectedly.
  • Long-form pages are the norm in documentation, so a full-page capture is almost always the right default.

Go Example

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	payload := map[string]interface{}{
		"url":        "https://docs.example.com/docs/latest/getting-started",
		"format":     "png",
		"width":      1440,
		"height":     900,
		"fullSize":   true,
		"hideCookie": true,
	}
	body, _ := json.Marshal(payload)

	req, _ := http.NewRequest("POST", "https://api.prod.ss.snapshot-site.com/api/v1/screenshot", bytes.NewBuffer(body))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("x-snapshotsiteapi-key", "YOUR_API_KEY")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	fmt.Println(resp.Status)
}

Practical Recommendations

  • Capture the specific version URL when documenting a release, rather than the "latest" alias that will point somewhere else after the next release.
  • Default to fullSize: true. Documentation pages are long by nature, and a partial capture rarely tells the full story.
  • Batch by sidebar structure. Docusaurus's sidebar configuration file is a convenient source of a complete URL list for a full-site capture sweep.

Common Use Cases

  • Archiving a specific documentation version's exact content at release time
  • Visual QA after a Docusaurus theme or plugin upgrade
  • Generating preview thumbnails for a documentation changelog
  • Batch capturing an entire docs site for a content audit, using the concurrency patterns that apply to any large URL list

For teams maintaining developer documentation, Snapshot Site fits into the same Go-based tooling already used to build and deploy the docs site itself.

Recent Articles

Subscribe to Snapshot Site API

Snapshot Site is a powerful API that allows you to capture full-page, high-resolution screenshots of any website with pixel-perfect accuracy.
Simply send a URL to the API to generate a complete snapshot — not just the visible area — covering entire web pages, scrolling content, landing pages, blogs, news articles, social media posts, videos, and more.
Designed for developers, designers, marketers, and journalists,
Snapshot Site makes it easy to integrate web page capture into your applications, workflows, and automation tools.

Subscribe Now
bg wave