I have a quarto-based website (coded in R) that I don’t want popping up in search engines. I can’t password-protect it, so I’ve added a “noindex” tag to each page to ask search engines not to crawl it. Not all search engines respect that, but Google and other main ones say they do.
My website has some pages rendered from .qmd files, and others from .Rmd files. Adding the “noindex” tag works differently for each:
For .qmd pages, you can include the “noindex” tag directly in the YAML header:
---
format:
html:
include-in-header:
text: |
<meta name="robots" content="noindex">
---
For .Rmd pages, I haven’t found a way to do it directly, so I use the “metathis” R package to do it for me. In a code chunk (not in the YAML header):
# Add noindex tag to prevent search engines from crawling
metathis::meta() %>%
metathis::meta_name("robots" = "noindex")
I’m using quarto.pub, which is a great free web hosting service specifically designed for quarto websites. These directions aren’t specific to quarto.pub, however, and will work for pages rendered from .qmd or .Rmd documents no matter where they’re hosted.