Search code examples
htmlrblogshugoblogdown

How do I prevent a page from being edited by Blogdown but still placed in the public folder?


I have a google verification html file used to verify that I own a domain. I'd like for it to be placed in the "public" folder, but when I use blogdown::build_site, it adds extra content to it that makes it no longer recognizable by google for verification purposes.

The HTML file provided by google is literally one line google-site-verification: google######, but when attempting to place it in the content folder as is, or via pasting the content in the html file into markdown or rmarkdown, it doesn't render to the proper google html file which is again, just one line. The only thing that has been sucessful for me is to literally copy the file as is from google and paste it into the "public" folder, but this isn't very feasible given that the public file is constantly deleted and recreatred.


Solution

  • Add it to the static folder either in the root folder or inside the theme folder. The relevant documentation is in https://bookdown.org/yihui/blogdown/static-files.html.

    All files under the static/ directory are copied to public/ when Hugo renders a website.