[New Features on steemr] Functions for saving the posts and building an independent blog site!

By Peng Zhao | July 4, 2018

  • Do you want to backup your Steem posts in a local disk? The new functionbmd() (build markdown files) saves the posts in the local path as markdown files easily.

The following example shows how to get all the posts by @dapeng and save the posts as markdown files in the local PC with bmd() :

tgidposts <- gidposts(id = 'dapeng', method = 'appbase_api')
bmd(post_df = tgidposts)

Then the user gets the markdown files '*.md', each of which is a Steem post. The use can view them via any text editor (recommended: Typora).

If the parameter 'if_yaml' is TRUE, each md file will get a header with the title, posting time stamp, tags, original links, etc., which would be very useful for other R packages, such as R blogdown or R bookdown.

bmd(post_df = tgidposts, if_yaml = TRUE)

2018-07-04-001.jpg

A screenshot of the markdown file created by steemr bmd() function.

  • Do you want to build an independent blog site with your posts? The new function bblog() builds a Hugo blog from the given posts.

The following example shows how to build a blog site from all the Steem posts by @dapeng with bblog() :

bblog(author = 'dapeng', post_df = tgidposts, initial = TRUE)

The user will get a folder, containing the structure of a Hugo blog site. It can be viewed locally with the R blogdown package, or deployed by netlify.com. More details could be found in the R blogdown book.

2018-07-04-002.jpg

A screenshot of the blog site created by bblog() function.

Yes, you can visit this blog site even when steemit.com or busy.org is down!

Currently only simple blog template xmin is available. In the future more templates will come! For example, here is a backup site of my own:

2018-07-04-004.jpg

  • Some minor literal changes in the documentation were performed and small bugs were fixed.

How did I implement them?

I added these new functions in 'R/build.r'.

I created a template for the Hugo blog in 'inst/template/blogdown_xmin.zip'.

I added a clear_title() function in 'R/internal.r' as an internal function to support the two functions mentioned above.

Links to relevant lines in the codes on GitHub can be found mainly in my latest commits (click to see the details):

comments powered by Disqus