Skip to contents

The announce_post function automates the task of announcing a blog post. It extracts metadata from the post's YAML front matter, generates relevant messages, and posts announcements to various platforms: Bluesky, LinkedIn, Mastodon, and via newsletter.

Usage

cast_announce_post(post)

Arguments

post

A character vector of length one, representing the file path to the blog post. The function only supports a single file path and uses the first value if provided with more than one.

Value

The function does not explicitly return a value (NULL). It performs side effects by creating posts on external platforms and sending out a newsletter.

Details

  1. Checks that the post argument is provided and raises errors or warnings as needed.

  2. Reads the YAML front matter of the blog post to extract metadata such as tags, slug, image, and additional fields used for announcements.

  3. Converts tags into a hashtag-based format.

  4. Constructs a shortened URL for the blog post based on its slug.

  5. Posts the announcement to:

    • Bluesky: Posts a truncated message along with an image.

    • LinkedIn: Posts the full summary along with an image.

    • Mastodon: Posts the SEO description, image, and alternative text.

  6. Sends the metadata to generate a newsletter notification.

Examples

if (FALSE) { # \dontrun{
post <- "blog/post/2023-10-05-my-blog-post/index.md"
announce_post(post)
} # }