Skip to contents

The create_message function generates a formatted message string using information from the blog post's metadata, including the title, custom text, a randomly selected emoji, a URL, and associated tags.

Usage

create_message(frontmatter, uri)

Arguments

frontmatter

list from a yaml section

uri

url of the post

Value

A character string containing the formatted message, which includes:

Title

The title of the blog post.

Emoji

A randomly generated emoji to add personality to the message.

Text

The input text, passed in its entirety.

URL

A link to the blog post.

Tags

Hashtags derived from the blog's metadata.

Details

The function uses the glue package to assemble a string with placeholders for pre-defined variables, including the blog post title, emoji, URI, and tags. These variables should exist in the global environment or accessible scope when this function is called.

Examples

if (FALSE) { # \dontrun{
# Assuming variables are defined in
# the global environment:
frontmatter <- list(
  title = "Learning R Programming"
)
emoji <- "\U0001F525"
uri <- "https://example.com/a-blog-post"
tags <- "#RStats #DataScience"

# Create a message
create_message("Check out this insightful blog post!")
} # }