Package 'goodpress'

Title: From R Markdown to WordPress with a Modern Stack
Description: Helps you write from R Markdown to Wordpress directly.
Authors: Maëlle Salmon [cre, aut] , Henry Wang [aut]
Maintainer: Maëlle Salmon <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-11-12 03:25:50 UTC
Source: https://github.com/maelle/goodpress

Help Index


Add "Read More" Separator

Description

This function allows you to insert a Read More tag into your post.

Usage

read_more()

Details

used in your inline code wherever you want in your index.Rmd

Value

Read More tag

Examples

goodpress::read_more()

Get WordPress Categories

Description

This function helps you get your WordPress categories details so that you can use for your YAML header.

Usage

wp_categories(wordpress_url)

Arguments

wordpress_url

URL to your website

Value

A data frame with category ids and names

Examples

## Not run: 
wordpress_url <- "https://rmd-wordpress.eu" # replace with your own (test) website
wp_categories(wordpress_url)

## End(Not run)

Post a post to Wordpress

Description

Post a post to Wordpress

Usage

wp_post(post_folder, wordpress_url, encoding = "UTF-8")

Arguments

post_folder

Path to folder where the post (index.Rmd with hugodown::md_document output format, index.md, images) lives

wordpress_url

URL to your website

encoding

Encoding argument to readLines

Details

Several aspects of the post can be controlled by the YAML of index.Rmd.

---
title: "Title of the Post" # compulsory!
date: "2020-04-01T00:00:00" # compulsory!
author: "admin7891" # Either omit the field (the author will be
#  the authenticated user) or use an username
slug: "post-slug" # Important especially if the slug is in the URL
excerpt: "Here I summarize this fantastic post"
status: "publish" # One of: "publish", "future", "draft",
#  "pending", "private"; "publish" by default
output: hugodown::md_document # Don't change this
categories: # Categories, optional, will be created if
# the post is the first with the category
  - math
- Code and Stuff
tags: # Tags, optional, will be created if
# the post is the first with the tag
  - crul
  - mathjax
  - R packages
comment_status: closed # Either closed (default) or open
ping_status: closed # Either closed (default) or open
---

The package cannot handle private posts with password, only private posts that are visible to admins and editors only. You could create a private post, and then from the WordPress interface make it visible with password. Make it private again before trying to update the post with the R package.

Value

URL to the post (invisibly)

Examples

## Not run: 
# this requires authentication!
post_folder <- system.file(file.path("post-example"), package = "goodpress")
tmp_post_folder <- file.path(tempdir(), "post")
dir.create(tmp_post_folder)
file.copy(dir(post_folder, full.names = TRUE), tmp_post_folder)
wordpress_url <- "https://rmd-wordpress.eu" # replace with your own (test) website
wp_post(tmp_post_folder, wordpress_url)
file.remove(dir(tmp_post_folder, full.names = TRUE))

## End(Not run)

Get WordPress Tags

Description

This function helps you get your WordPress tags details so that you can use for your YAML header.

Usage

wp_tags(wordpress_url)

Arguments

wordpress_url

URL to your website

Value

A data frame with tag ids and names

Examples

## Not run: 
wordpress_url <- "https://rmd-wordpress.eu" # replace with your own (test) website
wp_tags(wordpress_url)

## End(Not run)