Closed atusy closed 3 years ago
I answered on community re: using Hugo archetypes for this purpose. They give you a lot of flexibility that (I think) better map onto your Hugo site's different kinds of content:
Have you considered this approach, or did you try it and it didn't suit your needs?
@apreshill
Thank you so much. This is a great solution.
I also found new_post()
by default refers to archetypes/default.md
.
However, I see no documentations about it.
Maybe we should add descriptions at https://bookdown.org/yihui/blogdown/
Maybe we should add descriptions at bookdown.org/yihui/blogdown
Oops, it's there: https://bookdown.org/yihui/blogdown/templates.html#a-minimal-example So everything is fine now! Thank you all for your helps!
I don't recommend using the archetype in this case. Your goal is to set an option globally in the output format, and _output.yml
is a better way to go. You can put this file in the root directory of your website project (search for _output.yml
on this page: https://bookdown.org/yihui/blogdown/output-format.html).
Hard-coding the output
field in each post will make it inconvenient to update the output format (e.g., any output format options) in the future. This time you may want to add the Pandoc extension +east_asian_line_breaks
, and next time you may want to add or remove another extension, then you'd have to update each post if the extensions are specified in the output
field of each post.
@yihui Thank you for suggestions. I agree _output.yml
is the better choice.
I have read the link you shared, and tried it without success.
What does it mean by the root directory described below?
you can create a _output.yml file under the root directory of your website.
I have tried
publishDir
defined at config.toml
content
direcotrycontent
)@atusy I meant the project root. _output.yml
should be copied to the directory of each post when rendering the post: https://github.com/rstudio/blogdown/blob/11fec4c7d59234596501c36ceece72c5f6d2a0a0/R/render.R#L142-L154
If it doesn't work, there might be a bug.
@yihui Thanks. I confirmed it works with new project and subsequently with my project. Maybe I did something wrong yesterday...
Thanks again!!
With
_output.yml
, we can implicitly share output options among Rmd files in the same directory. However, whenoptions(blogdown.new_bundle = TRUE)
, each posts exist in individual directories, and require explicitly share the option withoutput_yaml: ../_output.yml
in the YAML front matter.I want a feature that enables implicit sharing of the option even if
options(blogdown.new_bundle = TRUE)
.This feature request originally comes from a discussion in RStudio Community: https://community.rstudio.com/t/how-to-share-output-yml-among-blodwon-posts-when-blogdown-new-bundle-is-true/91557
Checklist
When filing a feature request, please check the boxes below to confirm that you have provided us with the information we need. Have you:
[x] searched for an existing feature request to avoid creating duplicate requests? If you find an existing feature request, please give it a thumbs-up reaction, as we'll use these reactions to help prioritize the implementation of these features in the future.
[x] provided a clear and concise description of the problem this proposed feature would address? For example, I struggle to do
[...]
with blogdown.[x] provided a clear and concise description of what you want to happen?
[x] provided a clear and concise description of alternative solutions or workarounds you've considered?
[x] added any other context or screenshots about your feature request?