HUGO

What is required to make markdown get picked up?

I am trying to build a site that is harvesting markdown from multiple git repos. It seems to ignore most of the markdown files, even though it copies all of the other files, like images, code etc. I cant guarantee that there will be an _index.md since I am not the author. Most sites use README.md as the index. But hugo is ignoring that file.

Not sure how advanced you are with Hugo. But you should check Hugo Modules and the Mount settings.

This will allow you to take any files, from any source and mount them at the desired location of your Hugo Project.

1 Like

I’m brand new to hugo. I’ve used mkdocs quite a bit, and am trying to convert an mkdocs site to hugo. The problem is not the directories. My directorie’s hierarchical (i use submodules to checkout everything I need as a child of the content directory. My problem is that where I have a .md in my content directories, nothing at all i written to the public directory. The directory is there, and all the not markdown content gets copied, but the markdown turns into nothing.

Markdown files need to have front matter for Hugo to generate the respective HTML pages.

1 Like

hmm. that kind of sucks. my whole use case is harvesting markdown from other authors who don’t know I’m using hugo. Can you have a default front matter that is applied is none is in a file?

Not with Hugo but currently there is an open issue about this feature: https://github.com/gohugoio/hugo/issues/6098

I suppose that you could write a script to prepend the needed front matter in the content files.

Thanks, at least I know it’s not just me :slight_smile:

I’ll watch that issue.

I’m curious to see what happens if you use cascade this is suppose to add the same front matter values to all descendents of a page. So if you add _index.md at the root of content/ with

cascade:
  title: Dummy Title

Then all descendents will share that title, and Hugo might build the pages as it picks some Front Matter form the cascade object. I never tried it and it might not suit your need, but I’m curious,

Actually the results of what you suggest @regis are surprising!

With the following tree:

content
├── _index.md
├── goodbye.md
└── hello.md

hello.md and goodbye.md contain no front matter.

_index.md contains:

cascade:
  title: Dummy Title

Hugo publishes both /hello/ and /goodbye/ despite the omission of front matter.

The downside is the lack of a customized title for those pages but I suppose that one could make a check in the template and provide a title by using for example the .File.BaseFileName variable (or something else):

{{ if eq .Title "Dummy Title" }}
{{ .File.BaseFileName | humanize | title }}
{{ end }}
2 Likes