rstudio / blogdown

Create Blogs and Websites with R Markdown
https://pkgs.rstudio.com/blogdown/
1.73k stars 334 forks source link

toha theme #720

Closed dleopold closed 2 years ago

dleopold commented 2 years ago

I am interested in trying the toha theme: https://github.com/hugo-toha with blogdown. However, it looks like this theme uses some conventions that differ from most Hugo themes. For example, the site content is primarily determined by the contents of a data/folder, as opposed to content/. I am wondering if it is possible to use such a theme with blogdown, or not? If it is possible, is there guidance for using a theme like this?

yihui commented 2 years ago

I just took a minute to test it (creating a new site with theme = "hugo-toha/toha") and it seems to work fine. I guess you don't need any special guidance: https://bookdown.org/yihui/blogdown/a-quick-example.html

dleopold commented 2 years ago

Yes the theme installs fine, but it is not clear to me how to work with the theme using Blogdown. I apologize if I am being daft, but I have built a website with Blogdown before (using the Academic theme) and this theme does not work the same. From the theme documentation (here) most of the setup is done by adding yaml files to data/. For a minimal example, following the theme documentation for getting started (using Hugo directly, not Blogdown), I can modify the copyright in the site footer by creating a file at data/en/site.yaml containing:

# Copyright Notice
copyright: © 2020 Copyright.

But creating that file in my Blogdown project repository does not do anything. Where should the data directory be?

yihui commented 2 years ago

In this case, I think you need to restart R and serve the site again for the new copyright notice to be correctly reflected. I don't think this is a problem of blogdown but Hugo. It seems that the hugo server won't refresh the site when you create a new data file. However, if the data file has existed, and you modify its content, the site can be automatically refreshed.

dleopold commented 2 years ago

That does it. Thank you for figuring it out.