I was using Hugo for static site generation with Beautiful Hugo as a theme. The theme is known for its balancing act between simplicity and proseness for a blog. With Hugo its a fast act to creating and publishing the contents.
It was all good until I wanted to embed a HTML page. iFrame is always there but including the charts, especially interactive ones generated as HTML is tough to embed in the post (at least for me). I do feel interactive charts are better than the static charts.
I have tried few avenues for chart creation R → D3JS and then settling back to R. My tryst with the charting can make up for its own post, someday I'll share the hardships I faced.I was using plotly to have interactive charts that ends up as HTML file. I have 2 options to have this file in my blog post.
- Using iFrame and embedding the HTML in my page, or
- Redirecting to HTML chart
Both of these options looked not so nice.
Then I came across the Blogdown and its support for R Markdown. The beauty of Rmd file is its potential to host the charts or run R code (even it supports some other languge code executions, like Python via Reticulate). Also, the blogdown parser is very much compatible with older posts too.
If I wanted to add a chart, the workflow is simple.
- Prepare the code in R Studio.
- Once the code is ready, add it to R Markdown file.
- Knit it
- Move the resulting folder into the blog’s project.
Last few posts were published via blogdown and written in R markdown instead of plain vanilla markdown file, the migration is frictionless.
Page source
Page last updated on: 2024-11-06 09:30:05 +0530 +0530Git commit: a98b4d9