dev.to.ol
is 0.0.1!
.to.ol
The goal of dev.to.ol
is to help R users publish to dev.to
Installation
You can install the dev.to.ol from github with
remotes
:
remotes::install.github("DaveParr/dev.to.ol")
Workflow
Create your article
The create_new_article
function will give you the front mattter
boilerplate for an article .Rmd
file. Optionally supplying a file name
will create a new file with the front matter at the start.
create_new_article(title = "my title")
Write your article!
This is the fun bit. Mark your great ideas down in an .Rmd
!
Post your article
Once the .Rmd
is written, you can post it to dev.to with
post_new_article
post_new_article("./my-great-article.Rmd")
Check your articles
There are two functions to check the posted articles on dev.to, published and unpublished. Both will return a ‘tidy’ data set by default.
get_users_articles()
Using DEVTO in .Renviron
The API returned the expected success
…What’s in the box?
dev.to.ol has the minimum set of viable functions I think it needs to
operate, and (just) enough testing to keep it stable. The api is
starting to come together and there seems to be at least 1 other person
who cares enough about this project to talk about it to someone else, so
I thought it might be handy to get a little more together about things.
I also wanted to make up a celebration to share a little about why I
made it and what dev.to means to me.
Are there other similar boxes?
R is in many ways a literate programming language. Markdown is pretty
baked into most of our ecosystem through R
Markdown, as is
LaTeX. I think because of this,
and the frequent usage in academic publishing, R users have developed
tooling for blogging pretty heavily. We have
blogdown and
distill which are becoming very
widely used and feature rich, and @maelle
has written a pretty
comprehensive guide to all the different approaches in the Scientific
Blogging with R Markdown
course including her own
solution for Wordpress,
goodpress. As Data Scientists
(emphasis on the science), we need to share our work reproducibly, and
in a way that encourages understanding and review.
So why have another box?
I was looking for something to keep me sane while I was furloughed.
Also, I had poked around dev.to about a year before, and was impressed
by what I took to be it’s un-official mission statement of “We aren’t
Medium, we’re what Medium should have been”.
Medium Was Never Meant to Be a Part of the Developer Ecosystem
Ben Halpern ・ Jun 3 '19 ・ 5 min read
I’m sure there is a lot more to it than that, especially with the recent
Forem
announcement, but personally, that was a hook I perceived which really
stuck me.
However, at the time the in built editor was “fine”. Fine enough, but
not great. I’m also used to R Notebooks, where I write my code next to
my prose, and compile the whole thing in one. It seemed valuable to
bring that ability to my dev.to posts. I also was aware of all the
alternatives above, but dev.to offered 2 things that were different to
the above options:
Hosted and managed service
Don’t get me wrong, I have nothing but love for JAMstack and static
sites in general. I maintain a template for making them for SatRdays
conferences.
However, I don’t love the process of doing it. In this case I absolutely
believe in the cause, which is why I continue to volunteer on the
project. However, the process of interacting with static sites doesn’t
actually make me happy.
I was looking for the simplest way I could casually blog, which ideally
required no extra work beyond writing articles (to start with).
Community
I wanted at least a few people to read my articles, and I wanted to read
theirs. I’m sure I could have accomplished this with more work in SEO,
cultivating a social media network and all that jazz, but again: I just
wanted to write some stuff that some people might read, and read their
stuff. dev.to had a discovery feed, it had active users, it had
community. This was just what I was looking for. I also kind of hate
twitter (yes, I still use it when I ‘have’ to).
Motivation
Initially my work flow sucked. I wrote an .Rmd
in RStudio. Compiled it
to a GitHub flavoured .md
. Copy and pasted the output into the editor,
added the meta data, then uploaded all the images. If I found I’d made a
mistake, I’d either do the right thing, which was edit the .Rmd
,
recompile, re-copy-pasta, or I’d more often do the quick thing which is
enter the browser editor and fix the typo.
Inception
As I was chewing over the best way to make this work gooder (I am a
programmer after all), a few things happened simultaneously.
Most of the R users on the site syndicate
There are some really great R users on here already:
I found out that most of the R users here I follow are actually
re-syndicating through rss:
@ma_salmon @DaveParr @_ColinFay @ThePracticalDev Under Settings ➡️ Publishing from RSS, you can add the RSS feed from your blog. The posts will go to your Dashboard as drafts. I do need to edit them slightly before publishing (for example, switching out for their shortcodes for a few things).14:39 PM - 13 May 2020
That’s great for them, but I was actually trying to avoid my own site!
Dev.to has an API
I was poking around older posts and found out that dev.to has an
API. At the time I thought I might play with
webhooks to boot ‘saved’ articles into pocket to work on my e-reader (at
some point I still might). However, in this case it was kind of perfect.
An API driven work flow between .Rmd in RStudio and the hosted dev.to
community. I could see it in my head, and it’s not like I was busy in
May…
Posting from .Rmd to dev.to
Dave Parr ・ May 20 '20 ・ 4 min read
Evolution
After proving it ‘might’ be doable, I did some work fleshing out the
‘best’ way to do it.
Posting straight from .Rmd to dev.to (for real this time)
Dave Parr ・ May 24 '20 ・ 4 min read
So I started some super-basic minimum viable functions. How do I get the
post to turn up on dev.to? How do I make the meta-data work with the
post? What happens if I’ve published and need to correct a typo? All
solvable, all import features, and all now implemented and tested. I got
to learn a lot about testing API wrappers with vcr
thanks to @sckott
.
Testing my dev.to API package with testthat, webmockr and vcr
Dave Parr ・ Jun 3 '20 ・ 6 min read
The functions in the package changed a bit as I went through user
testing by using it to write my posts on dev.to that you can see here. I
was also able to generate content pretty quick because I could write
about developing the functions that I was testing at the same time by
writing the articles. Virtuous cycles! (/ black holes)
At this point I was also starting to look for new work, and was
wondering about if I had made the choice backwards. Maybe I did need my
own site after all. Somewhere to put my CV, and that looked a bit more
professional, and maybe didn’t have so much clutter of articles mixed
with my own questions and a bunch of content from other people. Then I
discovered the @stackbit integration!
You can now generate self-hostable static blogs right from your DEV content via Stackbit
Ben Halpern ・ Sep 26 '19 ・ 4 min read
This meant that I could hand off all the hosting and styling and
management and deploys to them, but still get a hugo repo which I can
tailor how I want, such as removing the #meta
and #help
posts, which
wouldn’t be useful to a recruiter, but also automatically put my content
into a presentable site, with a few contextual links to thing like my
GitHub and LinkedIn under my personal daveparr.info
domain.
I made my dev.to content into a website to find a new job
Dave Parr ・ May 25 '20 ・ 2 min read
Future
The primary future goal is finding a good way to reference images in the
article in a way that dev.to can use. It’s likely that this will end up
being github itself. Additionally better testing is probably on the
cards as I go. The functions and package API have stabilised enough now
that this can be comprehensive, and getting some CI/CD would be nice
too. I’m also planning on working on smarter ways to run analytics on
the data you can get back from the API about your posts. Maybe even an
inbuilt shiny app?
I hope some others of you might find the package useful, and maybe this
might motivate you to share the work you might already be doing in R, or
even pick up R as a new language!
Photo by Erwan Hesry via
Unsplash
Top comments (0)