What a post is, not what it says

Part 3 of 3 of ./blog.sh v1.7

Five parts of a series written over a spring, and the third went out without its series: line. The site did what it was told. Part three sat at its date and nowhere else: off the series listing, out of the links from one part to the next, and out of the count the other four wear: part four's page called itself part 3 of 4, standing in the slot the missing post should have had. The fix was one word.

Getting to that word meant opening the article.

That is what edit does. It reads the post out of its file, writes the whole thing back out as markdown, opens it in an editor, and parses what comes back. For a post that is paragraphs and photographs the round trip is faithful and nothing is at stake. For a post carrying something markdown has no form for, it is not.

Seven rows

props <slug> gains [e] -- on a draft, on a scheduled post and on a published one alike.

The properties screen: series, part, tags, type, and three flags with their current values
The screen behind [e]. Two rows answer with the site's own default rather than yes or no -- that is the third state.
Properties of part-three -- what the post is, not what it says:

  1) series          (none)
  2) part of series  (none)
  3) tags            spring
  4) type            text (from the content)
  5) unlisted        no
  6) lead image      (the site's own)
  7) chapter list    (the site's own)

Two rows are pickers rather than prompts. The series row lists the series the site already has, each with the number of posts carrying it, and drafts count -- a series that so far exists on one unpublished post is offered too. It is a list because a series typed a second time is a second series; the last row is a field, for one the site does not have yet. check reports two names a few characters apart, but only after the parts are split between them. The type row lists the eight the engine ranks -- document, video, audio, image, chat, quote, link, text -- with the way back to letting the content decide above them, saying which type that is.

The tags row is a field, because a line of commas is how tags are written everywhere else here. Above it the screen prints up to fifteen of the site's most-used, and it reads the answer exactly as the front matter reads it: commas split, a leading hash off, brackets off, empties dropped. [release, foto] typed into that row is two tags, not two tags wearing punctuation.

What the screen is for

The same post, the same change, two ways. The post has a link card at the top and one small span inside a paragraph. The change is its tags.

edit stops before saving:

Careful, saving this would lose: 1x small span.
Really continue? Type "yes":

Anything but that word cancels the save entirely. A small span is a formatting run markdown cannot write, so the round trip hands back the words without it -- and no block changes type on the way, which is why the guard counts spans as well as blocks.

[e] changes the tags, leaves the post's content identical and asks nothing, because nothing is owed. The screen reads the file, replaces one key, writes the file back. Nothing is converted in between.

Three states, not two

unlisted is a yes or a no. The other two are not.

A post that says nothing about a lead image is not a post saying no to one. It takes layout.hero from site.yml. A post that says nothing about a chapter list takes the engine's own rule: the list appears by itself from four headings up. So those rows read yes, no, or (the site's own), and the third has to be reachable: choosing the row a third time lifts the key back out of the file rather than leaving a false behind.

What it refuses

A part number without a series. It says so instead of storing a field nothing reads. Clearing the series takes the part number with it, so a post rejoining a series later does not arrive with a position from a different one.

A number outside 1 to 9999. A 0 above all: a series has a first part and no zeroth one, and the build clamps a 0 to the front, so the screen would have printed "part 0" about a post every page of the site calls part 1. An answer it cannot use changes nothing and leaves the row showing what the post still carries.

The title, the date and the text. Those are the post rather than facts about it, and they remain the editor's business. The slug has its own key on the frame above, and on a published post so does the pin.

What it costs

A rebuild, once. Setting a series and choosing a type are two answers to one question, so the rebuild is offered when the screen is left, not after each row -- and a series or a tag is not one page, it is listings.

And it can refuse to save. The screen sits at a prompt for as long as somebody takes to answer, and the scheduled-publish cron runs every fifteen minutes. If the file changed underneath, the write is abandoned and says so, rather than putting a post the cron has just published back to a draft.

Comments