| 1 |
--- |
| 2 |
title: Development |
| 3 |
description: Contribute to the development of Hugo. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
--- |
| 7 |
|
| 8 |
## Introduction |
| 9 |
|
| 10 |
You can contribute to the Hugo project by: |
| 11 |
|
| 12 |
- Answering questions on the [forum][] |
| 13 |
- Improving the [documentation][] |
| 14 |
- Monitoring the [issue queue][] |
| 15 |
- Creating or improving [themes][] |
| 16 |
- Squashing [bugs][] |
| 17 |
|
| 18 |
Please submit documentation issues and pull requests to the [documentation repository][]. |
| 19 |
|
| 20 |
If you have an idea for an enhancement or new feature, create a new topic on the [forum][] in the "Feature" category. This will help you to: |
| 21 |
|
| 22 |
- Determine if the capability already exists |
| 23 |
- Measure interest |
| 24 |
- Refine the concept |
| 25 |
|
| 26 |
If there is sufficient interest, [create a proposal][]. Do not submit a pull request until the project lead accepts the proposal. |
| 27 |
|
| 28 |
For a complete guide to contributing to Hugo, see the [Contribution Guide][]. |
| 29 |
|
| 30 |
## Prerequisites |
| 31 |
|
| 32 |
To build Hugo from source you must install: |
| 33 |
|
| 34 |
1. Install [Git][] |
| 35 |
1. Install [Go][] version {{% current-go-version %}} or later |
| 36 |
|
| 37 |
## GitHub workflow |
| 38 |
|
| 39 |
> [!NOTE] |
| 40 |
> This section assumes that you have a working knowledge of Go, Git and GitHub, and are comfortable working on the command line. |
| 41 |
|
| 42 |
Use this workflow to create and submit pull requests. |
| 43 |
|
| 44 |
Step 1 |
| 45 |
: Fork the [project repository][]. |
| 46 |
|
| 47 |
Step 2 |
| 48 |
: Clone your fork. |
| 49 |
|
| 50 |
Step 3 |
| 51 |
: Create a new branch with a descriptive name that includes the corresponding issue number. |
| 52 |
|
| 53 |
For a new feature: |
| 54 |
|
| 55 |
```sh |
| 56 |
git checkout -b feat/implement-some-feature-99999 |
| 57 |
``` |
| 58 |
|
| 59 |
For a bug fix: |
| 60 |
|
| 61 |
```sh |
| 62 |
git checkout -b fix/fix-some-bug-99999 |
| 63 |
``` |
| 64 |
|
| 65 |
Step 4 |
| 66 |
: Make changes. |
| 67 |
|
| 68 |
Step 5 |
| 69 |
: Build and install. |
| 70 |
|
| 71 |
To build and install the standard edition: |
| 72 |
|
| 73 |
```sh |
| 74 |
CGO_ENABLED=0 go install |
| 75 |
``` |
| 76 |
|
| 77 |
{{< new-in v0.159.2 />}} To build and install the deploy edition: |
| 78 |
|
| 79 |
```sh |
| 80 |
CGO_ENABLED=0 go install -tags withdeploy |
| 81 |
``` |
| 82 |
|
| 83 |
To build and install the extended edition, first install a C compiler such as [GCC][] or [Clang][] and then run the following command: |
| 84 |
|
| 85 |
```sh |
| 86 |
CGO_ENABLED=1 go install -tags extended |
| 87 |
``` |
| 88 |
|
| 89 |
To build and install the extended/deploy edition, first install a C compiler such as [GCC][] or [Clang][] and then run the following command: |
| 90 |
|
| 91 |
```sh |
| 92 |
CGO_ENABLED=1 go install -tags extended,withdeploy |
| 93 |
``` |
| 94 |
|
| 95 |
Step 6 |
| 96 |
: Test your changes: |
| 97 |
|
| 98 |
```sh |
| 99 |
go test ./... |
| 100 |
``` |
| 101 |
|
| 102 |
Step 7 |
| 103 |
: Commit your changes with a descriptive commit message: |
| 104 |
|
| 105 |
- Provide a summary on the first line, typically 50 characters or less, followed by a blank line. |
| 106 |
- Begin the summary with the name of the package, followed by a colon, a space, and a brief description of the change beginning with a capital letter |
| 107 |
- Use imperative present tense |
| 108 |
- See the [commit message guidelines][] for requirements |
| 109 |
- Optionally, provide a detailed description where each line is 72 characters or less, followed by a blank line. |
| 110 |
- Add one or more "Fixes" or "Closes" keywords, each on its own line, referencing the [issues][] addressed by this change. |
| 111 |
|
| 112 |
For example: |
| 113 |
|
| 114 |
```sh |
| 115 |
git commit -m "tpl/strings: Create wrap function |
| 116 |
|
| 117 |
The strings.Wrap function wraps a string into one or more lines, |
| 118 |
splitting the string after the given number of characters, but not |
| 119 |
splitting in the middle of a word. |
| 120 |
|
| 121 |
Fixes #99998 |
| 122 |
Closes #99999" |
| 123 |
``` |
| 124 |
|
| 125 |
Step 8 |
| 126 |
: Push the new branch to your fork of the documentation repository. |
| 127 |
|
| 128 |
Step 9 |
| 129 |
: Visit the [project repository][] and create a pull request (PR). |
| 130 |
|
| 131 |
Step 10 |
| 132 |
: A project maintainer will review your PR and may request changes. You may delete your branch after the maintainer merges your PR. |
| 133 |
|
| 134 |
[Clang]: https://clang.llvm.org/ |
| 135 |
[Contribution Guide]: https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md |
| 136 |
[GCC]: https://gcc.gnu.org/ |
| 137 |
[Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git |
| 138 |
[Go]: https://go.dev/doc/install |
| 139 |
[bugs]: https://github.com/gohugoio/hugo/issues?q=is%3Aopen+is%3Aissue+label%3ABug |
| 140 |
[commit message guidelines]: https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md#git-commit-message-guidelines |
| 141 |
[create a proposal]: https://github.com/gohugoio/hugo/issues/new?labels=Proposal%2C+NeedsTriage&template=feature_request.md |
| 142 |
[documentation repository]: https://github.com/gohugoio/hugoDocs |
| 143 |
[documentation]: /documentation |
| 144 |
[forum]: https://discourse.gohugo.io |
| 145 |
[issue queue]: https://github.com/gohugoio/hugo/issues |
| 146 |
[issues]: https://github.com/gohugoio/hugo/issues |
| 147 |
[project repository]: https://github.com/gohugoio/hugo/ |
| 148 |
[themes]: https://themes.gohugo.io/ |