Hans W.
Hans W.

Reputation: 1829

Adding non-blog files in a blogdown Web site

I am trying to construct a Web site with blogdown, Hugo, and the xmin theme. I would like to store some Markdown files in a subdirectory, say content/misc/, such that they are not going to be treated as blog entries (e.g., they will be pointed to specifically on some _index.md pages).

How can I do this for single files or for all files in a subdirectory of content/? I know I can kind of hide them directly in the content/ directory, however this makes structuring the project clumsy and difficult.

I suspect this will be possible with specific templates, but is there an easier, much simpler way to handle this requirement? Or are there more appropriate themes to make it possible?

Upvotes: 1

Views: 501

Answers (1)

Sébastien Rochette
Sébastien Rochette

Reputation: 6671

If there are some pages that you want to show with a common format, but you do not want them to be listed in your blog articles list

Simple solution: use the default template

To use the default template, you just need to add this "misc" folder in "content" with all your Rmd inside. Then, there will be a page listing all the articles of this type at "myblog.com/misc/".

Advanced solution: use a specific template

If you want to have a specific template for these pages.

  • If it does not exists, create a "layouts" folder at the root of your project.
  • Inside "layouts", create a "misc" folder
  • Inside "misc", create a "list.html" file if you want that your page "myblog.com/misc/" shows a list of your pages with this category
  • You also need to create a "single.html" if you want a specific way of showing these single articles.

To have ideas what to put inside these two files, you can directly start with the template of your own theme (https://github.com/yihui/hugo-xmin/tree/master/layouts/_default). As I said, you can also look at the "itemized" type of "hugo-future-imperfect" (https://github.com/statnmap/hugo-future-imperfect/tree/master/layouts/itemized), or what I propose for sticky pages on "hugo-statnmap-theme" (https://github.com/statnmap/hugo-statnmap-theme/tree/master/layouts/sticky_pages)

Upvotes: 2

Related Questions