A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1/**
2 * The dashboard→editor "edit this article" link, and the editor-side parser for
3 * it. Kept together so the `?edit=` param name has a single source of truth.
4 * `rkey` uniquely identifies a document within the writer's repo, so it is all
5 * the editor needs to re-fetch the article on load.
6 */
7const EDIT_PARAM = 'edit';
8
9/** The editor URL that opens an existing article for editing. */
10export function editLinkFor( rkey: string ): string {
11 return `/editor?${ EDIT_PARAM }=${ rkey }`;
12}
13
14/** The rkey to edit, parsed from a URL search string (e.g. `window.location.search`). Null when absent or empty. */
15export function editRkeyFromSearch( search: string ): string | null {
16 const rkey = new URLSearchParams( search ).get( EDIT_PARAM );
17 return rkey && rkey.length > 0 ? rkey : null;
18}