Author Original Content on the Website

Let's learn how to author original content such as blog posts, tutorials, research articles, and project write-ups using R Markdown.

Introduction to R Markdown

More than anything else on the website, original content is an opportunity to share our ideas and captivate our viewers. For personal websites, original content often takes the form of blog posts, tutorials, research articles, and project portfolios. In all likelihood, our website visitors will spend most of their time reading our original content.

We can author original content using either R Markdown or plain Markdown documents. The output will reside on our website’s “Posts” page. R Markdown is recommended for authoring original content. It is very similar to plain Markdown with one major exception: R Markdown supports the integration and execution of R, Python, and SQL code within the document.

This means our content can include dynamic output such as code printing, interactive tables, interactive graphs, and any other form of output generated from these programming languages. We can also embed Jupyter Notebooks stored externally (such as on GitHub Gist). For these reasons, R Markdown is substantially more flexible than plain Markdown for writing technical content.

Posts

Posts are a valuable feature of the blogdown website that allows us to present our content in an organized manner. Blogdown posts are written in Markdown files and, at compile time, Hugo will automatically knit the Markdown to create a corresponding HTML file.

Add a post summary

We can add a summary to our R Markdown post to summarize the post beneath its title on the homepage. We can create a summary parameter in the document metadata to add a summary.

Add a table of contents

We can add a table of contents to our R Markdown post to improve navigation and enable an overall better user experience. To add a table of contents, we can edit the output parameter and set toc: true in the document metadata.

Add code highlighting

Code highlighting improves the readability of our code snippets. We can edit the output parameter and set highlight: tango in the document metadata to add code highlighting.

Though we recommend the tango highlighting scheme, other code highlighting options are also available.

Add tags and categories

Adding tags and categories to our posts can organize our content and give Google crawlers an idea about our posts’ content. A good practice is to attach no more than 5 to 10 categories and 5 to 10 tags to each post. To add tags and categories to our post, we can edit the tags and categories parameters in the document metadata.

Add a post thumbnail

A post thumbnail is an image that appears above the post title on the homepage and at the beginning of the post itself. To include a thumbnail for a post, we can create a thumbnail parameter in the document metadata and insert the path to our image located in the static/images folder.

Get hands-on with 1200+ tech skills courses.