2019-10-21 04:22:28 -04:00
---
title: Contribute to the Hugo Docs
linktitle: Documentation
2023-05-22 10:43:12 -04:00
description: Documentation is an integral part of any open source project. The Hugo documentation is as much a work in progress as the source it attempts to cover.
2019-10-21 04:22:28 -04:00
categories: [contribute]
keywords: [docs,documentation,community, contribute]
menu:
docs:
2023-05-22 10:43:12 -04:00
parent: contribute
2019-10-21 04:22:28 -04:00
weight: 20
2023-05-22 10:43:12 -04:00
toc: true
2019-10-21 04:22:28 -04:00
weight: 20
aliases: [/contribute/docs/]
---
2023-05-22 10:43:12 -04:00
## GitHub workflow
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Step 1
: Fork the [documentation repository].
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Step 2
: Clone your fork.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Step 3
: Create a new branch with a descriptive name.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
```bash
git checkout -b fix/typos-site-variables
2019-10-21 04:22:28 -04:00
```
2023-05-22 10:43:12 -04:00
Step 4
: Make changes.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Step 5
: Commit your changes with a descriptive commit message, typically 50 characters or less. Included the "Closes" keyword if your change addresses one or more open [issues].
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
```bash
git commit -m "Fix typos on site variables page
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Closes #1234
Closes #5678 "
```
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Step 5
: Push the new branch to your fork of the documentation repository.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Step 6
: Visit the [documentation repository] and create a pull request (PR).
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
[documentation repository]: https://github.com/gohugoio/hugoDocs/
[issues]: https://github.com/gohugoio/hugoDocs/issues
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Step 7
: A project maintainer will review your PR, and may request changes. You may delete your branch after the maintainer merges your PR.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
## Including sample code
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
{{% note %}}
Use this syntax to include shortcodes calls within your code samples:
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
`{{</*/* foo */*/>}}` \
`{{%/*/* foo */*/%}}`
{{% /note %}}
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
### Fenced code blocks
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Include the language when using a fenced code block.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
````text
2022-11-17 10:14:29 -05:00
```go-html-template
2023-05-22 10:43:12 -04:00
{{ if eq $foo "bar" }}
{{ print "foo is bar" }}
2022-11-17 10:14:29 -05:00
{{ end }}
2019-10-21 04:22:28 -04:00
```
````
2023-05-22 10:43:12 -04:00
Rendered:
2019-10-21 04:22:28 -04:00
2022-11-17 10:14:29 -05:00
```go-html-template
2023-05-22 10:43:12 -04:00
{{ if eq $foo "bar" }}
{{ print "foo is bar" }}
{{ end }}
2019-10-21 04:22:28 -04:00
```
2023-05-22 10:43:12 -04:00
### The code shortcode
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Use the `code` shortcode to include the file name and a copy-to-clipboard button. This shortcode accepts these optional parameters:
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
copy
: (`bool`) If `true` , displays a copy-to-clipboard button. Default is `true` .
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
file
: (`string`) The file name to display. If you do not provide a `lang` parameter, the file extension determines the code language.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
lang
: (`string`) The code language. Default is `text` .
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
````text
{{< /* code file="layouts/_default_/single.html" */>}}
{{ if eq $foo "bar" }}
{{ print "foo is bar" }}
2019-10-21 04:22:28 -04:00
{{ end }}
{{< /* /code */>}}
2023-05-22 10:43:12 -04:00
````
Rendered:
{{< code file = "layouts/_default_/single.html" > }}
{{ if eq $foo "bar" }}
{{ print "foo is bar" }}
2019-10-21 04:22:28 -04:00
{{ end }}
{{< / code > }}
2023-05-22 10:43:12 -04:00
### The code-toggle shortcode
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
Use the `code-toggle` shortcode to display examples of site configuration, front matter, or data files. This shortcode accepts these optional parameters:
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
copy
: (`bool`) If `true` , displays a copy-to-clipboard button. Default is `true` .
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
file
: (`string`) The file name to display. Omit the file extension for site configuration and data file examples.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
fm
: (`bool`) If `true` , displays the code as front matter. Default is `false` .
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
#### Site configuration example
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
```text
{{< /* code-toggle file="config" */>}}
baseURL = 'https://example.org'
languageCode = 'en-US'
title = "Example Site"
{{< /* /code-toggle */>}}
2019-10-21 04:22:28 -04:00
```
2023-05-22 10:43:12 -04:00
Rendered:
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
{{< code-toggle file = "config" > }}
baseURL = 'https://example.org'
languageCode = 'en-US'
title = "Example Site"
{{< / code-toggle > }}
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
#### Front matter example
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
```text
{{< /* code-toggle file="content/about.md" fm=true */>}}
title = "About"
date = 2023-04-02T12:47:24-07:00
draft = false
{{< /* /code-toggle */>}}
2019-10-21 04:22:28 -04:00
```
2023-05-22 10:43:12 -04:00
Rendered:
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
{{< code-toggle file = "content/about.md" fm = true > }}
title = "About"
date = 2023-04-02T12:47:24-07:00
draft = false
{{< / code-toggle > }}
2019-10-21 04:22:28 -04:00
## Admonitions
2023-05-22 10:43:12 -04:00
Use the `note` shortcode to draw attention to content. Use the `{{%/* */%}}` notation when calling this shortcode.
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
```text
2019-10-21 04:22:28 -04:00
{{%/* note */%}}
2023-05-22 10:43:12 -04:00
This is **bold** text.
2019-10-21 04:22:28 -04:00
{{%/* /note */%}}
2023-05-22 10:43:12 -04:00
```
2019-10-21 04:22:28 -04:00
{{% note %}}
2023-05-22 10:43:12 -04:00
This is **bold** text.
2019-10-21 04:22:28 -04:00
{{% /note %}}