Emit/Static Site
-
Explanation/What is Scraps?
-
How-to/Deploy to GitHub Pages#Deployment #Emit/Static Site Deploy a Scraps site to GitHub Pages using GitHub Actions. The build output (_site/ by default; configurable in Configuration#root-level) is uploaded as a Pages artifact and published via the official actions/deploy-pages action — no gh-pages branch required. GitHub settings Set up GitHub Pages for the repository. Build and deployment parameter as follows: Source: GitHub Actions Workflow file Prepare a YAML file under .github/workflows/ like this: name: Deploy scraps github pages on: push: branches: - main workflow_dispatch: 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 with: fetch-depth: 0 # For scraps git committed date - name: Setup Scraps uses: boykush/scraps@v1 - name: Build run: scraps build - name: Configure Pages uses: actions/configure-pages@v5 - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: _site deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 The boykush/scraps action installs the matching CLI binary from GitHub Releases. Pin to a specific tag (@v1.0.0) or to a SHA with a version comment for Renovate-managed updates: - uses: boykush/scraps@<sha> # v1.0.0 If your output_dir differs from _site/, update the path: in the upload-pages-artifact step to match.
-
Reference/Static Site#Emit/Static Site The static site is one of the emit targets Scraps compiles to. The other first-class target is JSON from CLI Overview. See What is Scraps?#more-than-a-static-site-generator for why Scraps decenters SSG from its narrative while keeping the HTML output fully supported. Pipeline ![[Reference/Static Site/Pipeline]] Output structure ![[Reference/Static Site/Output Structure]] README and the index page ![[Reference/Static Site/README and Index]] Search index ![[Reference/Static Site/Search Index]] Color scheme ![[Reference/Static Site/Color Scheme]] Tag pages ![[Reference/Static Site/Tag Pages]] Sort and pagination ![[Reference/Static Site/Sort and Pagination]] Configuration schema The full schema lives in Configuration ([ssg] and root level); the same [ssg] block is embedded below for in-place reading. ![[Reference/Configuration#ssg-section]]
-
Reference/Static Site/Color Scheme
-
Reference/Static Site/Pipeline#Emit/Static Site graph LR Source[Markdown sources] --> IR[Scraps IR] IR --> HTML[Static HTML] IR --> JSON[CLI JSON] HTML --> Pages[GitHub Pages, Cloudflare Pages, ...] The HTML emitter takes the Scraps IR and produces a static directory tree, which any Pages-class host can serve. See Deploy to GitHub Pages for one such recipe.
-
Reference/Static Site/README and Index#Emit/Static Site README.md at the wiki root is special-cased: it becomes index.html instead of scraps/readme.html. This lets the wiki render correctly both on the static site and directly on GitHub. One limitation: autolinks inside the wiki root README.md fall back to plain links — the OGP card is suppressed on the index page.
-
Reference/Static Site/Output Structure#Emit/Static Site Build output is written to the directory configured by output_dir (default _site/). ❯ tree _site _site ├── index.html # README.md or scrap index ├── scraps/ │ ├── getting-started.html │ └── guide/ │ └── links.html ├── main.css └── search_index.json # when build_search_index = true Each Markdown file is converted to a slugified HTML file under scraps/. Folders become path segments — the same folders that form Context Link. Files in static/ and the build output directory are excluded from scrap traversal.
-
Reference/Static Site/Tag Pages#Emit/Static Site Each #[[tag]] referenced by at least one scrap gets a generated index page listing all scraps that reference it. Nested tags (#[[a/b/c]]) auto-aggregate to their parents — see Nested Tag.
-
Reference/Static Site/Sort and Pagination#Emit/Static Site The wiki index page is sorted by committed_date (default) or linked_count, and optionally paginated. Configure sort_key and paginate_by under [ssg] in Configuration.
-
Reference/Static Site/Search Index#Emit/Static Site When build_search_index = true (the default), the build emits search_index.json in the Fuse.js JSON shape and the static site mounts a search UI backed by it. [ { "title": "Getting Started", "url": "https://example.com/scraps/getting-started.html" }, { "title": "Configuration", "url": "https://example.com/scraps/configuration.html" } ] Search is scoped to the static site — it powers the in-page search box for human readers. Agent-side search is scraps search --json and is independent of this index. Set build_search_index = false in Configuration to skip both the index and the UI.