summaryrefslogtreecommitdiffstats
path: root/docs/content/community/contributing.md
blob: eaee9113ac69e49e69e9db9847e755e31a243c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
aliases:
- /doc/contributing/
- /meta/contributing/
lastmod: 2015-02-12
date: 2013-07-01
menu:
  main:
    parent: community
next: /tutorials/automated-deployments
prev: /community/mailing-list
title: Contributing to Hugo
weight: 30
---

All contributions to Hugo are welcome. Whether you want to scratch an itch or simply contribute to the project, feel free to pick something from the [roadmap]({{< relref "meta/roadmap.md" >}}) or contact the dev team via the [Forums](https://discuss.gohugo.io/) or [Gitter](https://gitter.im/spf13/hugo) about what may make sense to do next.

You should fork the project and make your changes.  *We encourage pull requests to discuss code changes.*


When you're ready to create a pull request, be sure to:

  * Have test cases for the new code.  If you have questions about how to do it, please ask in your pull request.
  * Run `go fmt`.
  * Squash your commits into a single commit.  `git rebase -i`.  It's okay to force update your pull request.
  * Run `make check` and ensure it succeeds.  [Travis CI](https://travis-ci.org/spf13/hugo) and [Appveyor](https://ci.appveyor.com/project/spf13/hugo) will runs these checks and fail the build if `make check` fails.

## Contribution Overview

We wrote a [detailed guide]({{< relref "tutorials/how-to-contribute-to-hugo.md" >}}) for newcomers that guides you step by step to your first contribution. If you are more experienced, follow the guide below.


# Building from source

## Vendored Dependencies

Hugo uses [govendor][] to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository.
Therefore, a simple `go get` is not supported since `go get` is not vendor-aware.
You **must use govendor** to fetch Hugo's dependencies.

## Fetch the Sources

    go get github.com/kardianos/govendor
    govendor get github.com/spf13/hugo

## Running Hugo

    cd $HOME/go/src/github.com/spf13/hugo
    go run main.go

## Building Hugo

    cd $HOME/go/src/github.com/spf13/hugo
    make build
    # or to install to $HOME/go/bin:
    make install


# Showcase additions

You got your new website running and it's powered by Hugo? Great. You can add your website with a few steps to the [showcase](/showcase/).

First, make sure that you created a [fork](https://help.github.com/articles/fork-a-repo/) of Hugo on GitHub and cloned your fork on your local computer. Next, create a separate branch for your additions:

```
# You can choose a different descriptive branch name if you like
git checkout -b showcase-addition
```

Let's create a new document that contains some metadata of your homepage. Replace `example` in the following examples with something unique like the name of your website. Inside the terminal enter the following commands:

```
cd docs
hugo new showcase/example.md
```

You should find the new file at `content/showcase/example.md`. Open it in an editor. The file should contain a frontmatter with predefined variables like below:

```
---
date: 2016-02-12T21:01:18+01:00
description: ""
license: ""
licenseLink: ""
sitelink: http://spf13.com/
sourceLink: https://github.com/spf13/spf13.com
tags:
- personal
- blog
thumbnail: /img/spf13-tn.jpg
title: example
---
```

Add at least values for `sitelink`, `title`,  `description` and a path for `thumbnail`.

Furthermore, we need to create the thumbnail of your website. **It's important that the thumbnail has the required dimensions of 600px by 400px.** Give your thumbnail a name like `example-tn.png`. Save it under `docs/static/img/`.

Check a last time that everything works as expected. Start Hugo's built-in server in order to inspect your local copy of the showcase in the browser:

    hugo server

If everything looks fine, we are ready to commit your additions. For the sake of best practices, please make sure that your commit follows our [code contribution guideline](https://github.com/spf13/hugo#code-contribution-guideline).

    git commit -m"docs: Add example.com to the showcase"

Last but not least, we're ready to create a [pull request](https://github.com/spf13/hugo/compare).

Don't forget to accept the contributor license agreement. Click on the yellow badge in the automatically added comment in the pull request.

[govendor]: https://github.com/kardianos/govendor