HUGO

Is it possible to create posts just by dropping markdown files to posts folder?

Hello, newbie question here. I have set up my Hugo locally to build my website. I do seem to be able to do what I want so far, but I was under the impression, that once do the initial set up, I can just write a markdown file and drop it to posts folder, rebuild the website and be done. But if I don’t first set up a new page using command “hugo new post/newpost.md”, Hugo disregards files in posts folder.
I want to host the website on GitLab Pages, so the more important question is, once I have the website in repo, can I keep dropping markdown files to the posts folder without going through the process of creating each new post with a command?

The hugo new command is just a convenience. What it mainly does is add frontmatter according to what you have set up in the archetypes.

You are free to create the needed frontmatter manually in your text editor. I do this often myself.

Adding “plain” markdown files without front matter will not work. Hugo needs the frontmatter to make sense of the content.

Your kind reply gave me courage to investigate my problem some more and I figured it works well, if I don’t specify exact time of the post. I created a new post by modifying a copy of an existing post and when I deleted the time when it was created, so it only said day, like this: “date: 2021-11-19”, it worked like a charm. Thank you for the reply.

Why would your post not display if the date contains a time? Maybe it’s worth getting to the root of this.

1 Like

Yup. They’re just text files, and you can create them in any editor without using the Hugo new command. I have an iOS shortcut that creates markdown files (with frontmatter) to post photos from my phone. Doesn’t touch Hugo until I want to build the site to publish.