- Fixed the bug that shortcodes were mangled when there are raw HTML blocks in the Markdown output from R Markdown (thanks, @Redcozmo, #759).
-
new_site()
no longer uses the command-line flag-f
forhugo new site
, because the-f
flag has a different meaning since Hugo v0.112.4 (thanks, @residualsun1 https://d.cosx.org/d/424434, gohugoio/hugo#11015). -
Supports
hugo.toml
/hugo.yaml
as the new config file for Hugo >= 0.110.0 (thanks, @mengjiezhang4ds, #753).
-
The RStudio addin "Quote Poem" adds
>
to every line instead of only the beginning of every paragraph now. -
The "New Post" addin will verify if Hugo has been installed before launching (thanks, @LukasWallrich, #750).
-
Added the command-line option
--preserve-tabs
to thepandoc_args
argument ofblogdown::html_page()
, so that tabs are preserved by default in code blocks (thanks, @amarakon, #740). -
Fixed a bug that caused
config.toml.bak.toml
to be recognized as the config file mistakenly, which led to an obscure error (thanks, @CerebralMastication, #742). -
This package requires R >= 3.5.0 now.
- Restored the old default
options(blogdown.method = "html")
(thanks, @pachadotdev, #739).
-
For R Markdown posts, the default rendering method has been changed from
html
tomarkdown
. Ifoptions('blogdown.method')
is not set, it will be set to'markdown'
. This option will also be set in.Rprofile
for newly created sites viablogdown::new_site()
. Users who have already set thisblogdown.method
option will not be affected. The motivation for this change is thatmarkdown
output often works better with Hugo themes and is less surprising, even though thehtml
method allows for richer Markdown features because of Pandoc (thanks, @SebPouliot #737, @austinwpearce #591). -
When rendering Rmd posts that involve time-consuming and intensive computing while serving the site, the
hugo
process can die (for unknown reasons). Now thehugo
process will be suspended before rendering Rmd posts, and resumed after the rendering is done. Hopefully this will keep the server process alive (thanks, @XiangyunHuang, https://d.cosx.org/d/423509).
-
Hugo has changed the installer filenames since v0.103.0, which caused failure in
blogdown::install_hugo()
. Now it can correctly find the installers (thanks, @giorgiatosoni, #729). -
Fixed a bug when a Hugo theme does not contain imported module paths in the config file, which caused failure in
blogdown::new_site()
(thanks, Nil, https://stackoverflow.com/q/73741045/559676).
-
Hugo changed the names of installers on macOS since 0.102.0, causing
blogdown::install_hugo()
to fail (thanks, @tianfeiwei, #727). -
Fixed a missing module problem with the
wowchemy/starter-hugo-academic
theme (thanks, @PsyYaoxiaoqiang #723, @oushujun #728).
-
blogdown::check_site()
also checksindex.Rmd
in the website root directory now (thanks, @maelle, #719). -
The
build_rmd
argument ofblogdown::build_site()
also accepts absolute paths under thecontent
directory now (thanks, @maelle, #717). -
Fixed a bug that
blogdown::serve_site()
fails with theignoreErrors
option is configured as an array inconfig.yaml
(thanks, @CongLiu-CN, #714). -
Fixed a bug for multilingual sites that have separate
contentDir
settings for each language, in which caseblogdown::new_post()
and the "New Post" addin in RStudio may create new post files in wrong locations (thanks, @pensivedog, #712). -
Fixed an issue with the
wowchemy/starter-hugo-online-course
theme (thanks, @bayeslearner, #722). -
Archetypes in modules were not found previously in the "New Post" addin (thanks, @atakanekiz, #670).
-
blogdown::install_theme()
works with themes that containgit
submodules now (thanks, @pensivedog, #712). -
The global option
blogdown.warn.future
has been removed. It was originally introduced in blogdown 0.12 to warn against posts that have dates in the future, which can cause posts to be ignored by Hugo. This option was removed becauseblogdown::check_site()
can identify this problem. -
Fixed a problem with the "New Post" addin in RStudio (thanks, @pingao777, #394). It did not work for sites that are not based on Hugo (e.g., Jekyll or Hexo).
-
For Jekyll sites, a new global option can be used to determine whether to run
jekyll
directly or use thebundler
gem to runjekyll
(i.e.,bundle exec jekyll
). If you prefer the latter way, you may setoptions(blogdown.jekyll.bundler = TRUE)
before runningblogdown::serve_site()
(thanks, @pat-s, #695). -
Adapted to some breaking changes in the wowchemy academic theme again (thanks, @bjsmith, #704). As mentioned in blogdown v1.4, we recommend blogdown users to consider using the hugo-apero theme when creating new sites. This theme is maintained by blogdown authors and much more stable.
-
Updated documentation to mention that the
tweet
shortcode (or the R wrapper functionblogdown::shortcode('tweet')
) will require the Twitter username for Hugo >= v0.89.0. Previously only the tweet ID is required, e.g.,{{< tweet 852205086956818432 >}}
, but now it also requires the user, e.g.,{{< tweet user="jtleek", id="852205086956818432" >}}
(thanks, @lcolladotor, #701).
- The RStudio addin "Insert Image" also works when the current document in RStudio does not belong to any site projects. Previously, it would throw an error if it is not used inside a site project. Now it works in any document in RStudio (thanks, @yufree, rstudio/rmarkdown#2280).
knitr::current_input()
doesn't work in inline R expressions in YAML metadata of Rmd posts (thanks, @brshallo, #647).
-
The bookdown config file
_bookdown.yml
under the site root directory is recognized now. For example, you can customize the figure label in_bookdown.yml
(thanks, @luofeicq, yihui/yihui.org#167). -
The internal function
scan_yaml()
uses cache in the current R session now. Other functions (e.g.,find_yaml()
,count_yaml()
, and the "New Post" addin in RStudio) based on this function should be much faster when there are a lot of files to scan for more than once.
-
For Hugo versions from 0.89.0 to 0.89.2,
new_content()
failed to identify new content files if they were created with archetypes (thanks, @maelle, #685). -
When creating new posts, YAML metadata inherited from Hugo archetypes could be mangled (thanks, @llrs, #684).
-
The
version
argument offind_hugo()
allows for the prefixv
in the version number now, e.g.,find_hugo('v0.89.2')
is equivalent tofind_hugo('0.89.2')
. This is also true to other functions that usefind_hugo()
, such asremove_hugo()
. -
Clarified
write_toml()
's error message that Hugo >= 0.37 is required to run this function (thanks, @pssguy, #665).
-
install_hugo()
did not work for Hugov0.20.3
. -
new_post()
failed to correctly detect the path of the new post with Hugo >= 0.89.3 (thanks, @rcarboni, #667). -
Deal with the new security policy in Hugo 0.91.0 by renaming the internal environment variable
BLOGDOWN_POST_RELREF
(in the shortcodelayouts/shortcodes/blogdown/postref.html
) toHUGO_BLOGDOWN_POST_RELREF
(thanks, @Nitheshnirmal #672, @gergiu #673).
-
The config file
config/_default/config.yaml
(or.toml
) is supported now; blogdown no longer requires thatconfig.yaml
(or.toml
) is under the root directory of the website project. Note that ifconfig.yaml
is present under both the root directory and theconfig/_default/
directory, blogdown will only recognize the former, and you may want to delete the former if you actually intend to use the latter (thanks, @Athanasiamo @maelle #611, @diegouriarte #598). -
install_hugo()
can automatically correct the version numberX.Y
toX.Y.0
whenX.Y
does not exist butX.Y.0
does. For example,install_hugo('0.87')
will actually install the version0.87.0
. -
Added a global option
blogdown.server.first
, which can be specified as a function to run before serving the site. For example, you can sync a JS file to thestatic/
directory withoptions(blogdown.server.first = function() { file.copy('../foo/bar.js', './static/js/', overwrite = TRUE) })
each time before you serve the site. -
Added arguments
arch
andos
toinstall_hugo()
so that users can choose the architecture and operating system names manually. For example,blogdown::install_hugo(extended = FALSE, arch = '64bit', os = 'FreeBSD')
would installhugo_*_FreeBSD-64bit.tar.gz
(*
denotes a version number) from https://github.com/gohugoio/hugo/releases. -
Added a new function
hugo_installers()
to print out the information about available Hugo installers of a certain version. This can be helpful wheninstall_hugo()
fails, e.g., the installer for a certainos
orarch
is not available.
- When creating new posts (either with
new_post()
or the RStudio addin "New Post"), the default post filename will be generated from the post title but it will exclude all non-alphanumeric characters. Previously the exclusion of these characters failed under certain locales (e.g., UTF-8 or a locale that has native support for multibyte characters). Now the default filename will no longer contain non-alphanumeric characters except dashes (thanks, yingjie, https://d.cosx.org/d/422702).
- The intermediate files
.knit.md$
and.utf8.md$
no longer need to be ignored inignoreFiles
in the Hugo config file now. There is no harm to ignore them anyway. If you have ignored them, you do not need to update your config (#609).
-
The global option
blogdown.subdir_fun
can be a function that takes the post title as the input and returns a path of subdirectory under which the new post is to be created via the "New Post" addin in RStudio. The "New Post" addin failed to add the subdirectory defined by this function to the choices of the "Subdirectory" select input if the subdirectory does not exist in the choices, therefore it could not really be used. Now the subdirectory is corrected added, and can be used (thanks, @datawookie, #656). -
install_hugo()
stopped working with Hugo v0.89.0 (thanks, @martinolmos, #664). -
On Windows,
new_post()
may fail to open the new post if the filename contains multibyte characters (thanks, yingjie, https://d.cosx.org/d/422702).
-
Added a new function
check_vercel()
to check the Vercel configvercel.json
, and a new functionconfig_vercel()
to createvercel.json
that contains the Hugo version (thanks, @chuxinyuan, #648). Vercel (https://vercel.com) is service similar to Netlify. -
Added an argument
time
tonew_post()
to optionally include the local time in thedate
field of the new post withnew_post(time = TRUE)
. The value of this argument can also be set via the global option in.Rprofile
, e.g.,options(blogdown.time = TRUE)
(it isFALSE
by default). See the help page?blogdown::new_post
for more information (thanks, @earfanfan, #625).
-
The duplicated
config/
directory is deleted from the theme now (thanks, @shirdekel, #644). -
The
categories
andtags
fields in archetypes were not respected when creating new posts (thanks, Conor Neilson, https://stackoverflow.com/q/68879106/559676).
check_config()
now checks forbaseURL
that only provides a domain name but lacks thehttps
(orhttp
) protocol, e.g.,baseURL: example.com/
is typically not a valid URL, but should behttps://example.com/
instead (thanks, @apreshill, #616).
-
Fixed a new issue with
blogdown::new_site(theme = "wowchemy/starter-hugo-academic")
(#638). To avoid similar issues with the academic theme in the future, we recommend that you consider using thehugo-apero/hugo-apero
theme instead. -
install_hugo()
can install the correct version of Hugo on a machine with an ARM processor now (thanks, @r-saikat, #636). -
clean_duplicates()
now correctly deletes duplicated.html
file instead of.md
whenblogdown.method
option is set tomarkdown
(thanks, @apreshill, #628). -
clean_duplicates()
also correctly deletes unused directories like*_files/header-attrs
associated with.html
output files (thanks, @apreshill, #632).
-
check_config()
will suggest ignoring therenv
folder and therenv.lock
file in the Hugo config if renv is used in the project (thanks, @solarchemist, #597). -
check_content()
will also discover problematic YAML metadata of posts that is not a list (thanks, msmielak, https://stackoverflow.com/q/66857582/559676). -
New project menu in RStudio IDE now allows to select for keeping
config.toml
(thanks, @ogansser, #606).
-
The
method
argument ofbuild_site()
has been removed (it was defunct in blogdown v1.2). Please set the build method in the global optionoptions(blogdown.method = )
instead. -
The
use_brew
argument ofinstall_hugo()
has been removed.
-
check_content()
will ignorerenv
folders when looking for Rmd/md files to be checked (thanks, @solarchemist, #597). -
The RStudio addin "Update Metadata" does not work when the global option
blogdown.rename_file
is not set (thanks, @brshallo, #605). -
The RStudio addin "New Post" does not work when the YAML metadata of a post only contains a string. Normally the metadata should be a list (thanks, msmielak, https://stackoverflow.com/q/66857582/559676).
-
When
.Rmd
is not ignored in theignoreFiles
field in the site config file (this can be detected byblogdown::check_site()
and you should fix it),.Rmd
files may be copied to thepublic/
directory when building the site viablogdown::build_site()
, which can cause problems whenblogdown::serve_site()
is running, i.e.,.Rmd
files will be rendered to thermarkdown::html_document()
format byrmarkdown::render()
. As a result, the corresponding web pages will not be rendered by Hugo but only Pandoc, and they will lose the site style or shortcodes (thanks, @ogansser, #610 #608). Nowblogdown::check_site()
should detect this problem and recommend fixes.
-
Added the argument
force
back toinstall_hugo()
. If the specified version of Hugo has been installed,install_hugo()
will not reinstall it unlessforce = TRUE
(thanks, @cderv, #575). -
The new option
options(blogdown.knit.serve_site = FALSE)
can be used to prevent blogdown from starting the web server automatically when the Knit button is clicked in RStudio and the site has not been served yet (thanks, @Athanasiamo, #572). By default, the web server will be started (if not already started) so the page being knitted can be previewed. -
Added a new global option
blogdown.site_root
, which can be used to specify the root directory of the website. This can be useful when the website source directory is not the root directory of a project but a subdirectory (thanks, @wjakethompson, #581). -
Added a new global option
blogdown.markdown.format
to allow users to customize Pandoc's Markdown output format. When using the file extension.Rmarkdown
oroptions(blogdown.method = 'markdown')
, an R Markdown file is first compiled to Markdown. This Markdown file needs to go through another conversion when it contains Markdown features that are only available to Pandoc but not other Markdown renderers such as Hugo/Goldmark, such as citations or fenced Divs. The new global option controls the Pandoc output format. By default, its value isc('gfm', '+footnotes', '+tex_math_dollars')
for Pandoc 2.10.1 and later when the Markdown document contains bibliography or fenced Divs, otherwise it isNULL
. With earlier versions of Pandoc, it will bec('gfm')
only. If you want the conversion to be always performed, you may set this global option to a value that is notNULL
, e.g.,options(blogdown.markdown.format = c('gfm', '+footnotes', '+tex_math_dollars', '+smart'))
.
-
The
method
argument ofbuild_site()
is now defunct (it was deprecated in blogdown v1.0), and will be removed in a future version. Please set the build method in the global optionoptions(blogdown.method = )
instead. -
The
use_brew
argument ofinstall_hugo()
is defunct now, and will be removed in a future version. -
The
update_hugo()
function is defunct. Please useinstall_hugo()
instead. -
The scripts
R/build.R
andR/build2.R
are no longer executed when a document is compiled via the Knit button in RStudio. They will be executed only when building the whole site viabuild_site()
(e.g.,Ctrl/Cmd + Shift + B
in RStudio).
-
check_config()
will now correctly check for both missing and unneeded values in theignoreFiles
field in the config file. -
When serving the site with
blogdown::serve_site()
with'blogdown.knit.on_save'
option beingTRUE
, Rmd files inrenv/
orpackrat/
folder are now correctly ignored and not rebuilt (#593). -
For
.Rmarkdown
posts, the Markdown extensiontex_math_dollars
should not be used when post-processing the.markdown
output file with Pandoc < v2.10.1 (thanks, @lz100, #578). -
The
new_post()
function does not work with bundle archetypes (thanks, @maelle, #577). -
install_theme()
will now remove the.github/
folder if one exists in the theme repo as it is only useful to the theme developer (#584). -
Plots generated from R code chunks in posts cannot be previewed on RStudio Server (thanks, @cderv @datawookie #587).
-
The error "RStudio is not running" should be suppressed when building the site in a non-interactive R session (thanks, @kcarnold, #596).
-
The theme
gcushen/hugo-academic
is now correctly automatically redirected towowchemy/starter-academic
with correct default git branch when installing withnew_site()
orinstall_theme()
. -
Also try to move
config/_default/config.yaml
to the root dir when installing a theme. Previously, onlyconfig.toml
was moved (thanks, @andreashandel, #546). -
When installing a theme, delete
figure
shortcodes that useshttp
resources because the figure paths could be mangled on Windows (thanks, @andreashandel, #546).
-
When clicking the Knit button in RStudio to knit a post, the normal knitting process is shown (such as the progress bar) instead of being suppressed (thanks, @Athanasiamo, #572).
-
The command
blogdown:::preview_site()
is no longer called or displayed in the R console when users click the Knit button after the server has been started (thanks, @apreshill, #543). -
The config option
ignoreErrors
will be set to"error-remote-getjson"
when runningblogdown::serve_site()
. This is to prevent Hugo errors in fetching remote resources such as Tweets (thanks, Fan Yuan https://d.cosx.org/d/422065 and dhonda https://stackoverflow.com/q/64601786/559676).
-
Added new arguments
args
,baseURL
, andrelativeURLs
to thehugo_build()
function to allow users to pass more command-line arguments to Hugo and adjust the configurationsbaseURL
andrelativeURLs
temporarily when building a site. -
Added the
...
argument tobuild_site()
, to pass more arguments to thehugo_build()
function, e.g.,blogdown::build_site(relativeURLs = TRUE)
. -
Added a global option
blogdown.server.verbose
to print the web server messages in real time when the server is running. Once enabled (viaoptions(blogdown.server.verbose = TRUE)
), you will see messages in the R console like "Change detected, rebuilding site" whenever you make changes to any files (thanks, @apreshill @cderv, #555). -
Added a new global option
blogdown.protect.math
(defaults toTRUE
) to control whether to protect LaTeX math expressions in a pair of backticks when the post output format is Markdown instead of HTML. The reason to protect math expressions is to avoid the Markdown renderer's treatment of the math content as normal Markdown content, which may mangle the math expressions. If the math expression is protected, it needs to be unprotected later. See https://yihui.org/en/2018/07/latex-math-markdown/ for more information. Note that this option is only relevant to those who use the source format.Rmarkdown
or the build methodoptions(blogdown.method = 'markdown')
(thanks, @bensoltoff #466, @mrkaye97 #567).
-
bundle_site()
also moves the.html
output files and the*_files/
/*_cache/
directories associated with.Rmd
source posts to page bundles. Previously, only.Rmd
files are moved (thanks, @llrs, #568). -
Fixed a bug of
install_theme()
when the theme archive contains theme files directly instead of a theme folder (thanks, Stefan Musch, https://stackoverflow.com/q/65702805/559676). -
Fixed a bug that causes HTML widgets to fail to render in the Markdown output files with htmltools >= 0.5.1.
-
Fixed a bug on Windows that causes
check_gitignore()
to error when it shouldn't (#571).
- When the site is rendered via a call to
rsconnect::deploySite()
(e.g., when you callrmarkdown::publish_site(render = TRUE)
),blogdown::build_site()
will use the argumentrelativeURLs = TRUE
, to make Hugo generate relative URLs that work with any base URL (note that this depends on how well a specific Hugo theme supports relative URLs).
-
check_netlify()
andcheck_config()
do not open files anymore in the IDE if no TODO items were found in them (#569). -
The internal functions
md5sum_filter()
andtimestamp_filter()
have been removed. They were renamed tofilter_md5sum()
andfilter_timestamp()
, respectively, and exported in blogdown 1.0. Please use these exported functions instead if you relied on the internal functions previously.
-
Added a function
check_site()
to provide diagnostics for a website project, which may help reveal potential problems in various places. It runs a series of checks on the config file (config.yaml
orconfig.toml
), the.gitignore
file, the Hugo installation and version, thenetlify.toml
file, and content files. See the help page?blogdown::check_site
for more info. -
Documented and exported the internal function
find_hugo()
to find the Hugo executable. If multiple versions of Hugo are installed,find_hugo()
can also find a specific version of Hugo, e.g.,blogdown::find_hugo('0.25.1')
. You may useblogdown::find_hugo('all')
to find all possible versions of Hugo currently installed. -
Added a function
remove_hugo()
to remove Hugo (thanks, @cderv, #504). -
The file format
.Rmarkdown
supports HTML widgets and citations now, just like the.Rmd
format. If you are not familiar with the.Rmarkdown
format, you may see https://bookdown.org/yihui/blogdown/output-format.html. -
Added a function
config_netlify()
to help users create the config filenetlify.toml
for Netlify. It sets thebuild
commands properly for different deploy contexts, and writes the local Hugo version to the config file, so make sure Netlify uses the same version of Hugo as your local environment. See the help page?blogdown::config_netlify
for details. -
Added a function
config_Rprofile()
to help create or modify the.Rprofile
file. In particular, it will try to set the optionblogdown.hugo.version
in it, if the option has not been set. See the help page?blogdown::config_Rprofile
for details. -
Added an argument
netlify = TRUE
tonew_site()
to createnetlify.toml
by default. -
Added an argument
.Rprofile = TRUE
tonew_site()
to create the.Rprofile
file by default. This file contains a few sample global options that could affect blogdown's behavior, e.g., the optionblogdown.hugo.version
is set to the current Hugo version, so that a site will not be affected by future Hugo updates and will always use the fixed version of Hugo. This file is provided so that users are better aware of some of these options, and can change them if they want. -
Exported the function
filter_newfile()
, which returns paths of source files that have not been knitted (i.e., their output files do not exist). -
The
build_rmd
argument ofbuild_site()
can take a function as its value now (thanks, Tyler Smith). The function is expected to take a vector of paths of all R Markdown files under thecontent/
directory, and returns a vector of paths of R Markdown files to be built. This argument can also take one of the aliases"timestamp"
, which is equivalent toblogdown::filter_timestamp
,newfile
(equivalent toblogdown::filter_newfile
), and"md5sum"
(equivalent toblogdown::filter_md5sum
). For example,blogdown::build_site(build_rmd = "timestamp")
means to build all R Markdown files if they are older than their output files (by comparing modification times). -
When opening a blogdown website project in RStudio, you can specify a number of files to be automatically opened every time via the global option
blogdown.initial_files
in your.Rprofile
. This option can take a vector of file paths, e.g.,options(blogdown.initial_files = c('config.yaml', '.Rprofile', 'content/post/my-first-post/index.Rmd'))
(files that do not exist will be ignored). Alternatively, this option can take a function that returns a vector of file paths, e.g.,options(blogdown.initial_files = blogdown:::initial_files)
. -
Added a new argument
.site_dir
toserve_site()
, so users will be able to specify the site root directory (thanks, @Bijaelo, #527). -
Added a new argument
force
tonew_site()
to allow users to create a new site under a nonempty directory withforce = TRUE
if they are sure the site can be safely created under the directory (i.e., Hugo will not possibly override existing files). In an interactive R session, it will ask users if they wantforce = TRUE
when the directory is not empty.
-
install_hugo()
no longer installs Hugo via Homebrew by default on macOS, but just downloads binaries from Hugo's Github releases, which gives you a stable version of Hugo. Theuse_brew
argument ofinstall_hugo()
has been deprecated. Installing Hugo via Homebrew often leads to accidental updates of Hugo, which may break your existing sites. If you must install Hugo via Homebrew and want to fix its version, you can runbrew pin hugo
, so it will not be updated by accident in the future (e.g., viabrew upgrade
). -
By default,
install_hugo()
installs Hugo to~/.local/share/Hugo
on Linux now, instead of~/bin
. -
install_hugo()
installs thehugo
executable to a directory with the directory name being the Hugo version number, e.g.,~/Library/Application Support/Hugo/0.76.5
, or~/.local/share/Hugo/0.25.1
. This makes it possible to install multiple versions of Hugo on the same computer. -
When starting to serve the site,
serve_site()
will compile Rmd files that do not have output files initially (thanks, Hannah Wang, https://stackoverflow.com/q/64420476/559676). -
The default value of the global option
blogdown.serve_site.startup
was changed fromTRUE
toFALSE
, meaning that the site will not by served by default when the RStudio project is first opened. If you want the previous behavior, you may setoptions(blogdown.serve_site.startup = TRUE)
in your.Rprofile
. -
The
method
argument ofbuild_site()
was deprecated. The build method can only be specified via the global optionblogdown.method
now, e.g., you may setoptions(blogdown.method = 'custom')
in.Rprofile
. A new possible build method namedmarkdown
was added. When you setoptions(blogdown.method = 'markdown')
,.Rmd
posts will be compiled to.md
(by default, they are compiled to.html
since the default option isblogdown.method = 'html'
). This provides another way to render R Markdown to Markdown instead of HTML. Previously, the only way to achieve this was to use the file extension.Rmarkdown
(this way still works). -
The function
update_hugo()
and the argumentforce
ofinstall_hugo()
have been deprecated. If you want to update Hugo to a newer version, you can callinstall_hugo()
and specify a desired version. -
The functions
md5sum_filter
andtimestamp_filter
have been renamed tofilter_md5sum
andfilter_timestamp
, respectively.
-
serve_site()
fails to start the server when the config file contains abaseURL
value that includes a subpath in it (thanks, @giabaio #254, @ShixiangWang #494). -
serve_site()
andhugo_build()
fail to resolve URLs whenrelativeURLs
is configured totrue
(thanks, @TianyiShi2001, #506). -
The "Insert Image" addin works with posts that are index pages of leaf bundles now. The images are added to the
images/
folder under the post directory by default instead of the top-levelstatic/
directory (thanks, @amssljc, #499). -
For a post that is the index page of a bundle, its images could not be displayed when the post content is displayed on other pages such as the home page (thanks, @andremrsantos #501, Fabio A. Cruz Sanchez https://stackoverflow.com/q/65097597/559676).
-
The
_files/
and_cache/
folders are not correctly moved for index pages of leaf bundles when the filename of an index page contains a language code such asindex.en.Rmd
(thanks, @cderv, #500). -
install_hugo()
could not install the extended version of Hugo that was downloaded manually, e.g.,blogdown::install_hugo('~/Downloads/hugo_extended_0.78.2_Linux-64bit.tar.gz')
would fail (thanks, Stuart, https://stackoverflow.com/q/64962659/559676). -
new_post(date = "")
ornew_post(date = NULL)
failed to work. In both cases, it should create a post without thedate
field in the YAML metadata (thanks, Caleb Stevens, https://stackoverflow.com/q/65067164/559676). -
new_site()
no longer shows Hugo messages on Windows (#532). -
new_site()
can figure out the default branch name of a theme repo now, instead of assuming themaster
branch is the default (thanks, @c1au6i0, #541).
-
For
new_site(to_yaml = TRUE)
, it will also convertconfig.toml
toconfig.yaml
. -
The default value of the
serve
argument innew_site()
was changed fromTRUE
to"ask"
in an interactive R session, which means it will ask if users want to serve the site after creating it. -
The default value for the
format
argument ofnew_site()
was changed fromtoml
toyaml
, which means it will generateconfig.yaml
instead ofconfig.toml
by default. -
new_site()
will create two sample scriptsR/build.R
andR/build2.R
(they can be deleted if you don't need them). See the help page?blogdown::build_site
for their meanings. -
Autocomplete is supported for the names of important global options when typing inside
options()
in RStudio, e.g., when typingoptions(blogdown.au)
, RStudio will show the candidateblogdown.author
. -
read_toml()
andtoml2yaml()
will try to preserve the original order of fields in the TOML data, instead of using the alphabetical order. -
When clicking the "Build Website" button in RStudio, it will no longer open the
index.html
file in the generated site folder, but emit a message telling users that this folder needs to be served before the web pages can be correctly previewed (#522). -
For Jekyll sites, the arguments
--watch
,--incremental
, and--livereload
are passed tojekyll serve
by default. These arguments can be set via the global R optionblogdown.jekyll.server
. -
The meta variable
link-citations
is set totrue
for thepandoc_args
argument ofblogdown::html_page()
, so that links can be generated on citation items by default. -
The internal function
Rscript()
was removed and it is publicly available in the xfun package now. If you need this function, please usexfun::Rscript()
instead. -
Removed internal functions
is_windows()
,is_osx()
, andis_linux()
. They are available in the xfun package now (note thatis_osx()
has becomexfun::is_macos()
).
-
The
Knit
button in RStudio finally works with blogdown now. My apologies to those who have desperately clicked theKnit
button or pressedCtrl + Shift + K
in vain over the years. I completely underestimated the power of your muscle memory. -
Added a global R option
blogdown.knit.on_save
to control whether to knit R Markdown documents on save. By default, it isTRUE
. If you do not want to knit a document as you save it, you may setoptions(blogdown.knit.on_save = FALSE)
in your.Rprofile
. If this option is not set initially, it will be set toFALSE
after you click theKnit
button in RStudio. -
blogdown::build_site()
no longer recompiles R Markdown files by default, because it may be expensive and often undesirable to compile Rmd files that have been compiled before. If you do want to recompile Rmd files, you may useblogdown::build_site(build_rmd = TRUE)
. See the help page?blogdown::build_site
for more information. -
Added a helper function
blogdown::bundle_site()
to move post files into leaf bundles in a website, e.g., fromcontent/foo/bar/hello-world.Rmd
tocontent/foo/bar/hello-world/index.Rmd
. -
Exported the (previously internal) function
blogdown::filter_md5sum
function (#341). See its potential application on the help page?blogdown::build_site
. -
Similarly, the function
blogdown::filter_timestamp()
has been exported and documented. -
If a theme contains Hugo modules (e.g., the former hugo-academic theme), the modules will be resolved at the time when a theme is installed, which means users will not need to install Go or GIT to work with themes that contain Hugo modules.
-
Added a new function
hugo_available()
to check if Hugo with a minimal version is available. -
Added functions
read_toml()
andwrite_toml()
to read/write TOML data, and functionstoml2yaml()
andyaml2toml()
to convert data between TOML and YAML. See their help pages for details. -
Added the
keep_md
argument toblogdown::html_page()
(thanks, @lazappi, #445).
-
When creating a new site with
blogdown::new_site()
, the themegcushen/hugo-academic
is automatically redirected towowchemy/starter-academic
, because the original Github repo has moved and become a repo of Hugo modules. -
The default value of the global option
blogdown.new_bundle
was changed fromFALSE
toTRUE
if the site is built through Hugo >= v0.32. This means new posts will be created as leaf bundles, i.e., of the formpath/post-filename/index.md
instead ofpath/post-filename.md
(the extension.md
may also be.Rmd
or.Rmarkdown
). If you are not familiar with Hugo's page bundles, please see the documentation at: https://gohugo.io/content-management/page-bundles/. Using page bundles makes it much easier to manage resources like images. Without page bundles, these resources have to be placed under thestatic/
directory, and cannot live together with posts under thecontent/
directory. If you do not like this change, you may still setoptions(blogdown.new_bundle = FALSE)
in your.Rprofile
. If you do like page bundles and want to convert old posts into bundles, the functionblogdown::bundle_site()
may be helpful. -
For page bundles, the
index_files/
andindex_cache/
folders are no longer moved to thestatic/
directory (for other types of posts, these folders are still moved). Consequently, you should not ignore"_files$"
in theignoreFiles
field in yourconfig.toml
orconfig.yaml
any more. -
When opening a blogdown project in RStudio,
blogdown::serve_site()
will be automatically called, so you will get the preview of the site immediately. If you do not like this behavior, you may setoptions(blogdown.serve_site.startup = FALSE)
in your.Rprofile
. -
The global option
blogdown.generator.server
has been deprecated. Nowblogdown::serve_site()
always use the Hugo server (which corresponds tooptions(blogdown.generator.server = TRUE)
in previous version of blogdown), instead of the server created via the servr package (which corresponds to the defaultoptions(blogdown.generator.server = FALSE)
before). The Hugo server is much faster, and also supports navigating to the output web page of which you are currently editing the source document. Note that the optionblogdown.hugo.server
is still supported (for setting command-line arguments forhugo server
), and its default value isc('-D', '-F', '--navigateToChanged')
. Also note that using Hugo's server means the website is not rendered to disk (i.e., it will not generate thepublic/
folder) by default but served directly from memory. If you need thepublic/
folder, you have to build the site explicitly viablogdown::build_site()
, or if you use RStudio, pressCtrl + Shift + B
orCmd + Shift + B
to build the website project (#495).
-
The command-line argument
--navigateToChanged
is passed tohugo server
by default now if the Hugo version is not older than 0.25. If you start a Hugo server to serve and watch the site, it will automatically navigate to the page corresponding to the changed file. -
Images
tn.png
andscreenshot.png
under theimages/
directory of a theme will be deleted inblogdown::install_theme()
because these are screenshots of a theme and don't affect the theme's function.
-
Now
blogdown::install_theme()
downloads Hugo themes (from Github by default) as tarballs instead of zip archives, becauseunzip()
is unable to extract files for certain themes (thanks, @jimvine, #433). -
Disallow running
blogdown::serve_site()
multiple times in the same R session due to an RStudio IDE issue (thanks, @jennybc @daczarne @denizCvrl @lopierra, #404).
-
The "Filename" field in the "New Post" addin in RStudio will use the "Slug" value (if provided) to create the base filename (thanks, @maelle, #448).
-
For
blogdown::build_site(method = 'html', run_hugo =TRUE)
, if the R scriptR/build2.R
exists, it will be executed after Hugo has built the site. This can be useful if you want to post-process the site (thanks, @chrisjake, #458). -
Added functions
shortcode_open()
andshortcode_close()
so users can write the opening and closing shortcodes separately from the inner content, and the inner content can be processed by Pandoc (thanks, @tcwilkinson, #449).
-
blogdown no longer renders
.Rmd
documents within a packrat / renv library folder, for blog posts whose associated R libraries are managed by these packages (thanks, @kevinushey, #451). -
The "Language" field in the "New Post" addin in RStudio now shows up regardless of the capitalization of the
defaultContentLanguage
parameter inconfig.toml
(thanks @mpaulacaldas, #442). -
Correctly identifies "Windows X.Y x64" as a 64bit operating system, so the extended version of Hugo can be installed (thanks, @anna-doizy, #461).
- The "New Post" addin in RStudio uses the whoami package (if installed) to figure out the author name, in addition to using the global option
getOption('blogdown.author')
. The "Subdirectory" field is now a select input instead of a text input, so you can choose one item from a full list of subdirectories instead of manually typing the directory path (thanks, @maelle @gadenbuie, #432).
- The "New Post" addin in RStudio works with page bundle archetypes now (thanks, @malcolmbarrett and @apreshill, #414).
- Added tests for some utility functions (thanks, @novica, #405).
- Insert Image addin now works correctly on windows (thanks, @filippogambarota @cderv, #397).
new_site()
andinstall_theme()
will check the minimal Hugo version specified by the theme, and automatically update Hugo if the current installed version of Hugo is not sufficient (thanks, @apreshill, #391).
- Added a global option
blogdown.hugo.args
, which should be a character vector with additional flags to be passed to thehugo
system command viahugo_build()
. For example,options(blogdown.hugo.args = '--minify')
will use minification on the final rendered output. More available flags in the hugo documentation (thanks, @jozefhajnala, #382).
- When creating a post with a date in the future, a warning will be issued by default. To turn off this warning (if you are aware of the consequences of future dates), set
options(blogdown.warn.future = FALSE)
(thanks, @Chucheria on Twitter, #377).
- Added a global option
blogdown.filename.pre_processor
, which can be a function with a single argument (the post title) that returns a pre-processed string to be used to generate the post filename. For example, if you setoptions(blogdown.filename.pre_processor = function(x) stringi::stri_trans_general(x, "any-latin; nfd; [:nonspacing mark:] remove; nfc"))
, Cyrillic characters in a post title can be converted to ASCII, and the result string will be used for generating the post filename (thanks, @novica, #349).
- When previewing a blogdown website with Hugo on the RStudio Server, the Hugo configuration
relativeURLs
will be set totrue
automatically (thanks, @nwstephens, #124).
- Added support to install the extended version of Hugo and enabled it as default via
install_hugo(..., extended = TRUE)
(thanks, @rgaiacs, #363).
-
The
slug
field in the "New Post" RStudio addin will no longer be automatically changed if the user has manually changed it once (thanks, @eliocamp, #347). -
Added multilingual support in the "New post" RStudio addin (thanks, @novica #344, @Guilz #323).
-
You can create a new post as the index file of a Hugo page bundle via
blogdown::new_post()
or the RStudio addin "New Post" if you setoptions(blogdown.new_bundle = TRUE)
. One benefit of using a page bundle instead of a normal page is that you can put resource files associated with the post (such as images) under the same directory of the post itself. This means you no longer have to put them under thestatic/
directory, which has been quite confusing to Hugo beginners (thanks, @DavisVaughan @romainfrancois @apreshill, #351). -
Added an argument
empty_dirs
tonew_site()
so that you can preserve the empty directories viablogdown::new_site(empty_dirs = TRUE)
. By default, empty directories will be deleted when a new site is created (thanks, @apreshill, rstudio-education/arm-workshop-rsc2019#8). -
Added a global option
blogdown.files_filter
to allow users to decide which Rmd files to be rebuilt (this option can be set in.Rprofile
). The default filter isblogdown:::filter_timestamp
, i.e., only Rmd files which are older than their output files will be recompiled when rebuilding a site. You can setoptions(blogdown.files_filter = blogdown:::filter_md5sum)
to use a different filter based on MD5 checksums, i.e., only rebuild an Rmd file if its MD5 checksum has changed. The checksums of Rmd files are saved in the fileblogdown/md5sum.txt
under the website root directory (thanks, @jonathan-g, #341).
- The default value of the argument
kind
ofnew_post()
has been changed from'default'
to''
, which means this function will respect Hugo's default order of looking for the archetype. TheArchetype
dropdown menu of the RStudio addin "New Post" was changed accordingly, and this menu will also list archetypes in themes (thanks, David Daza, https://stackoverflow.com/questions/53309582/53341795#comment93989876_53341795).
- Added an option in the "Update Metadata" addin to rename the post filename accordingly when the date is updated, e.g., when the date is changed from
2018-07-23
to2018-07-28
, the post file2018-07-23-hello-world.md
can be renamed to2018-07-28-hello-world.md
.
- A bug was introduced when implementing #305: should append
draft: yes
to YAML only whenoptions(blogdown.draft.output = TRUE)
is set (thanks, @ConorIA, #312).
-
Added a new RStudio addin "Touch File" to update the modification time of a file, which can be useful when you want to force rebuilding a certain Rmd post after running
serve_site()
(#294). -
Added an RStudio addin "Quote Poem" to quote a poem using the Markdown syntax (https://yihui.org/en/2018/06/quote-poem-blogdown/).
-
Added a new function
shortcodes()
, which is a vectorized version ofshortcode()
. For example, you can embed multiple tweets (thanks, @maelle, #307). -
Added an argument
ignore
tobuild_dir()
to ignore output filenames when testing if the Rmd file is newer than its possible output files. By default,*.Rproj
files are ignored (thanks, @chepec, #308). -
Added a global option
blogdown.draft.output
. Ifoptions(blogdown.draft.output = TRUE)
is set, a fielddraft: yes
will be appended to the YAML metadata of the HTML output file from an Rmd post, unless the Rmd post has already set thedraft
option. This means the output files are always drafts unless you explicitly setdraft: no
in the YAML metadata of Rmd posts (thanks, @mwaldstein, #305).
-
Applied a workaround for the bug in the
Rscript
command: https://stat.ethz.ch/pipermail/r-devel/2018-April/075897.html (reported from https://stackoverflow.com/q/50077412). -
The TOML metadata in new posts may fail to be converted to YAML (thanks, @apreshill, #301).
-
When editing the
config.toml
file on Windows,serve_site()
could fail with an error message'---did you forget a '#'? at line 1>seImpl(path.expand(input), verbose, fromFile): Unidentified trailing character'
(thanks, @rhobis, #302).
-
Added a
title_case
argument to thenew_post()
function; ifTRUE
, the post title will be converted to title case. See?blogdown::new_post
for details. -
Added a
hostname
argument toinstall_theme()
andnew_site()
, as a complement to thetheme
argument. The defaulthostname
is'github.com'
; if you have access to GitHub Enterprise, you can use this to specify it instead (thanks, @ijlyttle, #264). -
The
new_post
addin now lets you choose an archetype. See https://gohugo.io/content-management/archetypes/ for more details (thanks, @lcolladotor, #173). -
Added a new RStudio addin (
insert_image
) for inserting external images into blog posts (thanks, @lcolladotor, #269). If you useoptions(blogdown.insertimage.usebaseurl = TRUE)
, it adds the baseurl so that RSS feeds will include the images and be properly displayed in websites such as RBloggers (#275). You will need to publish the images so that they are displayed in a local preview and will need to keep in mind some drawbacks discussed in #275. -
The
theme
argument ofinstall_theme()
andnew_site()
now accepts a full URL to a theme's repository zip file. This can be used to install themes from other web-based git hosts, like GitLab and Bitbucket (thanks, @gadenbuie, #271). -
You may download the zip archive or tarball of the Hugo installer from Github by yourself, and pass the path to
install_hugo()
to install it, e.g.,blogdown::install_hugo('hugo_0.38_Windows-64bit.zip')
(thanks, @shrektan, #288).
- The
kind
argument (i.e., the archetype) ofnew_content()
now works with files that end in.Rmd
and.Rmarkdown
. The archetype still has to end in.md
for Hugo to work with it (thanks, @lcolladotor, #261).
- The Github repo
yihui/hugo-lithium-theme
was renamed toyihui/hugo-lithium
, and the defaulttheme
argument value was changed accordingly (thanks, @rorynolan, #291).
- The bug #233 still exists on Windows (thanks, Sheng Luan).
-
install_theme()
may signal the error "The theme already exists" by mistake (thanks, @YizhouZheng, #230). -
A warning will be issued if two versions of Hugo are found (thanks, @mingsnu, #235).
-
Plots are missing if a post filename contains multibyte characters (thanks, @dongzhuoer, #233).
- The later package is a required dependency on Windows for
blogdown::serve_site()
now (#169).
-
serve_site()
failed to parsebaseurl
in config.toml when it contains comments (thanks, @ummel, rbind/support#62). -
Three dashes in the beginning and/or end of config.yaml are ignored (thanks, @andrewheiss, #194).
-
The R startup profile
.Rprofile
under the website project root directory should be respected when building R Markdown posts (thanks, @eisioriginal, #222).
- The first CRAN release. For full documentation, please see the blogdown book: https://bookdown.org/yihui/blogdown.