Page MenuHomeWrite.as

Send title when publishing
Closed, ResolvedPublic

Description

Overview

As part of T603, the CLI should send a title parameter with posts.

Background

This functionality is delegated to WF/Write.as clients to handle.

Implementation

Like the web editor, we should assume the title is given only when a post begins with a Markdown H1, e.g.

# Title

Body

(in this case, the title is Title.)

We already have a shared helper function that provides this capability: [posts.ExtractTitle()](https://godoc.org/github.com/writeas/web-core/posts#ExtractTitle) in the web-core package.

Event Timeline

matt triaged this task as High priority.May 30 2019, 2:19 PM
matt created this task.

I'm pretty sure this is already implemented. I'm going to look over the current version-two code as I write and think out loud.

writeas new calls api.HandlePost which calls api.DoPost. This does use the posts.ExtractTitle helper and then creates the post with go-writeas.Client.CreatePost.

writeas publish does about the same thing but with a file on disk.

writeas post also does this but reading from stdin.

If I create a new post from post, new, or publish` all have the correct title after calling writeas posts