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 |
This function allows you to insert a Read More tag into your post.
read_more()
read_more()
used in your inline code wherever you want in your index.Rmd
Read More tag
goodpress::read_more()
goodpress::read_more()
This function helps you get your WordPress categories details so that you can use for your YAML header.
wp_categories(wordpress_url)
wp_categories(wordpress_url)
wordpress_url |
URL to your website |
A data frame with category ids and names
## Not run: wordpress_url <- "https://rmd-wordpress.eu" # replace with your own (test) website wp_categories(wordpress_url) ## End(Not run)
## 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
wp_post(post_folder, wordpress_url, encoding = "UTF-8")
wp_post(post_folder, wordpress_url, encoding = "UTF-8")
post_folder |
Path to folder where the post
(index.Rmd with |
wordpress_url |
URL to your website |
encoding |
Encoding argument to readLines |
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.
URL to the post (invisibly)
## 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)
## 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)
This function helps you get your WordPress tags details so that you can use for your YAML header.
wp_tags(wordpress_url)
wp_tags(wordpress_url)
wordpress_url |
URL to your website |
A data frame with tag ids and names
## Not run: wordpress_url <- "https://rmd-wordpress.eu" # replace with your own (test) website wp_tags(wordpress_url) ## End(Not run)
## Not run: wordpress_url <- "https://rmd-wordpress.eu" # replace with your own (test) website wp_tags(wordpress_url) ## End(Not run)