Skip to content

feat: copy static/ to the output root - #8

Merged
lucasnevespereira merged 2 commits into
mainfrom
feat/static-dir
Oct 6, 2026
Merged

lucasnevespereira merged 2 commits into
mainfrom
feat/static-dir

Conversation

@lucasnevespereira

@lucasnevespereira lucasnevespereira commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds one convention: if a site has a static/ folder, its contents are copied to the root of the output as is. Sites without the folder are unaffected, and there is no new ink.yaml option.

 my-site/
 ├── pages/
 ├── assets/        →  public/assets/...
+└── static/        →  public/...        (robots.txt, CNAME, demo.html)
 Build
   copyTheme
   copyAssets
+  copyStatic       # before pages, so a built page wins a name clash
   buildPage (each)

Until now nothing but built pages could land at the site root, so robots.txt, a CNAME, a verification file or a standalone HTML page needed a copy step outside inkssg. That also meant inkssg serve could not serve them. The watcher already covers the whole project, so static/ changes trigger a rebuild with no extra code.

Evidence

  • Before: a file in static/ is ignored by inkssg build.
    After: new test TestBuildCopiesStaticToOutputRoot:
given pages/index/content.md, static/robots.txt, static/img/logo.txt, static/index.html
build
  public/robots.txt    == static/robots.txt
  public/img/logo.txt  == static/img/logo.txt
  public/index.html    is the built page, not static/index.html
$ go test ./...
ok  	github.com/snowztech/inkssg
  • go vet ./... passes and the minimal, multi-page and bio examples still build.
  • CI now runs go test ./.... This is the first test in the repo.
  • Ran inkssg serve on a scratch site: /added.txt returned 404, then 200 after the file was dropped into static/ and the log printed ↻ rebuilt. Dotfiles (.well-known/security.txt) are copied, and static/assets/x.txt overrides assets/x.txt.
  • Docs: new "Static files" section in docs/inkssg.md (uses, assets vs static table, clash order, serve), a short table in the README, and a robots.txt in the multi-page example.

Merge Danger

Door: one-way

Once released, sites will depend on static/, so removing it later is a breaking change.

It also changes a written decision: one assets/ directory, one copy rule. This makes it two rules. PRINCIPLES.md is updated to say paths are literal for both folders.

Blast Radius: small

  • An existing site that happens to have a static/ folder will start publishing it at the root.
  • copyDir ignores read and write errors, as it already does for assets/.

@lucasnevespereira
lucasnevespereira merged commit 0f0f6a7 into main Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant