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.

Nota

Esta página ainda não foi traduzida, portanto, a versão em inglês é usada. Interessado em ajudar? Contribuir

The website is structured and managed in a git version-controlled repository. The files are organized in main root directories, such as /content for the website content (list and single pages, translations, resources such as illustrations), /config, /data, /themes, etc.

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 List page for the corresponding Section. The other Markdown index.md or my-page.md files are regular Single pages, placed directly in the section directory, or nested in their own sub-directory.

Content files are mostly written with Markdown and contain a metadata header called the Front Matter at the top of the file in-between the YAML --- characters. The content of Single and List pages is then generated into HTML by Hugo templates in the Theme Theme, project setup, and configurationEnhance the website project and the Trigo Theme..

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.

Nota

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 linked resources for a specific page, the easiest way is to place these files together in the same folder as the page Markdown file.

The method called page bundles is a Hugo feature that allows to organize content and resource files neatly and makes relative links easy. 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:

Nota

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

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