Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Experimental R package for building Hugo websites with RMarkdown, converting .Rmd to .md for Hugo to render.
hugodown is an experimental R package from the r-lib organization that connects RMarkdown to the Hugo static site generator by converting .Rmd files into .md files that Hugo renders into HTML.
hugodown is an experimental R package maintained by r-lib that bridges RMarkdown and the Hugo website generator. It takes .Rmd files as input and produces Hugo-compatible .md files as output, which are then converted to HTML by Hugo's own build process. hugodown enforces a strict role separation: it handles the transformation from Markdown with R code to plain Markdown, while Hugo handles the transformation from Markdown to the final website. This package is similar in purpose to blogdown but focuses exclusively on Hugo websites and uses a single RMarkdown output format.
site_outdated() function lists all .Rmd files that have changed since their .md was last rendered, so you know exactly what needs to be re-knitted.use_post() creates a new post using the Hugo archetype, filling in default content from templates.hugo_start() launches a Hugo server in the background, so you can see your site update as you edit.hugodown is aimed at R users who author content in RMarkdown and want to publish it as a Hugo website. It suits bloggers who prefer to knit posts only when needed rather than rebuilding the entire site, and teams with multiple contributors where a shared site benefits from explicit re-rendering. It also helps users who want Hugo themes to work correctly with html widgets, syntax highlighting, and math without manual configuration.
use_post(), knit it to generate Hugo-ready Markdown, and preview the site with hugo_start().site_outdated() to identify posts that need re-rendering and avoid stale output in the published site.hugodown::md_document() and removing the root index.Rmd.To use hugodown, set output: hugodown::md_document() in the YAML metadata of your .Rmd files. Knitting then produces a .md file designed to work with Hugo. In RStudio, you can open the site's .Rproj file, call hugo_start() to start a background preview server, and use the Knit button or the keyboard shortcut Cmd+Shift+K (Mac) or Ctrl+Shift+K (Windows/Linux) to render posts. The Hugo server only adds .Rmd content to the preview after knitting.
No. hugodown is not available from CRAN yet and may never be, but the development version can be installed from GitHub with devtools::install_github("r-lib/hugodown").
hugodown enforces a strict partition: it only converts .Rmd to .md, and Hugo converts .md to HTML. It re-runs R code only when you knit, pins local Hugo versions, and provides theme setup helpers, but it does not support within-page cross-references for figures, tables, and equations.
No. hugodown provides support for a limited number of themes, automatically adjusting them so that html widgets, syntax highlighting, and math display work out of the box.
Use the use_post() function, which creates a new post and fills in default content from the Hugo archetype configured in your site.