Skip to content
Margent
Language
All guides

Static sites and HTML

For owners · Publish any built site, with example build steps for common generators.

Any static site

Whatever produces a folder of HTML works: a documentation generator, a site framework, a report tool or a script. Build it in the publish workflow and upload the output folder. Margent serves the files as they are, from the project’s own private domain, and adds its comment layer to every page. Your scripts run and your styles apply.

Readers comment on any text or image of the build. Images loaded from other sites can’t take comments, because they aren’t part of the build.

What the build needs

  • Relative links and asset paths. Branch versions are served under _b/<branch>/, so a link to /about/ leads to the main version. Most generators have a setting for relative URLs or a base path.
  • An upload folder that is git-ignored as a whole, as dist/, build/ and site/ usually are. Inside a folder that is not ignored, files that .gitignore matches are left out of the upload.
  • No top-level _b/, _ac/ or .margent/: those paths are reserved.
  • Within the limits: 500 MB unpacked, 50 MB per file, 10,000 files, and paths of up to 300 characters and 20 folders deep.

Every build is scanned for passwords and keys before it is published. A build with a finding is refused.

Example build steps

Each example replaces the steps of the workflow the project page gives you. Pin every action you add by its full commit SHA.

A Node site (Vite, Astro, Docusaurus, Eleventy …) with npm run build writing to dist/:

    steps:
      - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803  # v6.1.0
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1  # v7.1.0
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run build
      - uses: sacovo/margent-publish/action@3e05fdf9c312df0e0401680322591080d6b376f3  # pin by SHA
        with:
          dir: dist

MkDocs, run with uv (no Python setup needed):

    steps:
      - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803  # v6.1.0
      - uses: astral-sh/setup-uv@18d369b23da25a81e9458561248e1aafff6a70fa  # v10.3.1
      - run: uvx --with mkdocs-material mkdocs build --site-dir site
      - uses: sacovo/margent-publish/action@3e05fdf9c312df0e0401680322591080d6b376f3  # pin by SHA
        with:
          dir: site

Sphinx, in the same way: uvx --from sphinx sphinx-build -b html docs _build/html, then dir: _build/html.

Before the first push, run the build locally and check what would be uploaded: margent push dist --dry-run.

Comments that point at the source

On a built page, a comment knows its page, quote and position, but not where the text lives in your sources. Two optional additions help your agent go back to the source:

  • Source lines. If your generator renders Markdown, have it keep the source positions as data-sourcepos attributes, for example with markdown-it and a sourcepos plugin, or cmark --sourcepos. Comments then carry file and line, as in Markdown pages.
  • A manifest.json at the root of the upload names each page’s title, kind and source file:
{"documents": [
  {"path": "guide/setup/index.html", "title": "Setup",
   "source_file": "docs/guide/setup.md"}
]}

If only part of the build is for review, an owner can set a Content root in the project’s settings (for example docs/), and only that folder is shown.