Hi there! Internet Explorer is no longer supported.

Please use a modern web browser such as Firefox, Chromium or Edge. Thank you!

Structure and Organization

How to organize the website files.

注記

このページはまだ翻訳されていないため、代わりに英語版が表示されます。協力していただけませんか? 貢献

Directory Structure

By default, Hugo looks for Markdown files in the /content directory, and the structure of the directory determines the final output structure of your website.

Take this site as an example:

Each _index.md file is the index page for the corresponding section. The other Markdown files are regular pages, placed directly in the section directory, or nested in their own sub-directory.

Configure Content Directory

By default, the root /content directory is used by Hugo to build the site. If you need to use a different directory for content, for example /docs, this can be done by setting the contentDir parameter in the site configuration hugo.yaml.

Resources

In addition to text content, Hugo supports a wide range of additional resources, such as images, animations, vector graphics, videos, PDF, JSON, CSV, and many more medias and data formats.

注記

For the FreeCAD website, page bundles are used, so it is easier to organize large amount of content and resources in a nested structure.

Additionally, each language is organized into its own root content directory (e.g /content/en/). Resources only need to go into the default language site (en for English), as other languages are linked automatically.

Page bundles

To add resources, the easiest way is to place these files together in the same directory as the Markdown file.

The page bundles feature of Hugo allows to organize content and resource files neatly. To achieve that, turn the my-page.md file into a directory my-page, put the content into a Markdown file named index.md, and put the resource files inside the my-page directory.

For example, add an image file image.webp alongside the my-page.md file:

Then, can use the following Markdown syntax to add the image to the content:

content/en/section/my-page/index.md
![alt](image.webp "title")

Static and Assets

Alternatively, it is possible to place resources in the static and assets root directories, which will make the resources available for all pages:

注記

The path for a resource in the static directory begins with a slash /.

content/section/my-page.md
![alt](/images/image.webp "title")