I have a file located at
content/post/data_for_posts/my_file.md
I have it there because it's quite easy to do htmltools::includeMarkdown("data_for_posts/my_file.md")
and recycle this file in different posts.
My problem is that when I serve_site()
this creates a public/post/data_for_posts/index.html
, which means, it gets posted to my website (as a January 1 of 0001). I guess I could change the date to year 10000, but I would rather handle it the way I handle the .Rmd
and other files, as suggested here
I have tried to modify my config.toml
but have not managed to solve the issue.
ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$", "content/post/data_for_posts/my_file.md"]
Here are a couple techniques that I use to do this:
data_for_posts/my_file.md
so it uses a file extension that hugo does not interpret as a known markup language, for example change .md
to .markd
or mdn
.[*]data_for_posts/my_file.md
so it includes a string that you will never use in a real content file, for example data_for_posts-UNPUBLISHED/my_file.md
. Then add that string (UNPUBLISHED
or whatever) to your config ignoreFiles
list.[**][*] In the content/
directory, a file with one of the following file extensions will be interpreted by hugo as containing a known markup language: .ad, .adoc, .asciidoc, .htm, .html, .markdown, .md, .mdown, .mmark, .pdc, .pandoc, .org, or .rst (this is an excerpt of something I wrote).
[**] The strings listed in ignoreFiles
seem to be case sensitive so I like to use all-upper-case characters in my ignored file names (because I never use upper-case chars in real content file names). Also note that there is no need to specify the path and my experience is that path delimiters (/
or \
) cause problems.