Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] config option for multiple custom rendering functions #683

Closed
mivalek opened this issue Jan 20, 2022 · 1 comment
Closed

[FR] config option for multiple custom rendering functions #683

mivalek opened this issue Jan 20, 2022 · 1 comment

Comments

@mivalek
Copy link

mivalek commented Jan 20, 2022

Hi all,

(This is an edited repost from #289 which hasn't received a response in 6 months. If it's on people's radar, please feel free to close this issue)

A tiny bit of background: I am a uni teacher so hosting both slides and lecture handouts/worksheets in an integrated easy-to-use, easy-to-maintain way is important when creating a course website.
I think that enabling users to define custom formats while keeping blogdown::html_page as the default should be fairly simple.

Here is my suggestion (implemented in this commit):
config.yaml should have an optional renders: parameter, such as:

renders:
  default: "blogdown::html_page"
  slides: "my_pkg::my_format"

blogdown::build_site() then reads renders from config.yaml and passes it down to blogdown:::build_one() which looks for the type: parameter in a .Rmd file's YAML front matter. If there isn't one, the file gets rendered by the default method. In this scenario, files with type: slides in YAML get rendered with my_pkg::my_format.
Using the type: param is handy because it allows custom HUGO templates for files of a given type.

If there is no renders: in config.yaml, everything gets rendered by blogdown::html_page so it would not be a breaking change.

The implementation linked above doesn't deal with TOML but I don't imagine it would take a lot of work to expand.
I've been working on a blogdown/HUGO theme for course websites I would like to release and this feature is crucial for it.

Many thanks!

@yihui
Copy link
Member

yihui commented Feb 16, 2022

Sorry about the delay in response. I think we can just continue the discussion in #289. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants