bundle_site: Convert post files to leaf bundles

View source: R/hugo.R

bundle_siteR Documentation

Convert post files to leaf bundles

Description

For a post with the path ‘content/path/to/my-post.md’, it will be moved to ‘content/path/to/my-post/index.md’, so it becomes the index file of a leaf bundle of Hugo. This also applies to files with extensions ‘.Rmd’ and ‘.Rmarkdown’.

Usage

bundle_site(dir = site_root(), output)

Arguments

dir

The root directory of the website project (should contain a ‘content/’ folder).

output

The output directory. If not provided, a suffix ‘-bundle’ is added to the website root directory name. For example, the default output directory for the site under ‘~/Documents/test’ is ‘~/Documents/test-bundle’. You can specify the output directory to be identical to the website root directory, so files will be moved within the same directory, but please remember that you will not be able to undo bundle_site(). You should modify the website in place only if you have a backup for this directory or it is under version control.

Note

This function only moves (R) Markdown source files. If these files use resource files under the ‘static/’ folder, these resources will not be moved into the ‘content/’ folder. You need to manually move them, and adjust their paths in the (R) Markdown source files accordingly.

References

Learn more about Hugo's leaf bundles at https://gohugo.io/content-management/page-bundles/.

Examples

## Not run: 
blogdown::bundle_site(".", "../new-site/")
blogdown::bundle_site(".", ".")  # move files within the current working directory

## End(Not run)

blogdown documentation built on May 29, 2024, 8:55 a.m.