Skip to content

Publishing

Blog posts and their destinations

Write a blog post with its images, check it, and send it after your approval to files for a static site, to WordPress, to a webhook or to the read API of your server.

Last updated:

You will learn#

  • how to write a post with a front matter and the images of your project;
  • which destination fits your blog: files, WordPress, a webhook or the read API;
  • why a post waits for your approval like any other publication;
  • how your receiver checks that a webhook delivery came from Stuarty.

The idea#

A post is a text of the kind post: a front matter between two lines of ---, then the body in Markdown. Its images are images of the project, written as ![alt](asset:ast_0123456789); a picture from another address is refused, so nothing outside the project is ever fetched. Stuarty checks the post and renders it to HTML with its own renderer, which escapes every character of the text, so the HTML a destination receives carries no script.

A destination is a connection of one of five kinds. A post is published like a video: it is a target of a publication on the calendar, it waits for your approval, and what is sent is exactly the post you approved.

KindWhat it doesLeaves your computer?
blog_fileswrites <slug>/index.md and images/ (or a zip) into a folder you chose, with the front matter of Astro, Hugo, Jekyll or your own templateno
blog_wordpressuploads the images to the media library, then creates the post as a draft or published; a second send updates the same postyes, to your site
blog_webhooksends the post, signed, to a public URL of yoursyes, to that URL
blog_webhook_localthe same, to a URL on this machine or your own networkyes, to that URL
blog_apipublishes the post on this server, for your own system to read with a keyno

Write a post#

Text
---
title: How I cut a video in a day
slug: how-i-cut-a-video-in-a-day
summary: One sentence for the list and the search result.
tags: video, editing
cover: ast_0123456789
language: en
---
The body, in Markdown, with a picture: ![the desk](asset:ast_0123456789)

title is required. The slug is made from the title when you leave it out. The renderer knows headings, paragraphs, quotes, lists of one level, fenced code, rules, bold, italic, code, links and images; anything else stays text, and a link that is not http, https, mailto, a path or an anchor is written as its text.

Quick start#

  1. Open Writing, choose New text, the project and the kind Blog post, and write the post. Save it: the Blog post panel shows what to fix, the images it found and how the body reads.
  2. Open Connections, find Blog destinations, choose the destination and fill its form. A folder must exist; a WordPress needs an application password made in your profile in wp-admin; a webhook needs a signing secret of 16 to 256 characters.
  3. Open Publishing, choose New post, pick A blog post under What you publish, then the post, the destination, Draft or Published, and a time.
  4. Save, then Schedule and ask for approval, and approve it on the Approvals page.

For the read API, make a key with the scope posts:read on the API keys page (network mode): that key reads the published posts and nothing else.

Check a webhook delivery#

Every delivery is one POST with a JSON body and three headers: X-Stuarty-Delivery (the same in every retry of one send), X-Stuarty-Timestamp (Unix seconds) and X-Stuarty-Signature, which is v1= followed by the hex of an HMAC-SHA256 with your signing secret:

Text
HMAC-SHA256(signing_secret, timestamp + "." + delivery + "." + body)

Your receiver computes it over the exact bytes of the body, compares it in constant time, refuses a timestamp more than 5 minutes from its clock, and may drop a delivery id it has already seen. A transport error, 408, 425, 429 or 5xx is retried; a redirect is never followed, so give the final address.

Common mistakes#

  • E_VALIDATION on body.images: an image is not an image of the project. Import it, then write ![alt](asset:<id>).
  • E_VALIDATION on endpoint when you add a blog_webhook: the address is on this machine or a private network. Use blog_webhook_local for a service you run yourself.
  • E_CONNECTION_DESTINATION when a webhook is sent: the name of the host resolved to an internal address. A public webhook never delivers inside your network.
  • A post with the visibility Draft sent to the read API is stored as a draft, which the routes do not list.
  • slug_taken when sending to the read API: another post already holds that slug. Give the post its own slug.

What never leaves your computer#

  • No post is sent before you, or a rule you wrote, approved it, and an image that changed after the approval is not sent.
  • The files and read API destinations open no connection at all; WordPress and a webhook reach only the address of their connection.
  • The application password and the signing secret live in the vault and are never shown or returned.

Next steps#