Bagusflyer
Bagusflyer

Reputation: 12925

Hugo miss generating images and a few other folders

Here is the structure of my Hugo theme:

enter image description here

The site with config file is in exampleSite folder. After I run hugo --config ./exampleSite/config.toml command. A few files generated in public folder.

enter image description here

Some folders like about, images are missing.

But when I run hugo command in exampleSite folder. All files are generated.

enter image description here

When I add debug or verbose flags to the command, there is no error at all. What could be the reason?

Upvotes: 0

Views: 627

Answers (1)

Andrei Mustata
Andrei Mustata

Reputation: 1133

A minimal Hugo site

To build a Hugo site, this is the minimum setup that you need:

.
├── config.toml
├── content
│   ├── about.md
│   └── first-post.md
├── layouts
  • config.toml is described in the configuration docs. You'll want at least a baseURL and a title added.
  • content/ - this is where the writing goes; Markdown documents here get translated into HTML pages. More details in the Content organisation chapter.
  • layouts/ - this is where the page templates go.

For more info on this, check the Hugo directory structure, part of the getting started guide.

At this point, running the hugo command, i.e. compiling your site, will output the result in the public directory by default. Without any HTML templates, you'll just get a sitemap and some RSS XML.

Cue Hugo themes

In your case, you want to use a ready-built theme, so you need an extra themes directory, in which you can have one directory for each theme you want to use, e.g. themes/my-hugo-theme. In your config.toml, you need to set theme = my-hugo-theme, which is the directory name.

Using a separate theme means that Hugo will use the theme's layouts (themes/my-hugo-theme/layouts/) to generate your site's documents (content/).

exampleSite/

As a convention, themes posted on Hugo's library have an exampleSite/ directory to show off all the available features. Those files are ignored when you use the theme in your own site.

What you could do is copy the stuff in exampleSite over to your own content directory, and run again. From there, you can just change the content and remove what's not used.

Hope this helps!

Upvotes: 2

Related Questions