pages: republish in place, keeping the slug

Open
#9,366 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
cli, javascript
Domain
api, cli

Research direction

Start by reading the chroxy publish command and the POST /api/pages handler, then inspect the existing page persistence and publish tests. Trace how page content, slug, title, timestamp, and authentication are handled. Done means replacement preserves the URL, missing slugs fail without creating a page, the page list still has one entry, JSON output retains its shape, and tests cover replacement, missing slugs, and auth.

Written by the indexing model from the issue text.

Description

complexity: low enhancement server

Problem

chroxy publish always creates a new slug. A page that is rebuilt on a schedule (for example a monthly report) gets a new share URL every time, so:

  • the people holding the link have to be sent a new one after every rebuild, and
  • the publisher has to remember to chroxy pages rm the previous slug, or old copies stay live.

Proposal

Let a publish replace the content of an existing page and keep its slug:

chroxy publish out/index.html --replace <slug>
  • Writes the new HTML to the existing page, keeps the slug and share URL, and updates its title and timestamp.
  • Fails (non-zero exit, nothing changed) if the slug does not exist, so a typo never mints a new page by accident.
  • --json output stays the same shape as a normal publish.
  • The matching POST /api/pages call takes the slug and has the same auth as publish.
  • A way to rotate the slug on purpose stays available: publish new, then rm the old one.

Acceptance

  • Replacing a page keeps its URL working, and the URL serves the new content.
  • Replacing a slug that does not exist exits non-zero and creates nothing.
  • chroxy pages list shows one entry for the page before and after a replace.
  • Tests cover replace, a missing slug and auth.
Dominant language
JavaScript
Stars
7
Forks
1
Avg merge
2h 3m
Merged PRs (30d)
333

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from blamechris/chroxy

All issues in blamechris/chroxy

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.