mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-31 18:52:38 +00:00
Compare commits
186 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 956a2dce8d | |||
| 1f1c562b9c | |||
| 3e1a6ebc11 | |||
| 8915cb83f4 | |||
| 57637d89ec | |||
| 900b5f6cfe | |||
| 13ea1e7c35 | |||
| 9f740b37cf | |||
| e39797fa72 | |||
| 00868081f6 | |||
| e9750d831f | |||
| 19d9a46f63 | |||
| 0602135fd4 | |||
| 55bd46a633 | |||
| 8dc77b84a5 | |||
| 4560261b58 | |||
| 374d184e67 | |||
| 772128485a | |||
| c2c4cb1f9f | |||
| 492fea7cd2 | |||
| 5ed11edf5a | |||
| 799c654b0d | |||
| faa3159e5e | |||
| eaf573a277 | |||
| 3ced6f8d47 | |||
| a3f26e5636 | |||
| 0c452c6e7d | |||
| ff10c15a93 | |||
| efd506314a | |||
| 8de91da74f | |||
| 25e88ccabe | |||
| 19228ed83c | |||
| a1f40084f9 | |||
| d7bf9d4daa | |||
| 53e661e7c9 | |||
| fc23a80ffd | |||
| d8fdffb552 | |||
| 2851af0225 | |||
| 08521dac83 | |||
| 58382e9572 | |||
| 53dac9a506 | |||
| 4edb4bcc65 | |||
| 0816a97a46 | |||
| 10a917dfdc | |||
| d4beef0d2b | |||
| 51213e0be1 | |||
| 1fa2417777 | |||
| bb549a0d57 | |||
| 82eefded13 | |||
| e172834993 | |||
| b5cb8866e9 | |||
| 9cc9bab462 | |||
| d382502d6d | |||
| 2e95ec6844 | |||
| 76d38d5e53 | |||
| f554503fef | |||
| 16a5c74519 | |||
| 49b98975be | |||
| 0de375a7e7 | |||
| e02ee7d6ad | |||
| 18e3657a2a | |||
| 4bc8727fc6 | |||
| a9a0190b13 | |||
| 742deaa3d0 | |||
| 694c0fd763 | |||
| 15ff076572 | |||
| c305e44f5f | |||
| 722086b4ed | |||
| 084cf4191b | |||
| fc06d5c18b | |||
| 9a367d9d06 | |||
| 4402c07775 | |||
| 4743de0d3c | |||
| 19e26cb4eb | |||
| 0283db6c60 | |||
| 58188807aa | |||
| 51d5c5421e | |||
| a9a5b1e094 | |||
| cf5c2df81c | |||
| 158e1151cd | |||
| 337d0c5f51 | |||
| f0c0ece44d | |||
| a34213f0b5 | |||
| fe40823de0 | |||
| ae742cb1bd | |||
| feeed073c3 | |||
| 94e736c5e1 | |||
| 1707dae8d3 | |||
| 2fa70c9344 | |||
| b6f3f087aa | |||
| adfd4370b6 | |||
| 25d691daff | |||
| df20b05463 | |||
| 863a812e07 | |||
| f08ea02d24 | |||
| 016398ffe2 | |||
| 3752348ef1 | |||
| 4eb2fec67c | |||
| 83c761b71a | |||
| ed4a00e46f | |||
| 7b472e4608 | |||
| 96e3fbcf23 | |||
| a91aba1c15 | |||
| 6413559f75 | |||
| 322c567220 | |||
| 91bb774ae4 | |||
| 3f0379adb7 | |||
| ae5a45be6f | |||
| 4d912e2aad | |||
| 1e27d05891 | |||
| d418c2c2ea | |||
| b2fcbb1f97 | |||
| 3446fe9b89 | |||
| 4a7c2b3695 | |||
| 912147ab89 | |||
| 517b6b6238 | |||
| a19563910e | |||
| 0432c64dd2 | |||
| 5a0819b9b5 | |||
| 78c863305f | |||
| 22ad1ebdbb | |||
| ebdd8cba3f | |||
| 8125b4b03d | |||
| 87217d1d0a | |||
| ffd7dc396e | |||
| 2228d3e289 | |||
| 5903a9ce10 | |||
| 4d644c9d68 | |||
| 34a216fe67 | |||
| adee04f4b4 | |||
| 9421380168 | |||
| 5d03086981 | |||
| 07700aab0d | |||
| 4d5e4f379a | |||
| cd77968284 | |||
| c7b9347be0 | |||
| c6b9037294 | |||
| 09a934b321 | |||
| e6cc2a6551 | |||
| a39ae4bb07 | |||
| b3eeb97642 | |||
| 3cf4300097 | |||
| 9409bc0f79 | |||
| 4eb1650bec | |||
| 20c9b6ec81 | |||
| f8a119b606 | |||
| ecaf14514e | |||
| d4f8f88e67 | |||
| 4e524ffcff | |||
| 64f0e9d1c1 | |||
| 13d53b31f1 | |||
| 51dd462c39 | |||
| b6ea6d07d0 | |||
| 4dac1781e3 | |||
| 8a409894bd | |||
| 46db900dab | |||
| 60c9f3b1c3 | |||
| 57e10f174e | |||
| db85e83403 | |||
| 1046e9363f | |||
| d5803da1be | |||
| 27c77e1ab9 | |||
| 218773a82b | |||
| a97ef61bad | |||
| 4aaf27dc55 | |||
| f7d0b05f93 | |||
| f82428d2e0 | |||
| 50fb49c3d9 | |||
| 5235a5bf5e | |||
| 1921a70ab1 | |||
| f0eecc6a4f | |||
| 768ec5df9f | |||
| 238e7f7fbe | |||
| 0aaa38544d | |||
| fdec5e3084 | |||
| 71abb53fff | |||
| db5d79862b | |||
| 2d3189b227 | |||
| 4b04db0f08 | |||
| 97c1866e32 | |||
| 8969331f5b | |||
| 6feb138785 | |||
| 059e8458d6 | |||
| ab82a27d05 | |||
| f25d8a9e17 | |||
| 54a89cde69 |
@@ -1,7 +1,7 @@
|
||||
defaults: &defaults
|
||||
working_directory: /go/src/github.com/gohugoio
|
||||
docker:
|
||||
- image: bepsays/ci-goreleaser:0.34.2-6
|
||||
- image: bepsays/ci-goreleaser:0.34.2-10
|
||||
|
||||
version: 2
|
||||
jobs:
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 120
|
||||
daysUntilStale: 90
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 21
|
||||
daysUntilClose: 14
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- Keep
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ language: go
|
||||
sudo: required
|
||||
dist: precise
|
||||
go:
|
||||
- 1.8.5
|
||||
- 1.9.2
|
||||
- 1.9.4
|
||||
- "1.10"
|
||||
- tip
|
||||
os:
|
||||
- linux
|
||||
|
||||
+61
-28
@@ -36,6 +36,23 @@ the GitHub [issue tracker](https://github.com/gohugoio/hugo/issues) to report th
|
||||
If you're not sure if it's a bug or not, start by asking in the [discussion forum](https://discourse.gohugo.io).
|
||||
When reporting the issue, please provide the version of Hugo in use (`hugo version`) and your operating system.
|
||||
|
||||
## Code Contribution
|
||||
|
||||
Hugo has become a fully featured static site generator, so any new functionality must meet these criterias:
|
||||
|
||||
* It must be useful to many.
|
||||
* It must fit natural into _what Hugo does best._
|
||||
* It must strive not to break existing sites.
|
||||
* It must close ur update an open [Hugo issue](https://github.com/gohugoio/hugo/issues)
|
||||
* If it is of some complexity, the contributor is expected to maintain and support the new future (answer questions on the forum, fix any bugs etc.).
|
||||
|
||||
So, to avoid doing unneeded work, it is recommended to open up a discussion on the [Hugo Forum](https://discourse.gohugo.io/) to get some acceptance that this is a good idea. Also, if this is a complex feature, create a small design proposal on the [Hugo issue tracker](https://github.com/gohugoio/hugo/issues) before you start coding.
|
||||
|
||||
|
||||
**Bug fixes are, of course, always welcome.**
|
||||
|
||||
|
||||
|
||||
## Submitting Patches
|
||||
|
||||
The Hugo project welcomes all contributors and contributions regardless of skill or experience level.
|
||||
@@ -88,42 +105,42 @@ new default function more useful for Hugo users.
|
||||
Fixes #1949
|
||||
```
|
||||
|
||||
### Vendored Dependencies
|
||||
|
||||
Hugo uses [Go Dep](https://github.com/golang/dep) 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 Go Dep** to fetch and manage Hugo's dependencies.
|
||||
|
||||
### Fetch the Sources From GitHub
|
||||
### Fetching the Sources From GitHub
|
||||
|
||||
Due to the way Go handles package imports, the best approach for working on a
|
||||
Hugo fork is to use Git Remotes. Here's a simple walk-through for getting
|
||||
started:
|
||||
|
||||
1. Install Go Dep and get the Hugo source:
|
||||
1. Get the Hugo source:
|
||||
|
||||
```bash
|
||||
go get -u -v -d github.com/gohugoio/hugo
|
||||
```
|
||||
|
||||
1. Install Mage:
|
||||
|
||||
```bash
|
||||
go get github.com/magefile/mage
|
||||
```
|
||||
go get -u -v github.com/golang/dep/cmd/dep
|
||||
go get -u -v -d github.com/gohugoio/hugo
|
||||
```
|
||||
|
||||
1. Change to the Hugo source directory and fetch the dependencies:
|
||||
|
||||
```
|
||||
```bash
|
||||
cd $HOME/go/src/github.com/gohugoio/hugo
|
||||
dep ensure
|
||||
mage vendor
|
||||
```
|
||||
|
||||
Note that Hugo uses [Go Dep](https://github.com/golang/dep) to vendor dependencies, rather than a a simple `go get`. We don't commit the vendored packages themselves to the Hugo git repository. The call to `mage vendor` takes care of all this for you.
|
||||
|
||||
1. Create a new branch for your changes (the branch name is arbitrary):
|
||||
|
||||
```
|
||||
```bash
|
||||
git checkout -b iss1234
|
||||
```
|
||||
|
||||
1. After making your changes, commit them to your new branch:
|
||||
|
||||
```
|
||||
```bash
|
||||
git commit -a -v
|
||||
```
|
||||
|
||||
@@ -131,42 +148,58 @@ started:
|
||||
|
||||
1. Add your fork as a new remote (the remote name, "fork" in this example, is arbitrary):
|
||||
|
||||
```
|
||||
```bash
|
||||
git remote add fork git://github.com/USERNAME/hugo.git
|
||||
```
|
||||
|
||||
1. Push the changes to your new remote:
|
||||
|
||||
```
|
||||
```bash
|
||||
git push --set-upstream fork iss1234
|
||||
```
|
||||
|
||||
1. You're now ready to submit a PR based upon the new branch in your forked repository.
|
||||
|
||||
### Build Hugo with Your Changes
|
||||
### Building Hugo with Your Changes
|
||||
|
||||
**Note:** Hugo uses [mage](https://github.com/magefile/mage) to build. To install `mage` run
|
||||
|
||||
```bash
|
||||
go get github.com/magefile/mage
|
||||
```
|
||||
|
||||
`mage -l` lists all available commands with the corresponding description. To build Hugo run
|
||||
Hugo uses [mage](https://github.com/magefile/mage) to sync vendor dependencies, build Hugo, run the test suite and other things. You must run mage from the Hugo directory.
|
||||
|
||||
```bash
|
||||
cd $HOME/go/src/github.com/gohugoio/hugo
|
||||
```
|
||||
|
||||
To build Hugo:
|
||||
|
||||
```bash
|
||||
mage hugo
|
||||
# or to install in $HOME/go/bin:
|
||||
```
|
||||
|
||||
To install hugo in `$HOME/go/bin`:
|
||||
|
||||
```bash
|
||||
mage install
|
||||
```
|
||||
|
||||
To run the tests:
|
||||
|
||||
```bash
|
||||
mage hugoRace
|
||||
mage -v check
|
||||
```
|
||||
|
||||
To list all available commands along with descriptions:
|
||||
|
||||
```bash
|
||||
mage -l
|
||||
```
|
||||
|
||||
### Updating the Hugo Sources
|
||||
|
||||
If you want to stay in sync with the Hugo repository, you can easily pull down
|
||||
the source changes, but you'll need to keep the vendored packages up-to-date as
|
||||
well.
|
||||
|
||||
```
|
||||
```bash
|
||||
git pull
|
||||
mage vendor
|
||||
```
|
||||
|
||||
+1
-1
@@ -4,8 +4,8 @@ RUN apk add --no-cache --virtual git musl-dev
|
||||
RUN go get github.com/golang/dep/cmd/dep
|
||||
|
||||
WORKDIR /go/src/github.com/gohugoio/hugo
|
||||
RUN dep ensure
|
||||
ADD . /go/src/github.com/gohugoio/hugo/
|
||||
RUN dep ensure
|
||||
RUN go install -ldflags '-s -w'
|
||||
|
||||
FROM alpine:3.6
|
||||
|
||||
Generated
+86
-39
@@ -26,9 +26,35 @@
|
||||
"formatters",
|
||||
"formatters/html",
|
||||
"lexers",
|
||||
"lexers/a",
|
||||
"lexers/b",
|
||||
"lexers/c",
|
||||
"lexers/d",
|
||||
"lexers/e",
|
||||
"lexers/f",
|
||||
"lexers/g",
|
||||
"lexers/h",
|
||||
"lexers/i",
|
||||
"lexers/internal",
|
||||
"lexers/j",
|
||||
"lexers/k",
|
||||
"lexers/l",
|
||||
"lexers/m",
|
||||
"lexers/n",
|
||||
"lexers/o",
|
||||
"lexers/p",
|
||||
"lexers/q",
|
||||
"lexers/r",
|
||||
"lexers/s",
|
||||
"lexers/t",
|
||||
"lexers/v",
|
||||
"lexers/w",
|
||||
"lexers/x",
|
||||
"lexers/y",
|
||||
"styles"
|
||||
]
|
||||
revision = "v0.2.0"
|
||||
revision = "563aadc53c53292c4c1def1b0a547be498bba83e"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -39,13 +65,14 @@
|
||||
[[projects]]
|
||||
name = "github.com/chaseadamsio/goorgeous"
|
||||
packages = ["."]
|
||||
revision = "v1.1.0"
|
||||
revision = "dcf1ef873b8987bf12596fe6951c48347986eb2f"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/cpuguy83/go-md2man"
|
||||
packages = ["md2man"]
|
||||
revision = "1d903dcb749992f3741d744c0f8376b4bd7eb3e1"
|
||||
version = "v1.0.7"
|
||||
revision = "a65d4d2de4d5f7c74868dfa9b202a3c8be315aaa"
|
||||
version = "v1.0.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -62,7 +89,8 @@
|
||||
[[projects]]
|
||||
name = "github.com/disintegration/imaging"
|
||||
packages = ["."]
|
||||
revision = "v1.2.4"
|
||||
revision = "dd50a3ee9985ccd313a2f03c398fcaedc96dc707"
|
||||
version = "v1.2.4"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/dlclark/regexp2"
|
||||
@@ -91,8 +119,23 @@
|
||||
[[projects]]
|
||||
name = "github.com/fsnotify/fsnotify"
|
||||
packages = ["."]
|
||||
revision = "629574ca2a5df945712d3079857300b5e4da0236"
|
||||
version = "v1.4.2"
|
||||
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
|
||||
version = "v1.4.7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobwas/glob"
|
||||
packages = [
|
||||
".",
|
||||
"compiler",
|
||||
"match",
|
||||
"syntax",
|
||||
"syntax/ast",
|
||||
"syntax/lexer",
|
||||
"util/runes",
|
||||
"util/strings"
|
||||
]
|
||||
revision = "5ccd90ef52e1e632236f7326478d4faa74f99438"
|
||||
version = "v0.2.3"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gorilla/websocket"
|
||||
@@ -104,13 +147,13 @@
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/go-immutable-radix"
|
||||
packages = ["."]
|
||||
revision = "8aac2701530899b64bdea735a1de8da899815220"
|
||||
revision = "7f3cd4390caab3250a57f30efdb2a65dd7649ecf"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/golang-lru"
|
||||
packages = ["simplelru"]
|
||||
revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6"
|
||||
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -143,12 +186,6 @@
|
||||
revision = "20d3663d4bc9dd10d75abcde9d92e04b4861c674"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/kardianos/osext"
|
||||
packages = ["."]
|
||||
revision = "ae77be60afb1dcacde03767a8c37337fad28ac14"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/kyokomi/emoji"
|
||||
packages = ["."]
|
||||
@@ -167,14 +204,13 @@
|
||||
[[projects]]
|
||||
name = "github.com/magiconair/properties"
|
||||
packages = ["."]
|
||||
revision = "be5ece7dd465ab0765a9682137865547526d1dfb"
|
||||
version = "v1.7.3"
|
||||
revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
|
||||
version = "v1.7.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/inflect"
|
||||
packages = ["."]
|
||||
revision = "54ffb37507cd7d2ccd4768855e84f9ff6c4352b6"
|
||||
revision = "a12c3aec81a6a938bf584a4bac567afed9256586"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-runewidth"
|
||||
@@ -192,7 +228,16 @@
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/mapstructure"
|
||||
packages = ["."]
|
||||
revision = "06020f85339e21b2478f756a78e295255ffa4d6a"
|
||||
revision = "a4e142e9c047c904fa2f1e144d9a84e6133024bc"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/muesli/smartcrop"
|
||||
packages = [
|
||||
".",
|
||||
"options"
|
||||
]
|
||||
revision = "1db484956b9ef929344e51701299a017beefdaaa"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/nicksnyder/go-i18n"
|
||||
@@ -208,13 +253,13 @@
|
||||
branch = "master"
|
||||
name = "github.com/olekukonko/tablewriter"
|
||||
packages = ["."]
|
||||
revision = "65fec0d89a572b4367094e2058d3ebe667de3b60"
|
||||
revision = "b8a9be070da40449e501c3c4730a889e42d87a9e"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pelletier/go-toml"
|
||||
packages = ["."]
|
||||
revision = "16398bac157da96aa88f98a2df640c7f32af1da2"
|
||||
version = "v1.0.1"
|
||||
revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
@@ -223,10 +268,10 @@
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/russross/blackfriday"
|
||||
packages = ["."]
|
||||
revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c"
|
||||
version = "v1.5"
|
||||
revision = "55d61fa8aa702f59229e6cff85793c22e580eaf5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -240,14 +285,14 @@
|
||||
".",
|
||||
"mem"
|
||||
]
|
||||
revision = "ec3a3111d1e1bdff38a61e09d5a5f5e974905611"
|
||||
version = "v1.0.1"
|
||||
revision = "bb8f1927f2a9d3ab41c9340aa034f6b803f4359c"
|
||||
version = "v1.0.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/cast"
|
||||
packages = ["."]
|
||||
revision = "acbeb36b902d72a7a4c18e8f3241075e7ab763e4"
|
||||
version = "v1.1.0"
|
||||
revision = "8965335b8c7107321228e3e3702cab9832751bac"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -256,7 +301,7 @@
|
||||
".",
|
||||
"doc"
|
||||
]
|
||||
revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b"
|
||||
revision = "be77323fc05148ef091e83b3866c0d47c8e74a8b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -268,7 +313,7 @@
|
||||
branch = "master"
|
||||
name = "github.com/spf13/jwalterweatherman"
|
||||
packages = ["."]
|
||||
revision = "12bd96e66386c1960ab0f74ced1362f66f552f7b"
|
||||
revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -294,8 +339,8 @@
|
||||
"assert",
|
||||
"require"
|
||||
]
|
||||
revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
|
||||
version = "v1.1.4"
|
||||
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
|
||||
version = "v1.2.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/yosssi/ace"
|
||||
@@ -308,6 +353,8 @@
|
||||
name = "golang.org/x/image"
|
||||
packages = [
|
||||
"bmp",
|
||||
"draw",
|
||||
"math/f64",
|
||||
"riff",
|
||||
"tiff",
|
||||
"tiff/lzw",
|
||||
@@ -315,7 +362,7 @@
|
||||
"vp8l",
|
||||
"webp"
|
||||
]
|
||||
revision = "f7e31b4ea2e3413ab91b4e7d2dc83e5f8d19a44c"
|
||||
revision = "12117c17ca67ffa1ce22e9409f3b0b0a93ac08c7"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -324,7 +371,7 @@
|
||||
"context",
|
||||
"idna"
|
||||
]
|
||||
revision = "cd69bc3fc700721b709c3a59e16e24c67b58f6ff"
|
||||
revision = "136a25c244d3019482a795d728110278d6ba09a4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -336,7 +383,7 @@
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "8dbc5d05d6edcc104950cc299a1ce6641235bc86"
|
||||
revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -358,17 +405,17 @@
|
||||
"unicode/rangetable",
|
||||
"width"
|
||||
]
|
||||
revision = "c01e4764d870b77f8abe5096ee19ad20d80e8075"
|
||||
revision = "4e4a3210bb54bb31f6ab2cdca2edcc0b50c420c1"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
|
||||
revision = "d670f9405373e636a5a2765eea47fac0c9bc91a4"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "7259b4caf8e75db0b809f06d4897dc870261252e3aecd68ea1348c87a5da9d50"
|
||||
inputs-digest = "960c7cc0b7d1739f5c1f116cc7fa31056b76cf16e63d865f31be875b8e674da7"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
||||
+22
-16
@@ -10,19 +10,19 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/alecthomas/chroma"
|
||||
revision = "v0.2.0"
|
||||
version = "0.3.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/bep/gitmap"
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/chaseadamsio/goorgeous"
|
||||
revision = "v1.1.0"
|
||||
version = "^1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/disintegration/imaging"
|
||||
revision = "v1.2.4"
|
||||
version = "~v1.2.4"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/magefile/mage"
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/fsnotify/fsnotify"
|
||||
version = "1.4.2"
|
||||
version = "^1.4.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gorilla/websocket"
|
||||
@@ -52,21 +52,17 @@
|
||||
name = "github.com/jdkato/prose"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/kardianos/osext"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/kyokomi/emoji"
|
||||
version = "1.5.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/inflect"
|
||||
revision = "a12c3aec81a6a938bf584a4bac567afed9256586"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/miekg/mmark"
|
||||
version = "1.3.6"
|
||||
version = "^1.3.6"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
@@ -74,19 +70,19 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/nicksnyder/go-i18n"
|
||||
version = "1.10.0"
|
||||
version = "^1.10.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/russross/blackfriday"
|
||||
version = "1.5.0"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/afero"
|
||||
version = "1.0.1"
|
||||
version = "^1.0.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/cast"
|
||||
version = "1.1.0"
|
||||
version = "^1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
@@ -122,7 +118,7 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/yosssi/ace"
|
||||
version = "0.0.5"
|
||||
version = "^0.0.5"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
@@ -135,3 +131,13 @@
|
||||
[[constraint]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gobwas/glob"
|
||||
version = "0.2.2"
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/muesli/smartcrop"
|
||||
branch = "master"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
A Fast and Flexible Static Site Generator built with love by [spf13](http://spf13.com/) and [friends](https://github.com/gohugoio/hugo/graphs/contributors) in [Go][].
|
||||
A Fast and Flexible Static Site Generator built with love by [bep](https://github.com/bep), [spf13](http://spf13.com/) and [friends](https://github.com/gohugoio/hugo/graphs/contributors) in [Go][].
|
||||
|
||||
[Website](https://gohugo.io) |
|
||||
[Forum](https://discourse.gohugo.io) |
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ install:
|
||||
- go get github.com/magefile/mage
|
||||
|
||||
build_script:
|
||||
- mage hugoRace
|
||||
- mage vendor hugoRace
|
||||
- mage -v check
|
||||
- hugo -s docs/
|
||||
- hugo --renderToMemory -s docs/
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ GOEXE="${GOEXE-go}"
|
||||
|
||||
echo "Running with BenchmarkSiteBuilding/${1}"
|
||||
|
||||
"${GOEXE}" test -run="NONE" -bench="BenchmarkSiteBuilding/${1}" -test.benchmem=true ./hugolib -memprofile mem.prof -cpuprofile cpu.prof
|
||||
"${GOEXE}" test -run="NONE" -bench="BenchmarkSiteBuilding/${1}" -test.benchmem=true ./hugolib -memprofile mem.prof -count 3 -cpuprofile cpu.prof
|
||||
|
||||
@@ -48,7 +48,11 @@ func init() {
|
||||
}
|
||||
|
||||
func benchmark(cmd *cobra.Command, args []string) error {
|
||||
c, err := InitializeConfig(false, nil, benchmarkCmd)
|
||||
cfgInit := func(c *commandeer) error {
|
||||
c.Set("renderToMemory", renderToMemory)
|
||||
return nil
|
||||
}
|
||||
c, err := InitializeConfig(false, cfgInit, benchmarkCmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+73
-69
@@ -18,8 +18,10 @@ package commands
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os/signal"
|
||||
"sort"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
@@ -30,7 +32,6 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
src "github.com/gohugoio/hugo/source"
|
||||
@@ -207,7 +208,6 @@ func AddCommands() {
|
||||
HugoCmd.AddCommand(convertCmd)
|
||||
HugoCmd.AddCommand(newCmd)
|
||||
HugoCmd.AddCommand(listCmd)
|
||||
HugoCmd.AddCommand(undraftCmd)
|
||||
HugoCmd.AddCommand(importCmd)
|
||||
|
||||
HugoCmd.AddCommand(genCmd)
|
||||
@@ -241,9 +241,6 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().BoolP("buildDrafts", "D", false, "include content marked as draft")
|
||||
cmd.Flags().BoolP("buildFuture", "F", false, "include content with publishdate in the future")
|
||||
cmd.Flags().BoolP("buildExpired", "E", false, "include expired content")
|
||||
cmd.Flags().Bool("disable404", false, "do not render 404 page")
|
||||
cmd.Flags().Bool("disableRSS", false, "do not build RSS files")
|
||||
cmd.Flags().Bool("disableSitemap", false, "do not build Sitemap file")
|
||||
cmd.Flags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
|
||||
cmd.Flags().StringVarP(&contentDir, "contentDir", "c", "", "filesystem path to content directory")
|
||||
cmd.Flags().StringVarP(&layoutDir, "layoutDir", "l", "", "filesystem path to layout directory")
|
||||
@@ -252,8 +249,8 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().StringVarP(&destination, "destination", "d", "", "filesystem path to write files to")
|
||||
cmd.Flags().StringVarP(&theme, "theme", "t", "", "theme to use (located in /themes/THEMENAME/)")
|
||||
cmd.Flags().StringVarP(&themesDir, "themesDir", "", "", "filesystem path to themes directory")
|
||||
cmd.Flags().Bool("uglyURLs", false, "if true, use /filename.html instead of /filename/")
|
||||
cmd.Flags().Bool("canonifyURLs", false, "if true, all relative URLs will be canonicalized using baseURL")
|
||||
cmd.Flags().Bool("uglyURLs", false, "(deprecated) if true, use /filename.html instead of /filename/")
|
||||
cmd.Flags().Bool("canonifyURLs", false, "(deprecated) if true, all relative URLs will be canonicalized using baseURL")
|
||||
cmd.Flags().StringVarP(&baseURL, "baseURL", "b", "", "hostname (and path) to the root, e.g. http://spf13.com/")
|
||||
cmd.Flags().Bool("enableGitInfo", false, "add Git revision, date and author info to the pages")
|
||||
cmd.Flags().BoolVar(&gc, "gc", false, "enable to run some cleanup tasks (remove unused cache files) after the build")
|
||||
@@ -261,8 +258,8 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().BoolVar(&nitro.AnalysisOn, "stepAnalysis", false, "display memory and timing of different steps of the program")
|
||||
cmd.Flags().Bool("templateMetrics", false, "display metrics about template executions")
|
||||
cmd.Flags().Bool("templateMetricsHints", false, "calculate some improvement hints when combined with --templateMetrics")
|
||||
cmd.Flags().Bool("pluralizeListTitles", true, "pluralize titles in lists using inflect")
|
||||
cmd.Flags().Bool("preserveTaxonomyNames", false, `preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")`)
|
||||
cmd.Flags().Bool("pluralizeListTitles", true, "(deprecated) pluralize titles in lists using inflect")
|
||||
cmd.Flags().Bool("preserveTaxonomyNames", false, `(deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")`)
|
||||
cmd.Flags().BoolP("forceSyncStatic", "", false, "copy all files when static is changed.")
|
||||
cmd.Flags().BoolP("noTimes", "", false, "don't sync modification time of files")
|
||||
cmd.Flags().BoolP("noChmod", "", false, "don't sync permission mode of files")
|
||||
@@ -349,10 +346,6 @@ func InitializeConfig(running bool, doWithCommandeer func(c *commandeer) error,
|
||||
|
||||
config.Set("logI18nWarnings", logI18nWarnings)
|
||||
|
||||
if !config.GetBool("relativeURLs") && config.GetString("baseURL") == "" {
|
||||
cfg.Logger.ERROR.Println("No 'baseURL' set in configuration or as a flag. Features like page menus will not work without one.")
|
||||
}
|
||||
|
||||
if theme != "" {
|
||||
config.Set("theme", theme)
|
||||
}
|
||||
@@ -490,9 +483,6 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
|
||||
"buildExpired",
|
||||
"uglyURLs",
|
||||
"canonifyURLs",
|
||||
"disable404",
|
||||
"disableRSS",
|
||||
"disableSitemap",
|
||||
"enableRobotsTXT",
|
||||
"enableGitInfo",
|
||||
"pluralizeListTitles",
|
||||
@@ -505,19 +495,6 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
|
||||
"templateMetricsHints",
|
||||
}
|
||||
|
||||
// Remove these in Hugo 0.33.
|
||||
if cmd.Flags().Changed("disable404") {
|
||||
helpers.Deprecated("command line", "--disable404", "Use --disableKinds=404", true)
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("disableRSS") {
|
||||
helpers.Deprecated("command line", "--disableRSS", "Use --disableKinds=RSS", true)
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("disableSitemap") {
|
||||
helpers.Deprecated("command line", "--disableSitemap", "Use --disableKinds=sitemap", true)
|
||||
}
|
||||
|
||||
for _, key := range persFlagKeys {
|
||||
c.setValueFromFlag(cmd.PersistentFlags(), key)
|
||||
}
|
||||
@@ -527,8 +504,21 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
|
||||
|
||||
}
|
||||
|
||||
var deprecatedFlags = map[string]bool{
|
||||
strings.ToLower("uglyURLs"): true,
|
||||
strings.ToLower("pluralizeListTitles"): true,
|
||||
strings.ToLower("preserveTaxonomyNames"): true,
|
||||
strings.ToLower("canonifyURLs"): true,
|
||||
}
|
||||
|
||||
func (c *commandeer) setValueFromFlag(flags *flag.FlagSet, key string) {
|
||||
if flags.Changed(key) {
|
||||
if _, deprecated := deprecatedFlags[strings.ToLower(key)]; deprecated {
|
||||
msg := fmt.Sprintf(`Set "%s = true" in your config.toml.
|
||||
If you need to set this configuration value from the command line, set it via an OS environment variable: "HUGO_%s=true hugo"`, key, strings.ToUpper(key))
|
||||
// Remove in Hugo 0.37
|
||||
helpers.Deprecated("hugo", "--"+key+" flag", msg, false)
|
||||
}
|
||||
f := flags.Lookup(key)
|
||||
c.Set(key, f.Value.String())
|
||||
}
|
||||
@@ -548,7 +538,7 @@ func (c *commandeer) watchConfig() {
|
||||
})
|
||||
}
|
||||
|
||||
func (c *commandeer) fullBuild(watches ...bool) error {
|
||||
func (c *commandeer) fullBuild() error {
|
||||
var (
|
||||
g errgroup.Group
|
||||
langCount map[string]uint64
|
||||
@@ -561,25 +551,36 @@ func (c *commandeer) fullBuild(watches ...bool) error {
|
||||
}()
|
||||
}
|
||||
|
||||
g.Go(func() error {
|
||||
copyStaticFunc := func() error {
|
||||
cnt, err := c.copyStatic()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error copying static files: %s", err)
|
||||
}
|
||||
langCount = cnt
|
||||
return nil
|
||||
})
|
||||
|
||||
g.Go(func() error {
|
||||
}
|
||||
buildSitesFunc := func() error {
|
||||
if err := c.buildSites(); err != nil {
|
||||
return fmt.Errorf("Error building site: %s", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err := g.Wait(); err != nil {
|
||||
return err
|
||||
}
|
||||
// Do not copy static files and build sites in parallel if cleanDestinationDir is enabled.
|
||||
// This flag deletes all static resources in /public folder that are missing in /static,
|
||||
// and it does so at the end of copyStatic() call.
|
||||
if c.Cfg.GetBool("cleanDestinationDir") {
|
||||
if err := copyStaticFunc(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := buildSitesFunc(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
g.Go(copyStaticFunc)
|
||||
g.Go(buildSitesFunc)
|
||||
if err := g.Wait(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, s := range Hugo.Sites {
|
||||
@@ -601,10 +602,10 @@ func (c *commandeer) fullBuild(watches ...bool) error {
|
||||
|
||||
}
|
||||
|
||||
func (c *commandeer) build(watches ...bool) error {
|
||||
func (c *commandeer) build() error {
|
||||
defer c.timeTrack(time.Now(), "Total")
|
||||
|
||||
if err := c.fullBuild(watches...); err != nil {
|
||||
if err := c.fullBuild(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -622,7 +623,31 @@ func (c *commandeer) build(watches ...bool) error {
|
||||
}
|
||||
c.Logger.FEEDBACK.Println("Watching for changes in", c.PathSpec().AbsPathify(c.Cfg.GetString("contentDir")))
|
||||
c.Logger.FEEDBACK.Println("Press Ctrl+C to stop")
|
||||
utils.CheckErr(c.Logger, c.newWatcher(false, watchDirs...))
|
||||
watcher, err := c.newWatcher(watchDirs...)
|
||||
utils.CheckErr(c.Logger, err)
|
||||
defer watcher.Close()
|
||||
|
||||
var sigs = make(chan os.Signal)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
<-sigs
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *commandeer) serverBuild() error {
|
||||
defer c.timeTrack(time.Now(), "Total")
|
||||
|
||||
if err := c.fullBuild(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO(bep) Feedback?
|
||||
if !quiet {
|
||||
fmt.Println()
|
||||
Hugo.PrintProcessingStats(os.Stdout)
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -892,6 +917,7 @@ func (c *commandeer) getDirList() ([]string, error) {
|
||||
}
|
||||
|
||||
func (c *commandeer) recreateAndBuildSites(watching bool) (err error) {
|
||||
defer c.timeTrack(time.Now(), "Total")
|
||||
if err := c.initSites(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -957,29 +983,22 @@ func (c *commandeer) rebuildSites(events []fsnotify.Event) error {
|
||||
}
|
||||
|
||||
// newWatcher creates a new watcher to watch filesystem events.
|
||||
// if serve is set it will also start one or more HTTP servers to serve those
|
||||
// files.
|
||||
func (c *commandeer) newWatcher(serve bool, dirList ...string) error {
|
||||
func (c *commandeer) newWatcher(dirList ...string) (*watcher.Batcher, error) {
|
||||
if runtime.GOOS == "darwin" {
|
||||
tweakLimit()
|
||||
}
|
||||
|
||||
staticSyncer, err := newStaticSyncer(c)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
watcher, err := watcher.New(1 * time.Second)
|
||||
var wg sync.WaitGroup
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer watcher.Close()
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
for _, d := range dirList {
|
||||
if d != "" {
|
||||
_ = watcher.Add(d)
|
||||
@@ -1133,14 +1152,6 @@ func (c *commandeer) newWatcher(serve bool, dirList ...string) error {
|
||||
doLiveReload := !buildWatch && !c.Cfg.GetBool("disableLiveReload")
|
||||
onePageName := pickOneWriteOrCreatePath(dynamicEvents)
|
||||
|
||||
if onePageName != "" && doLiveReload && !c.Cfg.GetBool("disableFastRender") {
|
||||
p := Hugo.GetContentPage(onePageName)
|
||||
if p != nil {
|
||||
c.visitedURLs.Add(p.RelPermalink())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
c.Logger.FEEDBACK.Println("\nChange detected, rebuilding site")
|
||||
const layout = "2006-01-02 15:04:05.000 -0700"
|
||||
c.Logger.FEEDBACK.Println(time.Now().Format(layout))
|
||||
@@ -1177,12 +1188,7 @@ func (c *commandeer) newWatcher(serve bool, dirList ...string) error {
|
||||
}
|
||||
}()
|
||||
|
||||
if serve {
|
||||
go c.serve()
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
return nil
|
||||
return watcher, nil
|
||||
}
|
||||
|
||||
func pickOneWriteOrCreatePath(events []fsnotify.Event) string {
|
||||
@@ -1225,9 +1231,7 @@ func (c *commandeer) isThemeVsHugoVersionMismatch() (mismatch bool, requiredMinV
|
||||
return
|
||||
}
|
||||
|
||||
config := tomlMeta.(map[string]interface{})
|
||||
|
||||
if minVersion, ok := config["min_version"]; ok {
|
||||
if minVersion, ok := tomlMeta["min_version"]; ok {
|
||||
return helpers.CompareVersion(minVersion) > 0, fmt.Sprint(minVersion)
|
||||
}
|
||||
|
||||
|
||||
@@ -144,11 +144,6 @@ func importFromJekyll(cmd *cobra.Command, args []string) error {
|
||||
"$ git clone https://github.com/spf13/herring-cove.git " + args[1] + "/themes/herring-cove")
|
||||
jww.FEEDBACK.Println("$ cd " + args[1] + "\n$ hugo server --theme=herring-cove")
|
||||
|
||||
jww.FEEDBACK.Println("Congratulations!", fileCount, "post(s) imported!")
|
||||
jww.FEEDBACK.Println("Now, start Hugo by yourself:\n" +
|
||||
"$ git clone https://github.com/spf13/herring-cove.git " + args[1] + "/themes/herring-cove")
|
||||
jww.FEEDBACK.Println("$ cd " + args[1] + "\n$ hugo server --theme=herring-cove")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -255,7 +250,7 @@ func loadJekyllConfig(fs afero.Fs, jekyllRoot string) map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.(map[string]interface{})
|
||||
return c
|
||||
}
|
||||
|
||||
func createConfigFromJekyll(fs afero.Fs, inpath string, kind string, jekyllConfig map[string]interface{}) (err error) {
|
||||
@@ -478,8 +473,6 @@ func convertJekyllPost(s *hugolib.Site, path, relPath, targetDir string, draft b
|
||||
}
|
||||
|
||||
func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, draft bool) (interface{}, error) {
|
||||
url := postDate.Format("/2006/01/02/") + postName + "/"
|
||||
|
||||
metadata, err := cast.ToStringMapE(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -497,7 +490,7 @@ func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, d
|
||||
delete(metadata, key)
|
||||
case "permalink":
|
||||
if str, ok := value.(string); ok {
|
||||
url = str
|
||||
metadata["url"] = str
|
||||
}
|
||||
delete(metadata, key)
|
||||
case "category":
|
||||
@@ -526,7 +519,6 @@ func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, d
|
||||
|
||||
}
|
||||
|
||||
metadata["url"] = url
|
||||
metadata["date"] = postDate.Format(time.RFC3339)
|
||||
|
||||
return metadata, nil
|
||||
|
||||
@@ -51,9 +51,9 @@ func TestConvertJekyllMetadata(t *testing.T) {
|
||||
expect string
|
||||
}{
|
||||
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/2015/10/01/testPost/"}`},
|
||||
`{"date":"2015-10-01T00:00:00Z"}`},
|
||||
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), true,
|
||||
`{"date":"2015-10-01T00:00:00Z","draft":true,"url":"/2015/10/01/testPost/"}`},
|
||||
`{"date":"2015-10-01T00:00:00Z","draft":true}`},
|
||||
{map[interface{}]interface{}{"Permalink": "/permalink.html", "layout": "post"},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
|
||||
@@ -62,13 +62,13 @@ func TestConvertJekyllMetadata(t *testing.T) {
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
|
||||
{map[interface{}]interface{}{"category": nil, "permalink": 123},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/2015/10/01/testPost/"}`},
|
||||
`{"date":"2015-10-01T00:00:00Z"}`},
|
||||
{map[interface{}]interface{}{"Excerpt_Separator": "sep"},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep","url":"/2015/10/01/testPost/"}`},
|
||||
`{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep"}`},
|
||||
{map[interface{}]interface{}{"category": "book", "layout": "post", "Others": "Goods", "Date": "2015-10-01 12:13:11"},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z","url":"/2015/10/01/testPost/"}`},
|
||||
`{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z"}`},
|
||||
}
|
||||
|
||||
for _, data := range testDataList {
|
||||
|
||||
+1
-1
@@ -344,7 +344,7 @@ description = ""
|
||||
homepage = "http://example.com/"
|
||||
tags = []
|
||||
features = []
|
||||
min_version = "0.32.2"
|
||||
min_version = "0.37"
|
||||
|
||||
[author]
|
||||
name = ""
|
||||
|
||||
+33
-15
@@ -19,10 +19,12 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/livereload"
|
||||
@@ -171,20 +173,25 @@ func server(cmd *cobra.Command, args []string) error {
|
||||
c.Set("liveReloadPort", serverPorts[0])
|
||||
}
|
||||
|
||||
if c.languages.IsMultihost() {
|
||||
for i, language := range c.languages {
|
||||
baseURL, err := fixURL(language, baseURL, serverPorts[i])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
language.Set("baseURL", baseURL)
|
||||
isMultiHost := c.languages.IsMultihost()
|
||||
for i, language := range c.languages {
|
||||
var serverPort int
|
||||
if isMultiHost {
|
||||
serverPort = serverPorts[i]
|
||||
} else {
|
||||
serverPort = serverPorts[0]
|
||||
}
|
||||
} else {
|
||||
baseURL, err := fixURL(c.Cfg, baseURL, serverPorts[0])
|
||||
|
||||
baseURL, err := fixURL(language, baseURL, serverPort)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.Set("baseURL", baseURL)
|
||||
if isMultiHost {
|
||||
language.Set("baseURL", baseURL)
|
||||
}
|
||||
if i == 0 {
|
||||
c.Set("baseURL", baseURL)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -200,7 +207,7 @@ func server(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := c.build(serverWatch); err != nil {
|
||||
if err := c.serverBuild(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -229,14 +236,18 @@ func server(cmd *cobra.Command, args []string) error {
|
||||
rootWatchDirs := strings.Join(helpers.UniqueStrings(helpers.ExtractRootPaths(relWatchDirs)), ",")
|
||||
|
||||
jww.FEEDBACK.Printf("Watching for changes in %s%s{%s}\n", baseWatchDir, helpers.FilePathSeparator, rootWatchDirs)
|
||||
err = c.newWatcher(true, watchDirs...)
|
||||
watcher, err := c.newWatcher(watchDirs...)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer watcher.Close()
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.serve()
|
||||
|
||||
}
|
||||
|
||||
type fileServer struct {
|
||||
@@ -313,7 +324,7 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
|
||||
return mu, u.String(), endpoint, nil
|
||||
}
|
||||
|
||||
func (c *commandeer) serve() {
|
||||
func (c *commandeer) serve() error {
|
||||
|
||||
isMultiHost := Hugo.IsMultihost()
|
||||
|
||||
@@ -345,7 +356,10 @@ func (c *commandeer) serve() {
|
||||
livereload.Initialize()
|
||||
}
|
||||
|
||||
for i, _ := range baseURLs {
|
||||
var sigs = make(chan os.Signal)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
for i := range baseURLs {
|
||||
mu, serverURL, endpoint, err := srv.createEndpoint(i)
|
||||
|
||||
if doLiveReload {
|
||||
@@ -363,6 +377,10 @@ func (c *commandeer) serve() {
|
||||
}
|
||||
|
||||
jww.FEEDBACK.Println("Press Ctrl+C to stop")
|
||||
|
||||
<-sigs
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// fixURL massages the baseURL into a form needed for serving
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/parser"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var undraftCmd = &cobra.Command{
|
||||
Use: "undraft path/to/content",
|
||||
Short: "Undraft resets the content's draft status",
|
||||
Long: `Undraft resets the content's draft status
|
||||
and updates the date to the current date and time.
|
||||
If the content's draft status is 'False', nothing is done.`,
|
||||
RunE: Undraft,
|
||||
}
|
||||
|
||||
// Undraft publishes the specified content by setting its draft status
|
||||
// to false and setting its publish date to now. If the specified content is
|
||||
// not a draft, it will log an error.
|
||||
func Undraft(cmd *cobra.Command, args []string) error {
|
||||
c, err := InitializeConfig(false, nil)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(args) < 1 {
|
||||
return newUserError("a piece of content needs to be specified")
|
||||
}
|
||||
|
||||
cfg := c.DepsCfg
|
||||
|
||||
location := args[0]
|
||||
// open the file
|
||||
f, err := cfg.Fs.Source.Open(location)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// get the page from file
|
||||
p, err := parser.ReadFrom(f)
|
||||
f.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
w, err := undraftContent(p)
|
||||
if err != nil {
|
||||
return newSystemErrorF("an error occurred while undrafting %q: %s", location, err)
|
||||
}
|
||||
|
||||
f, err = cfg.Fs.Source.OpenFile(location, os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
return newSystemErrorF("%q not be undrafted due to error opening file to save changes: %q\n", location, err)
|
||||
}
|
||||
defer f.Close()
|
||||
_, err = w.WriteTo(f)
|
||||
if err != nil {
|
||||
return newSystemErrorF("%q not be undrafted due to save error: %q\n", location, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// undraftContent: if the content is a draft, change its draft status to
|
||||
// 'false' and set the date to time.Now(). If the draft status is already
|
||||
// 'false', don't do anything.
|
||||
func undraftContent(p parser.Page) (bytes.Buffer, error) {
|
||||
var buff bytes.Buffer
|
||||
// get the metadata; easiest way to see if it's a draft
|
||||
meta, err := p.Metadata()
|
||||
if err != nil {
|
||||
return buff, err
|
||||
}
|
||||
// since the metadata was obtainable, we can also get the key/value separator for
|
||||
// Front Matter
|
||||
fm := p.FrontMatter()
|
||||
if fm == nil {
|
||||
return buff, errors.New("Front Matter was found, nothing was finalized")
|
||||
}
|
||||
|
||||
var isDraft, gotDate bool
|
||||
var date string
|
||||
L:
|
||||
for k, v := range meta.(map[string]interface{}) {
|
||||
switch k {
|
||||
case "draft":
|
||||
if !v.(bool) {
|
||||
return buff, errors.New("not a Draft: nothing was done")
|
||||
}
|
||||
isDraft = true
|
||||
if gotDate {
|
||||
break L
|
||||
}
|
||||
case "date":
|
||||
date = v.(string) // capture the value to make replacement easier
|
||||
gotDate = true
|
||||
if isDraft {
|
||||
break L
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if draft wasn't found in FrontMatter, it isn't a draft.
|
||||
if !isDraft {
|
||||
return buff, errors.New("not a Draft: nothing was done")
|
||||
}
|
||||
|
||||
// get the front matter as bytes and split it into lines
|
||||
var lineEnding []byte
|
||||
fmLines := bytes.Split(fm, []byte("\n"))
|
||||
if len(fmLines) == 1 { // if the result is only 1 element, try to split on dos line endings
|
||||
fmLines = bytes.Split(fm, []byte("\r\n"))
|
||||
if len(fmLines) == 1 {
|
||||
return buff, errors.New("unable to split FrontMatter into lines")
|
||||
}
|
||||
lineEnding = append(lineEnding, []byte("\r\n")...)
|
||||
} else {
|
||||
lineEnding = append(lineEnding, []byte("\n")...)
|
||||
}
|
||||
|
||||
// Write the front matter lines to the buffer, replacing as necessary
|
||||
for _, v := range fmLines {
|
||||
pos := bytes.Index(v, []byte("draft"))
|
||||
if pos != -1 {
|
||||
continue
|
||||
}
|
||||
pos = bytes.Index(v, []byte("date"))
|
||||
if pos != -1 { // if date field wasn't found, add it
|
||||
v = bytes.Replace(v, []byte(date), []byte(time.Now().Format(time.RFC3339)), 1)
|
||||
}
|
||||
buff.Write(v)
|
||||
buff.Write(lineEnding)
|
||||
}
|
||||
|
||||
// append the actual content
|
||||
buff.Write(p.Content())
|
||||
|
||||
return buff, nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
// TODO Support Mac Encoding (\r)
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/parser"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonFM = "{\n \"date\": \"12-04-06\",\n \"title\": \"test json\"\n}"
|
||||
jsonDraftFM = "{\n \"draft\": true,\n \"date\": \"12-04-06\",\n \"title\":\"test json\"\n}"
|
||||
tomlFM = "+++\n date= \"12-04-06\"\n title= \"test toml\"\n+++"
|
||||
tomlDraftFM = "+++\n draft= true\n date= \"12-04-06\"\n title=\"test toml\"\n+++"
|
||||
yamlFM = "---\n date: \"12-04-06\"\n title: \"test yaml\"\n---"
|
||||
yamlDraftFM = "---\n draft: true\n date: \"12-04-06\"\n title: \"test yaml\"\n---"
|
||||
yamlYesDraftFM = "---\n draft: yes\n date: \"12-04-06\"\n title: \"test yaml\"\n---"
|
||||
)
|
||||
|
||||
func TestUndraftContent(t *testing.T) {
|
||||
tests := []struct {
|
||||
fm string
|
||||
expectedErr string
|
||||
}{
|
||||
{jsonFM, "not a Draft: nothing was done"},
|
||||
{jsonDraftFM, ""},
|
||||
{tomlFM, "not a Draft: nothing was done"},
|
||||
{tomlDraftFM, ""},
|
||||
{yamlFM, "not a Draft: nothing was done"},
|
||||
{yamlDraftFM, ""},
|
||||
{yamlYesDraftFM, ""},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
r := bytes.NewReader([]byte(test.fm))
|
||||
p, _ := parser.ReadFrom(r)
|
||||
res, err := undraftContent(p)
|
||||
if test.expectedErr != "" {
|
||||
if err == nil {
|
||||
t.Errorf("[%d] Expected error, got none", i)
|
||||
continue
|
||||
}
|
||||
if err.Error() != test.expectedErr {
|
||||
t.Errorf("[%d] Expected %q, got %q", i, test.expectedErr, err)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
r = bytes.NewReader(res.Bytes())
|
||||
p, _ = parser.ReadFrom(r)
|
||||
meta, err := p.Metadata()
|
||||
if err != nil {
|
||||
t.Errorf("[%d] unexpected error %q", i, err)
|
||||
continue
|
||||
}
|
||||
for k, v := range meta.(map[string]interface{}) {
|
||||
if k == "draft" {
|
||||
if v.(bool) {
|
||||
t.Errorf("[%d] Expected %q to be \"false\", got \"true\"", i, k)
|
||||
continue
|
||||
}
|
||||
}
|
||||
if k == "date" {
|
||||
if !strings.HasPrefix(v.(string), time.Now().Format("2006-01-02")) {
|
||||
t.Errorf("[%d] Expected %v to start with %v", i, v.(string), time.Now().Format("2006-01-02"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,11 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/hugolib"
|
||||
"github.com/kardianos/osext"
|
||||
"github.com/spf13/cobra"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
@@ -38,43 +34,9 @@ var versionCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func printHugoVersion() {
|
||||
if hugolib.BuildDate == "" {
|
||||
setBuildDate() // set the build date from executable's mdate
|
||||
} else {
|
||||
formatBuildDate() // format the compile time
|
||||
}
|
||||
if hugolib.CommitHash == "" {
|
||||
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s %s/%s BuildDate: %s\n", helpers.CurrentHugoVersion, runtime.GOOS, runtime.GOARCH, hugolib.BuildDate)
|
||||
} else {
|
||||
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s-%s %s/%s BuildDate: %s\n", helpers.CurrentHugoVersion, strings.ToUpper(hugolib.CommitHash), runtime.GOOS, runtime.GOARCH, hugolib.BuildDate)
|
||||
}
|
||||
}
|
||||
|
||||
// setBuildDate checks the ModTime of the Hugo executable and returns it as a
|
||||
// formatted string. This assumes that the executable name is Hugo, if it does
|
||||
// not exist, an empty string will be returned. This is only called if the
|
||||
// hugolib.BuildDate wasn't set during compile time.
|
||||
//
|
||||
// osext is used for cross-platform.
|
||||
func setBuildDate() {
|
||||
fname, _ := osext.Executable()
|
||||
dir, err := filepath.Abs(filepath.Dir(fname))
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
return
|
||||
}
|
||||
fi, err := os.Lstat(filepath.Join(dir, filepath.Base(fname)))
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
return
|
||||
}
|
||||
t := fi.ModTime()
|
||||
hugolib.BuildDate = t.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// formatBuildDate formats the hugolib.BuildDate according to the value in
|
||||
// .Params.DateFormat, if it's set.
|
||||
func formatBuildDate() {
|
||||
t, _ := time.Parse("2006-01-02T15:04:05-0700", hugolib.BuildDate)
|
||||
hugolib.BuildDate = t.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
@@ -19,3 +19,11 @@ package compare
|
||||
type Eqer interface {
|
||||
Eq(other interface{}) bool
|
||||
}
|
||||
|
||||
// Comparer can be used to compare two values.
|
||||
// This will be used when using the le, ge etc. operators in the templates.
|
||||
// Compare returns -1 if the given version is less than, 0 if equal and 1 if greater than
|
||||
// the running version.
|
||||
type Comparer interface {
|
||||
Compare(other interface{}) int
|
||||
}
|
||||
@@ -20,6 +20,7 @@ type Provider interface {
|
||||
GetBool(key string) bool
|
||||
GetStringMap(key string) map[string]interface{}
|
||||
GetStringMapString(key string) map[string]string
|
||||
GetStringSlice(key string) []string
|
||||
Get(key string) interface{}
|
||||
Set(key string, value interface{})
|
||||
IsSet(key string) bool
|
||||
|
||||
@@ -16,6 +16,7 @@ package create
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -43,6 +44,12 @@ type ArchetypeFileData struct {
|
||||
// on the presence of language code in the filename.
|
||||
Site *hugolib.Site
|
||||
|
||||
// Name will in most cases be the same as TranslationBaseName, e.g. "my-post".
|
||||
// But if that value is "index" (bundles), the Name is instead the owning folder.
|
||||
// This is the value you in most cases would want to use to construct the title in your
|
||||
// archetype template.
|
||||
Name string
|
||||
|
||||
// The target content file. Note that the .Content will be empty, as that
|
||||
// has not been created yet.
|
||||
source.File
|
||||
@@ -51,7 +58,7 @@ type ArchetypeFileData struct {
|
||||
const (
|
||||
// ArchetypeTemplateTemplate is used as initial template when adding an archetype template.
|
||||
ArchetypeTemplateTemplate = `---
|
||||
title: "{{ replace .TranslationBaseName "-" " " | title }}"
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
---
|
||||
@@ -82,11 +89,19 @@ func executeArcheTypeAsTemplate(s *hugolib.Site, kind, targetPath, archetypeFile
|
||||
)
|
||||
|
||||
sp := source.NewSourceSpec(s.Deps.Cfg, s.Deps.Fs)
|
||||
f := sp.NewFileInfo("", targetPath, nil)
|
||||
f := sp.NewFileInfo("", targetPath, false, nil)
|
||||
|
||||
name := f.TranslationBaseName()
|
||||
if name == "index" || name == "_index" {
|
||||
// Page bundles; the directory name will hopefully have a better name.
|
||||
dir := strings.TrimSuffix(f.Dir(), helpers.FilePathSeparator)
|
||||
_, name = filepath.Split(dir)
|
||||
}
|
||||
|
||||
data := ArchetypeFileData{
|
||||
Type: kind,
|
||||
Date: time.Now().Format(time.RFC3339),
|
||||
Name: name,
|
||||
File: f,
|
||||
Site: s,
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/.idea
|
||||
/public
|
||||
nohup.out
|
||||
.DS_Store
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
---
|
||||
title: "{{ replace .TranslationBaseName "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
linktitle: ""
|
||||
description: ""
|
||||
godocref: ""
|
||||
publishdate: ""
|
||||
lastmod: ""
|
||||
categories: []
|
||||
keywords: []
|
||||
tags: []
|
||||
weight: 00
|
||||
slug: ""
|
||||
aliases: []
|
||||
toc: false
|
||||
draft: true
|
||||
---
|
||||
---
|
||||
+21
-2
@@ -71,7 +71,7 @@ twitter = "GoHugoIO"
|
||||
[params]
|
||||
description = "The world’s fastest framework for building websites"
|
||||
## Used for views in rendered HTML (i.e., rather than using the .Hugo variable)
|
||||
release = "0.32.2"
|
||||
release = "0.37"
|
||||
## Setting this to true will add a "noindex" to *EVERY* page on the site
|
||||
removefromexternalsearch = false
|
||||
## Gh repo for site footer (include trailing slash)
|
||||
@@ -98,10 +98,23 @@ twitter = "GoHugoIO"
|
||||
## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
|
||||
[blackfriday]
|
||||
plainIDAnchors = true
|
||||
hrefTargetBlank = true
|
||||
# See https://github.com/gohugoio/hugo/issues/2424
|
||||
hrefTargetBlank = false
|
||||
angledQuotes = false
|
||||
latexDashes = true
|
||||
|
||||
[imaging]
|
||||
# See https://github.com/disintegration/imaging
|
||||
# CatmullRom is a sharp bicubic filter which should fit the docs site well with its many screenshots.
|
||||
# Note that you can also set this per image processing.
|
||||
resampleFilter = "CatmullRom"
|
||||
|
||||
# Defatult JPEG quality setting. Default is 75.
|
||||
quality = 75
|
||||
|
||||
anchor = "smart"
|
||||
|
||||
|
||||
## As of v0.20, all content files include a default "categories" value that's the same as the section. This was a cheap future-proofing method and should/could be changed accordingly.
|
||||
[taxonomies]
|
||||
category = "categories"
|
||||
@@ -237,6 +250,12 @@ twitter = "GoHugoIO"
|
||||
identifier = "themes"
|
||||
url = "https://themes.gohugo.io/"
|
||||
|
||||
[[menu.global]]
|
||||
name = "Showcase"
|
||||
weight = 20
|
||||
identifier = "showcase"
|
||||
url = "/showcase/"
|
||||
|
||||
# Anything with a weight > 100 gets an external icon
|
||||
[[menu.global]]
|
||||
name = "Community"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "A Fast and Flexible Website Generator"
|
||||
title: "The world’s fastest framework for building websites"
|
||||
date: 2017-03-02T12:00:00-05:00
|
||||
features:
|
||||
- heading: Blistering Speed
|
||||
|
||||
@@ -55,7 +55,6 @@ toc: true
|
||||
* Support for [Go][], [Amber], and [Ace][] HTML templates
|
||||
* [Syntax highlighting][] powered by [Pygments][]
|
||||
|
||||
See what's coming next in the [Hugo roadmap][].
|
||||
|
||||
[Ace]: /templates/alternatives/
|
||||
[aliases]: /content-management/urls/#aliases
|
||||
@@ -71,7 +70,6 @@ See what's coming next in the [Hugo roadmap][].
|
||||
[Google Analytics]: https://google-analytics.com/
|
||||
[homepage]: /templates/homepage/
|
||||
[hostanywhere]: /hosting-and-deployment/
|
||||
[Hugo roadmap]: /about/roadmap
|
||||
[install]: /getting-started/installing/
|
||||
[LiveReload]: /getting-started/usage/
|
||||
[organization for your projects]: /getting-started/directory-structure/
|
||||
|
||||
@@ -126,15 +126,15 @@ Image operations in Hugo currently **do not preserve EXIF data** as this is not
|
||||
_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_
|
||||
|
||||
|
||||
{{< imgproc sunset Resize "300x" >}}
|
||||
{{< imgproc sunset Resize "300x" />}}
|
||||
|
||||
{{< imgproc sunset Fill "90x120 left" >}}
|
||||
{{< imgproc sunset Fill "90x120 left" />}}
|
||||
|
||||
{{< imgproc sunset Fill "90x120 right" >}}
|
||||
{{< imgproc sunset Fill "90x120 right" />}}
|
||||
|
||||
{{< imgproc sunset Fit "90x90" >}}
|
||||
{{< imgproc sunset Fit "90x90" />}}
|
||||
|
||||
{{< imgproc sunset Resize "300x q10" >}}
|
||||
{{< imgproc sunset Resize "300x q10" />}}
|
||||
|
||||
|
||||
This is the shortcode used in the examples above:
|
||||
|
||||
@@ -7,7 +7,7 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
layout: single
|
||||
menu:
|
||||
main:
|
||||
docs:
|
||||
parent: "about"
|
||||
weight: 10
|
||||
weight: 10
|
||||
@@ -19,7 +19,7 @@ toc: true
|
||||
|
||||
Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator][]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for website authors.
|
||||
|
||||
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
|
||||
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [GitLab Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
|
||||
|
||||
We think of Hugo as the ideal website creation tool with nearly instant build times, able to rebuild whenever a change is made.
|
||||
|
||||
@@ -50,7 +50,7 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat
|
||||
[DreamHost]: http://www.dreamhost.com/
|
||||
[Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting"
|
||||
[GitHub Pages]: https://pages.github.com/
|
||||
[GitLab]: https://about.gitlab.com
|
||||
[GitLab Pages]: https://about.gitlab.com/features/pages/
|
||||
[Go language]: https://golang.org/
|
||||
[GoDaddy]: https://www.godaddy.com/ "Godaddy.com Hosting"
|
||||
[Google Cloud Storage]: http://cloud.google.com/storage/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo"
|
||||
slug: hugo
|
||||
url: /commands/hugo/
|
||||
@@ -10,7 +10,6 @@ hugo builds your site
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
hugo is the main command, used to build your Hugo site.
|
||||
|
||||
Hugo is a Fast and Flexible Static Site Generator
|
||||
@@ -30,16 +29,13 @@ hugo [flags]
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
--debug debug output
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 do not render 404 page
|
||||
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
|
||||
--disableRSS do not build RSS files
|
||||
--disableSitemap do not build Sitemap file
|
||||
--enableGitInfo add Git revision, date and author info to the pages
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
@@ -51,8 +47,8 @@ hugo [flags]
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--noChmod don't sync permission mode of files
|
||||
--noTimes don't sync modification time of files
|
||||
--pluralizeListTitles pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--quiet build in quiet mode
|
||||
--renderToMemory render to memory (only useful for benchmark testing)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
@@ -61,13 +57,14 @@ hugo [flags]
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--themesDir string filesystem path to themes directory
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
-w, --watch watch filesystem for changes and recreate as needed
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo benchmark](/commands/hugo_benchmark/) - Benchmark Hugo by building a site a number of times.
|
||||
* [hugo check](/commands/hugo_check/) - Contains some verification checks
|
||||
* [hugo config](/commands/hugo_config/) - Print the site configuration
|
||||
@@ -78,7 +75,6 @@ hugo [flags]
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
* [hugo server](/commands/hugo_server/) - A high performance webserver
|
||||
* [hugo undraft](/commands/hugo_undraft/) - Undraft resets the content's draft status
|
||||
* [hugo version](/commands/hugo_version/) - Print the version number of Hugo
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo benchmark"
|
||||
slug: hugo_benchmark
|
||||
url: /commands/hugo_benchmark/
|
||||
@@ -10,7 +10,6 @@ Benchmark Hugo by building a site a number of times.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Hugo can build a site many times over and analyze the running process
|
||||
creating a benchmark.
|
||||
|
||||
@@ -26,16 +25,13 @@ hugo benchmark [flags]
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-n, --count int number of times to build the site (default 13)
|
||||
--cpuprofile string path/filename for the CPU profile file
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 do not render 404 page
|
||||
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
|
||||
--disableRSS do not build RSS files
|
||||
--disableSitemap do not build Sitemap file
|
||||
--enableGitInfo add Git revision, date and author info to the pages
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
@@ -46,8 +42,8 @@ hugo benchmark [flags]
|
||||
--memprofile string path/filename for the memory profile file
|
||||
--noChmod don't sync permission mode of files
|
||||
--noTimes don't sync modification time of files
|
||||
--pluralizeListTitles pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--renderToMemory render to memory (only useful for benchmark testing)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--stepAnalysis display memory and timing of different steps of the program
|
||||
@@ -55,7 +51,7 @@ hugo benchmark [flags]
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--themesDir string filesystem path to themes directory
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
@@ -71,6 +67,7 @@ hugo benchmark [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo check"
|
||||
slug: hugo_check
|
||||
url: /commands/hugo_check/
|
||||
@@ -10,7 +10,6 @@ Contains some verification checks
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Contains some verification checks
|
||||
|
||||
### Options
|
||||
@@ -32,7 +31,8 @@ Contains some verification checks
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo check ulimit](/commands/hugo_check_ulimit/) - Check system ulimit settings
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo check ulimit"
|
||||
slug: hugo_check_ulimit
|
||||
url: /commands/hugo_check_ulimit/
|
||||
@@ -10,7 +10,6 @@ Check system ulimit settings
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Hugo will inspect the current ulimit settings on the system.
|
||||
This is primarily to ensure that Hugo can watch enough files on some OSs
|
||||
|
||||
@@ -37,6 +36,7 @@ hugo check ulimit [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo check](/commands/hugo_check/) - Contains some verification checks
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo config"
|
||||
slug: hugo_config
|
||||
url: /commands/hugo_config/
|
||||
@@ -10,7 +10,6 @@ Print the site configuration
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Print the site configuration, both default and custom settings.
|
||||
|
||||
```
|
||||
@@ -36,6 +35,7 @@ hugo config [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo convert"
|
||||
slug: hugo_convert
|
||||
url: /commands/hugo_convert/
|
||||
@@ -10,7 +10,6 @@ Convert your content to different formats
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Convert your content (e.g. front matter) to different formats.
|
||||
|
||||
See convert's subcommands toJSON, toTOML and toYAML for more information.
|
||||
@@ -37,9 +36,10 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo convert toJSON](/commands/hugo_convert_tojson/) - Convert front matter to JSON
|
||||
* [hugo convert toTOML](/commands/hugo_convert_totoml/) - Convert front matter to TOML
|
||||
* [hugo convert toYAML](/commands/hugo_convert_toyaml/) - Convert front matter to YAML
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo convert toJSON"
|
||||
slug: hugo_convert_toJSON
|
||||
url: /commands/hugo_convert_tojson/
|
||||
@@ -10,7 +10,6 @@ Convert front matter to JSON
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
toJSON converts all front matter in the content directory
|
||||
to use JSON for the front matter.
|
||||
|
||||
@@ -40,6 +39,7 @@ hugo convert toJSON [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo convert toTOML"
|
||||
slug: hugo_convert_toTOML
|
||||
url: /commands/hugo_convert_totoml/
|
||||
@@ -10,7 +10,6 @@ Convert front matter to TOML
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
toTOML converts all front matter in the content directory
|
||||
to use TOML for the front matter.
|
||||
|
||||
@@ -40,6 +39,7 @@ hugo convert toTOML [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo convert toYAML"
|
||||
slug: hugo_convert_toYAML
|
||||
url: /commands/hugo_convert_toyaml/
|
||||
@@ -10,7 +10,6 @@ Convert front matter to YAML
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
toYAML converts all front matter in the content directory
|
||||
to use YAML for the front matter.
|
||||
|
||||
@@ -40,6 +39,7 @@ hugo convert toYAML [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo env"
|
||||
slug: hugo_env
|
||||
url: /commands/hugo_env/
|
||||
@@ -10,7 +10,6 @@ Print Hugo version and environment info
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Print Hugo version and environment info. This is useful in Hugo bug reports.
|
||||
|
||||
```
|
||||
@@ -36,6 +35,7 @@ hugo env [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo gen"
|
||||
slug: hugo_gen
|
||||
url: /commands/hugo_gen/
|
||||
@@ -10,7 +10,6 @@ A collection of several useful generators.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
A collection of several useful generators.
|
||||
|
||||
### Options
|
||||
@@ -32,10 +31,11 @@ A collection of several useful generators.
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo gen autocomplete](/commands/hugo_gen_autocomplete/) - Generate shell autocompletion script for Hugo
|
||||
* [hugo gen chromastyles](/commands/hugo_gen_chromastyles/) - Generate CSS stylesheet for the Chroma code highlighter
|
||||
* [hugo gen doc](/commands/hugo_gen_doc/) - Generate Markdown documentation for the Hugo CLI.
|
||||
* [hugo gen man](/commands/hugo_gen_man/) - Generate man pages for the Hugo CLI
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo gen autocomplete"
|
||||
slug: hugo_gen_autocomplete
|
||||
url: /commands/hugo_gen_autocomplete/
|
||||
@@ -10,7 +10,6 @@ Generate shell autocompletion script for Hugo
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Generates a shell autocompletion script for Hugo.
|
||||
|
||||
NOTE: The current version supports Bash only.
|
||||
@@ -54,6 +53,7 @@ hugo gen autocomplete [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo gen chromastyles"
|
||||
slug: hugo_gen_chromastyles
|
||||
url: /commands/hugo_gen_chromastyles/
|
||||
@@ -10,7 +10,6 @@ Generate CSS stylesheet for the Chroma code highlighter
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if pygmentsUseClasses is enabled in config.
|
||||
|
||||
See https://help.farbox.com/pygments.html for preview of available styles
|
||||
@@ -41,6 +40,7 @@ hugo gen chromastyles [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo gen doc"
|
||||
slug: hugo_gen_doc
|
||||
url: /commands/hugo_gen_doc/
|
||||
@@ -10,7 +10,6 @@ Generate Markdown documentation for the Hugo CLI.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Generate Markdown documentation for the Hugo CLI.
|
||||
|
||||
This command is, mostly, used to create up-to-date documentation
|
||||
@@ -43,6 +42,7 @@ hugo gen doc [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo gen man"
|
||||
slug: hugo_gen_man
|
||||
url: /commands/hugo_gen_man/
|
||||
@@ -10,7 +10,6 @@ Generate man pages for the Hugo CLI
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
This command automatically generates up-to-date man pages of Hugo's
|
||||
command-line interface. By default, it creates the man page files
|
||||
in the "man" directory under the current directory.
|
||||
@@ -39,6 +38,7 @@ hugo gen man [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo import"
|
||||
slug: hugo_import
|
||||
url: /commands/hugo_import/
|
||||
@@ -10,7 +10,6 @@ Import your site from others.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Import your site from other web site generators like Jekyll.
|
||||
|
||||
Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_path`.
|
||||
@@ -34,7 +33,8 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo import jekyll"
|
||||
slug: hugo_import_jekyll
|
||||
url: /commands/hugo_import_jekyll/
|
||||
@@ -10,7 +10,6 @@ hugo import from Jekyll
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
hugo import from Jekyll.
|
||||
|
||||
Import from Jekyll requires two paths, e.g. `hugo import jekyll jekyll_root_path target_path`.
|
||||
@@ -39,6 +38,7 @@ hugo import jekyll [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo import](/commands/hugo_import/) - Import your site from others.
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo list"
|
||||
slug: hugo_list
|
||||
url: /commands/hugo_list/
|
||||
@@ -10,7 +10,6 @@ Listing out various types of content
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Listing out various types of content.
|
||||
|
||||
List requires a subcommand, e.g. `hugo list drafts`.
|
||||
@@ -35,9 +34,10 @@ List requires a subcommand, e.g. `hugo list drafts`.
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo list drafts](/commands/hugo_list_drafts/) - List all drafts
|
||||
* [hugo list expired](/commands/hugo_list_expired/) - List all posts already expired
|
||||
* [hugo list future](/commands/hugo_list_future/) - List all posts dated in the future
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo list drafts"
|
||||
slug: hugo_list_drafts
|
||||
url: /commands/hugo_list_drafts/
|
||||
@@ -10,7 +10,6 @@ List all drafts
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
List all of the drafts in your content directory.
|
||||
|
||||
```
|
||||
@@ -37,6 +36,7 @@ hugo list drafts [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo list expired"
|
||||
slug: hugo_list_expired
|
||||
url: /commands/hugo_list_expired/
|
||||
@@ -10,7 +10,6 @@ List all posts already expired
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
List all of the posts in your content directory which has already
|
||||
expired.
|
||||
|
||||
@@ -38,6 +37,7 @@ hugo list expired [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo list future"
|
||||
slug: hugo_list_future
|
||||
url: /commands/hugo_list_future/
|
||||
@@ -10,7 +10,6 @@ List all posts dated in the future
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
List all of the posts in your content directory which will be
|
||||
posted in the future.
|
||||
|
||||
@@ -38,6 +37,7 @@ hugo list future [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo new"
|
||||
slug: hugo_new
|
||||
url: /commands/hugo_new/
|
||||
@@ -10,7 +10,6 @@ Create new content for your site
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Create a new content file and automatically set the date and title.
|
||||
It will guess which kind of file to create based on the path provided.
|
||||
|
||||
@@ -44,8 +43,9 @@ hugo new [path] [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton)
|
||||
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo new site"
|
||||
slug: hugo_new_site
|
||||
url: /commands/hugo_new_site/
|
||||
@@ -10,7 +10,6 @@ Create a new site (skeleton)
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Create a new site in the provided directory.
|
||||
The new site will have the correct structure, but no content or theme yet.
|
||||
Use `hugo new [contentPath]` to create new content.
|
||||
@@ -41,6 +40,7 @@ hugo new site [path] [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo new theme"
|
||||
slug: hugo_new_theme
|
||||
url: /commands/hugo_new_theme/
|
||||
@@ -10,7 +10,6 @@ Create a new theme
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Create a new theme (skeleton) called [name] in the current directory.
|
||||
New theme is a skeleton. Please add content to the touched files. Add your
|
||||
name to the copyright line in the license and adjust the theme.toml file
|
||||
@@ -40,6 +39,7 @@ hugo new theme [name] [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo server"
|
||||
slug: hugo_server
|
||||
url: /commands/hugo_server/
|
||||
@@ -10,7 +10,6 @@ A high performance webserver
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Hugo provides its own webserver which builds and serves the site.
|
||||
While hugo server is high performance, it is a webserver with limited options.
|
||||
Many run it in production, but the standard behavior is for people to use it
|
||||
@@ -38,16 +37,13 @@ hugo server [flags]
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 do not render 404 page
|
||||
--disableFastRender enables full re-renders on changes
|
||||
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
|
||||
--disableLiveReload watch without enabling live browser reload on rebuild
|
||||
--disableRSS do not build RSS files
|
||||
--disableSitemap do not build Sitemap file
|
||||
--enableGitInfo add Git revision, date and author info to the pages
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
@@ -62,9 +58,9 @@ hugo server [flags]
|
||||
--noChmod don't sync permission mode of files
|
||||
--noHTTPCache prevent HTTP caching
|
||||
--noTimes don't sync modification time of files
|
||||
--pluralizeListTitles pluralize titles in lists using inflect (default true)
|
||||
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
|
||||
-p, --port int port on which the server will listen (default 1313)
|
||||
--preserveTaxonomyNames preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--renderToDisk render to Destination path (default is render to memory & serve from there)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--stepAnalysis display memory and timing of different steps of the program
|
||||
@@ -72,7 +68,7 @@ hugo server [flags]
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--themesDir string filesystem path to themes directory
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
|
||||
-w, --watch watch filesystem for changes and recreate as needed (default true)
|
||||
```
|
||||
|
||||
@@ -89,6 +85,7 @@ hugo server [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
title: "hugo undraft"
|
||||
slug: hugo_undraft
|
||||
url: /commands/hugo_undraft/
|
||||
---
|
||||
## hugo undraft
|
||||
|
||||
Undraft resets the content's draft status
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Undraft resets the content's draft status
|
||||
and updates the date to the current date and time.
|
||||
If the content's draft status is 'False', nothing is done.
|
||||
|
||||
```
|
||||
hugo undraft path/to/content [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for undraft
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-12-28T18:49:29+01:00
|
||||
date: 2018-01-31T11:40:21+01:00
|
||||
title: "hugo version"
|
||||
slug: hugo_version
|
||||
url: /commands/hugo_version/
|
||||
@@ -10,7 +10,6 @@ Print the version number of Hugo
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
All software has versions. This is Hugo's.
|
||||
|
||||
```
|
||||
@@ -36,6 +35,7 @@ hugo version [flags]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Dec-2017
|
||||
###### Auto generated by spf13/cobra on 31-Jan-2018
|
||||
|
||||
@@ -17,4 +17,4 @@ aliases: [/content/,/content/organization]
|
||||
toc: false
|
||||
---
|
||||
|
||||
A static site generator needs to extend beyond front matter and a couple templates to be both scalable and *manageable*. Hugo was designed with not only developers in mind, but also content managers and authors.
|
||||
A static site generator needs to extend beyond front matter and a couple of templates to be both scalable and *manageable*. Hugo was designed with not only developers in mind, but also content managers and authors.
|
||||
|
||||
@@ -173,7 +173,7 @@ title = "post from custom archetype"
|
||||
As an example of archetypes in practice, the following is the `functions` archetype from the Hugo docs:
|
||||
|
||||
{{< code file="archetypes/functions.md" >}}
|
||||
{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md" >}}
|
||||
{{< readfile file="/archetypes/functions.md" >}}
|
||||
{{< /code >}}
|
||||
|
||||
{{% note %}}
|
||||
|
||||
@@ -61,13 +61,6 @@ To be sure to get the correct reference in this case, use the full path:
|
||||
{{</* relref "events/my-birthday.md" */>}} => /events/my-birthday/
|
||||
{{< /code >}}
|
||||
|
||||
{{< todo >}}Remove this warning when https://github.com/gohugoio/hugo/issues/3703 is released.{{< /todo >}}
|
||||
|
||||
A relative document name must *not* begin with a slash (`/`).
|
||||
```
|
||||
{{</* relref "/events/my-birthday.md" */>}} => ""
|
||||
```
|
||||
|
||||
### With Multiple Output Formats
|
||||
|
||||
If the page exists in multiple [output formats][], `ref` or `relref` can be used with a output format name:
|
||||
|
||||
@@ -103,6 +103,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables]
|
||||
`expiryDate`
|
||||
: the datetime at which the content should no longer be published by Hugo; expired content will not be rendered unless the `--buildExpired` flag is passed to the `hugo` command.
|
||||
|
||||
`headless`
|
||||
: if `true`, sets a leaf bundle to be [headless][headless-bundle].
|
||||
|
||||
`isCJKLanguage`
|
||||
: if `true`, Hugo will explicitly treat the content as a CJK language; both `.Summary` and `.WordCount` work properly in CJK languages.
|
||||
|
||||
@@ -127,6 +130,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables]
|
||||
`publishDate`
|
||||
: if in the future, content will not be rendered unless the `--buildFuture` flag is passed to `hugo`.
|
||||
|
||||
`resources`
|
||||
: used for configuring page bundle resources. See [Page Resources][page-resources].
|
||||
|
||||
`slug`
|
||||
: appears as the tail of the output URL. A value specified in front matter will override the segment of the URL based on the filename.
|
||||
|
||||
@@ -161,8 +167,6 @@ include_toc: true
|
||||
show_comments: false
|
||||
```
|
||||
|
||||
These two user-defined fields can then be accessed via `.Params.include_toc` and `.Params.show_comments`, respectively. The [Variables][variables] section provides more information on using Hugo's page- and site-level variables in your templates.
|
||||
|
||||
|
||||
## Order Content Through Front Matter
|
||||
|
||||
@@ -186,11 +190,13 @@ It's possible to set some options for Markdown rendering in a content's front ma
|
||||
[content type]: /content-management/types/
|
||||
[contentorg]: /content-management/organization/
|
||||
[definetype]: /content-management/types/#defining-a-content-type "Learn how to specify a type and a layout in a content's front matter"
|
||||
[headless-bundle]: /content-management/page-bundles/#headless-bundle
|
||||
[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation"
|
||||
[lists]: /templates/lists/#ordering-content "See how to order content in list pages; for example, templates that look to specific _index.md for content and front matter."
|
||||
[lookup]: /templates/lookup-order/ "Hugo traverses your templates in a specific order when rendering content to allow for DRYer templating."
|
||||
[ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates"
|
||||
[outputs]: /templates/output-formats/ "With the release of v22, you can output your content to any text format using Hugo's familiar templating"
|
||||
[page-resources]: /content-management/page-resources/
|
||||
[pagevars]: /variables/page/
|
||||
[section]: /content-management/sections/
|
||||
[taxweight]: /content-management/taxonomies/
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: "Image Processing"
|
||||
description: "Image Page resources can be resized and cropped."
|
||||
date: 2018-01-24T13:10:00-05:00
|
||||
lastmod: 2018-01-26T15:59:07-05:00
|
||||
linktitle: "Image Processing"
|
||||
categories: ["content management"]
|
||||
keywords: [bundle,content,resources,images]
|
||||
weight: 4004
|
||||
draft: false
|
||||
toc: true
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 32
|
||||
---
|
||||
|
||||
## The Image Page Resource
|
||||
|
||||
The `image` is a [Page Resource]({{< relref "content-management/page-resources" >}}), and the processing methods listed below does not work on images inside your `/static` folder.
|
||||
|
||||
|
||||
To get all images in a [Page Bundle]({{< relref "content-management/organization#page-bundles" >}}):
|
||||
|
||||
|
||||
```html
|
||||
{{ with .Resources.ByType "image" }}
|
||||
{{ end }}
|
||||
|
||||
```
|
||||
|
||||
## Image Processing Methods
|
||||
|
||||
|
||||
The `image` resource implements the methods `Resize`, `Fit` and `Fill`, each returning the transformed image using the specified dimensions and processing options.
|
||||
|
||||
Resize
|
||||
: Resizes the image to the specified width and height.
|
||||
|
||||
```go
|
||||
// Resize to a width of 600px and preserve ratio
|
||||
{{ $image := $resource.Resize "600x" }}
|
||||
|
||||
// Resize to a height of 400px and preserve ratio
|
||||
{{ $image := $resource.Resize "x400" }}
|
||||
|
||||
// Resize to a width 600px and a height of 400px
|
||||
{{ $image := $resource.Resize "600x400" }}
|
||||
```
|
||||
|
||||
Fit
|
||||
: Scale down the image to fit the given dimensions while maintaining aspect ratio. Both height and width are required.
|
||||
|
||||
```go
|
||||
{{ $image := $resource.Fit "600x400" }}
|
||||
```
|
||||
|
||||
Fill
|
||||
: Resize and crop the image to match the given dimensions. Both height and width are required.
|
||||
|
||||
```go
|
||||
{{ $image := $resource.Fill "600x400" }}
|
||||
```
|
||||
|
||||
|
||||
{{% note %}}
|
||||
Image operations in Hugo currently **do not preserve EXIF data** as this is not supported by Go's [image package](https://github.com/golang/go/search?q=exif&type=Issues&utf8=%E2%9C%93). This will be improved on in the future.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
## Image Processing Options
|
||||
|
||||
In addition to the dimensions (e.g. `600x400`), Hugo supports a set of additional image options.
|
||||
|
||||
|
||||
JPEG Quality
|
||||
: Only relevant for JPEG images, values 1 to 100 inclusive, higher is better. Default is 75.
|
||||
|
||||
```go
|
||||
{{ $image.Resize "600x q50" }}
|
||||
```
|
||||
|
||||
Rotate
|
||||
: Rotates an image by the given angle counter-clockwise. The rotation will be performed first to get the dimensions correct. The main use of this is to be able to manually correct for [EXIF orientation](https://github.com/golang/go/issues/4341) of JPEG images.
|
||||
|
||||
```go
|
||||
{{ $image.Resize "600x r90" }}
|
||||
```
|
||||
|
||||
Anchor
|
||||
: Only relevant for the `Fill` method. This is useful for thumbnail generation where the main motive is located in, say, the left corner.
|
||||
Valid are `Center`, `TopLeft`, `Top`, `TopRight`, `Left`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`.
|
||||
|
||||
```go
|
||||
{{ $image.Fill "300x200 BottomLeft" }}
|
||||
```
|
||||
|
||||
Resample Filter
|
||||
: Filter used in resizing. Default is `Box`, a simple and fast resampling filter appropriate for downscaling.
|
||||
|
||||
Examples are: `Box`, `NearestNeighbor`, `Linear`, `Gaussian`.
|
||||
|
||||
See https://github.com/disintegration/imaging for more. If you want to trade quality for faster processing, this may be a option to test.
|
||||
|
||||
```go
|
||||
{{ $image.Resize "600x400 Gaussian" }}
|
||||
```
|
||||
|
||||
## Image Processing Examples
|
||||
|
||||
_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_
|
||||
|
||||
|
||||
{{< imgproc sunset Resize "300x" />}}
|
||||
|
||||
{{< imgproc sunset Fill "90x120 left" />}}
|
||||
|
||||
{{< imgproc sunset Fill "90x120 right" />}}
|
||||
|
||||
{{< imgproc sunset Fit "90x90" />}}
|
||||
|
||||
{{< imgproc sunset Resize "300x q10" />}}
|
||||
|
||||
|
||||
This is the shortcode used in the examples above:
|
||||
|
||||
|
||||
{{< code file="layouts/shortcodes/imgproc.html" >}}
|
||||
{{< readfile file="layouts/shortcodes/imgproc.html" >}}
|
||||
{{< /code >}}
|
||||
|
||||
And it is used like this:
|
||||
|
||||
```html
|
||||
{{</* imgproc sunset Resize "300x" /*/>}}
|
||||
```
|
||||
|
||||
|
||||
{{% note %}}
|
||||
**Tip:** Note the self-closing shortcode syntax above. The `imgproc` shortcode can be called both with and without **inner content**.
|
||||
{{% /note %}}
|
||||
|
||||
## Image Processing Config
|
||||
|
||||
You can configure an `imaging` section in `config.toml` with default image processing options:
|
||||
|
||||
```toml
|
||||
[imaging]
|
||||
# Default resample filter used for resizing. Default is Box,
|
||||
# a simple and fast averaging filter appropriate for downscaling.
|
||||
# See https://github.com/disintegration/imaging
|
||||
resampleFilter = "box"
|
||||
|
||||
# Defatult JPEG quality setting. Default is 75.
|
||||
quality = 75
|
||||
|
||||
# Anchor used when cropping pictures.
|
||||
# Default is "smart" which does Smart Cropping, using https://github.com/muesli/smartcrop
|
||||
# Smart Cropping is content aware and tries to find the best crop for each image.
|
||||
# Valid values are Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
|
||||
anchor = "smart"
|
||||
|
||||
```
|
||||
|
||||
All of the above settings can also be set per image procecssing.
|
||||
|
||||
## Smart Cropping of Images
|
||||
|
||||
By default, Hugo will use the [Smartcrop](https://github.com/muesli/smartcrop), a library created by [muesli](https://github.com/muesli), when cropping images with `.Fill`. You can set the anchor point manually, but in most cases the smart option will make a good choice. And we will work with the libray author to improve this in the future.
|
||||
|
||||
An example using the sunset image from above:
|
||||
|
||||
|
||||
{{< imgproc sunset Fill "200x200 smart" />}}
|
||||
|
||||
|
||||
## Image Processing Performance Consideration
|
||||
|
||||
Processed images are stored below `<project-dir>/resources` (can be set with `resourceDir` config setting). This folder is deliberately placed in the project, as it is recommended to check these into source control as part of the project. These images are not "Hugo fast" to generate, but once generated they can be reused.
|
||||
|
||||
If you change your image settings (e.g. size), remove or rename images etc., you will end up with unused images taking up space and cluttering your project.
|
||||
|
||||
To clean up, run:
|
||||
|
||||
```bash
|
||||
hugo --gc
|
||||
```
|
||||
|
||||
|
||||
{{% note %}}
|
||||
**GC** is short for **Garbage Collection**.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
@@ -13,11 +13,11 @@ menu:
|
||||
weight: 150
|
||||
weight: 150 #rem
|
||||
draft: false
|
||||
aliases: [/content/multilingual/,/content-management/multilingual/]
|
||||
aliases: [/content/multilingual/,/content-management/multilingual/,/tutorials/create-a-multilingual-site/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
You should define the available languages in a `Languages` section in your site configuration.
|
||||
You should define the available languages in a `languages` section in your site configuration.
|
||||
|
||||
## Configure Languages
|
||||
|
||||
@@ -30,24 +30,24 @@ copyright = "Everything is mine"
|
||||
[params.navigation]
|
||||
help = "Help"
|
||||
|
||||
[Languages]
|
||||
[Languages.en]
|
||||
[languages]
|
||||
[languages.en]
|
||||
title = "My blog"
|
||||
weight = 1
|
||||
[Languages.en.params]
|
||||
linkedin = "english-link"
|
||||
|
||||
[Languages.fr]
|
||||
[languages.fr]
|
||||
copyright = "Tout est à moi"
|
||||
title = "Mon blog"
|
||||
weight = 2
|
||||
[Languages.fr.params]
|
||||
linkedin = "lien-francais"
|
||||
[Languages.fr.navigation]
|
||||
|
||||
# skip params key for front matter
|
||||
[languages.fr.navigation]
|
||||
help = "Aide"
|
||||
{{< /code >}}
|
||||
|
||||
Anything not defined in a `[Languages]` block will fall back to the global
|
||||
Anything not defined in a `[languages]` block will fall back to the global
|
||||
value for that key (e.g., `copyright` for the English [`en`] language).
|
||||
|
||||
With the configuration above, all content, sitemap, RSS feeds, paginations,
|
||||
@@ -118,17 +118,17 @@ tag = "tags"
|
||||
angledQuotes = true
|
||||
hrefTargetBlank = true
|
||||
|
||||
[Languages]
|
||||
[Languages.en]
|
||||
[languages]
|
||||
[languages.en]
|
||||
weight = 1
|
||||
title = "English"
|
||||
[Languages.en.blackfriday]
|
||||
[languages.en.blackfriday]
|
||||
angledQuotes = false
|
||||
|
||||
[Languages.fr]
|
||||
[languages.fr]
|
||||
weight = 2
|
||||
title = "Français"
|
||||
[Languages.fr.Taxonomies]
|
||||
[languages.fr.Taxonomies]
|
||||
plaque = "plaques"
|
||||
{{< /code >}}
|
||||
|
||||
@@ -188,7 +188,7 @@ To create a list of links to translated content, use a template similar to the f
|
||||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page, or if there are translations---in the case of the homepage, section listing, etc.---a site with only render one language.
|
||||
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page.
|
||||
|
||||
The above also uses the [`i18n` function][i18func] described in the next section.
|
||||
|
||||
@@ -200,7 +200,7 @@ The above also uses the [`i18n` function][i18func] described in the next section
|
||||
{{< code file="layouts/partials/allLanguages.html" >}}
|
||||
<ul>
|
||||
{{ range $.Site.Home.AllTranslations }}
|
||||
<li><a href="{{ .}}">{{ .Language.LanguageName }}</a></li>
|
||||
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{< /code >}}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
+15
-8
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [content management,fundamentals]
|
||||
keywords: [sections,content,organization]
|
||||
keywords: [sections,content,organization,bundle,resources]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -17,17 +17,24 @@ aliases: [/content/sections/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< youtube 0GZxidrlaRM >}}
|
||||
## Page Bundles
|
||||
|
||||
## Content Bundles and Image Processing
|
||||
Hugo `0.32` announced page-relative images and other resources packaged into `Page Bundles`.
|
||||
|
||||
See [This Page](/about/new-in-032/). We will get the relevant parts of the rest of the Hugo docs updated. Eventually.
|
||||
These terms are connected, and you also need to read about [Page Resources]({{< relref "content-management/page-resources" >}}) and [Image Processing]({{< relref "content-management/image-processing" >}}) to get the full picture.
|
||||
|
||||
{{< todo >}}
|
||||
Remove the above when done.
|
||||
{{< /todo >}}
|
||||
{{% imgproc 1-featured Resize "300x" %}}
|
||||
The illustration shows 3 bundles. Note that the home page bundle cannot contain other content pages, but other files (images etc.) are fine.
|
||||
{{% /imgproc %}}
|
||||
|
||||
|
||||
{{% note %}}
|
||||
The bundle documentation is **work in progress**. We will publish more comprehensive docs about this soon.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
# Organization of Content Source
|
||||
|
||||
## Organization of Content Source
|
||||
|
||||
In Hugo, your content should be organized in a manner that reflects the rendered website.
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
---
|
||||
title : "Page Bundles"
|
||||
description : "Content organization using Page Bundles"
|
||||
date : 2018-01-24T13:09:00-05:00
|
||||
lastmod : 2018-01-28T22:26:40-05:00
|
||||
linktitle : "Page Bundles"
|
||||
keywords : ["page", "bundle", "leaf", "branch"]
|
||||
categories : ["content management"]
|
||||
draft : true
|
||||
toc : true
|
||||
menu :
|
||||
docs:
|
||||
identifier : "page-bundles"
|
||||
parent : "content-management"
|
||||
weight : 11
|
||||
---
|
||||
|
||||
Page Bundles are a way to organize the content files. It's useful for
|
||||
cases where a page or section's content needs to be split into
|
||||
multiple content pages for convenience or has associated attachments
|
||||
like documents or images.
|
||||
|
||||
A Page Bundle can be one of two types:
|
||||
|
||||
- Leaf Bundle
|
||||
- Branch Bundle
|
||||
|
||||
| | Leaf Bundle | Branch Bundle |
|
||||
|-----------------|--------------------------------------------------------|---------------------------------------------------------|
|
||||
| Usage | Collection of content and attachments for single pages | Collection of content and attachments for section pages |
|
||||
| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] |
|
||||
| Layout type | `single` | `list` |
|
||||
| Nesting | Doesn't allow nesting of more bundles under it | Allows nesting of leaf/branch bundles under it |
|
||||
| Example | `content/posts/my-post/index.md` | `content/posts/_index.md` |
|
||||
|
||||
|
||||
## Leaf Bundles {#leaf-bundles}
|
||||
|
||||
A _Leaf Bundle_ is a directory at any hierarchy within the `content/`
|
||||
directory, that contains at least an **`index.md`** file.
|
||||
|
||||
{{% note %}}
|
||||
Here `md` (markdown) is used just as an example. You can use any file
|
||||
type as a content resource as long as it is a MIME type recognized by
|
||||
Hugo (`json` files will, as one example, work fine). If you want to
|
||||
get exotic, you can define your own media type.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
### Examples of Leaf Bundle organization {#examples-of-leaf-bundle-organization}
|
||||
|
||||
```text
|
||||
content/
|
||||
├── about
|
||||
│ ├── index.md
|
||||
├── posts
|
||||
│ ├── my-post
|
||||
│ │ ├── content1.md
|
||||
│ │ ├── content2.md
|
||||
│ │ ├── image1.jpg
|
||||
│ │ ├── image2.png
|
||||
│ │ └── index.md
|
||||
│ └── my-another-post
|
||||
│ └── index.md
|
||||
│
|
||||
└── another-section
|
||||
├── ..
|
||||
└── not-a-leaf-bundle
|
||||
├── ..
|
||||
└── another-leaf-bundle
|
||||
└── index.md
|
||||
```
|
||||
|
||||
In the above example `content/` directory, there are four leaf
|
||||
bundles:
|
||||
|
||||
about
|
||||
: This leaf bundle is at the root level (directly under
|
||||
`content` directory) and has only the `index.md`.
|
||||
|
||||
my-post
|
||||
: This leaf bundle has the `index.md`, two other content
|
||||
Markdown files and two image files.
|
||||
|
||||
my-another-post
|
||||
: This leaf bundle has only the `index.md`.
|
||||
|
||||
another-leaf-bundle
|
||||
: This leaf bundle is nested under couple of
|
||||
directories. This bundle also has only the `index.md`.
|
||||
|
||||
{{% note %}}
|
||||
The hierarchy depth at which a leaf bundle is created does not matter,
|
||||
as long as it is not inside another **leaf** bundle.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
### Headless Bundle {#headless-bundle}
|
||||
|
||||
A headless bundle is a bundle that is configured to not get published
|
||||
anywhere:
|
||||
|
||||
- It will have no `Permalink` and no rendered HTML in `public/`.
|
||||
- It will not be part of `.Site.RegularPages`, etc.
|
||||
|
||||
But you can get it by `.Site.GetPage`. Here is an example:
|
||||
|
||||
```html
|
||||
{{ $headless := .Site.GetPage "page" "some-headless-bundle" }}
|
||||
{{ $reusablePages := $headless.Resources.Match "author*" }}
|
||||
<h2>Authors</h2>
|
||||
{{ range $reusablePages }}
|
||||
<h3>{{ .Title }}</h3>
|
||||
{{ .Content }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
A leaf bundle can be made headless by adding below in the Front Matter
|
||||
(in the `index.md`):
|
||||
|
||||
```toml
|
||||
headless = true
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
Only leaf bundles can be made headless.
|
||||
{{% /note %}}
|
||||
|
||||
There are many use cases of such headless page bundles:
|
||||
|
||||
- Shared media galleries
|
||||
- Reusable page content "snippets"
|
||||
|
||||
|
||||
## Branch Bundles {#branch-bundles}
|
||||
|
||||
A _Branch Bundle_ is any directory at any hierarchy within the
|
||||
`content/` directory, that contains at least an **`_index.md`** file.
|
||||
|
||||
This `_index.md` can also be directly under the `content/` directory.
|
||||
|
||||
{{% note %}}
|
||||
Here `md` (markdown) is used just as an example. You can use any file
|
||||
type as a content resource as long as it is a MIME type recognized by
|
||||
Hugo (`json` files will, as one example, work fine). If you want to
|
||||
get exotic, you can define your own media type.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
### Examples of Branch Bundle organization {#examples-of-branch-bundle-organization}
|
||||
|
||||
```text
|
||||
content/
|
||||
├── branch-bundle-1
|
||||
│ ├── branch-content1.md
|
||||
│ ├── branch-content2.md
|
||||
│ ├── image1.jpg
|
||||
│ ├── image2.png
|
||||
│ └── _index.md
|
||||
└── branch-bundle-2
|
||||
├── _index.md
|
||||
└── a-leaf-bundle
|
||||
└── index.md
|
||||
```
|
||||
|
||||
In the above example `content/` directory, there are two branch
|
||||
bundles (and a leaf bundle):
|
||||
|
||||
`branch-bundle-1`
|
||||
: This branch bundle has the `_index.md`, two
|
||||
other content Markdown files and two image files.
|
||||
|
||||
`branch-bundle-2`
|
||||
: This branch bundle has the `_index.md` and a
|
||||
nested leaf bundle.
|
||||
|
||||
{{% note %}}
|
||||
The hierarchy depth at which a branch bundle is created does not
|
||||
matter.
|
||||
{{% /note %}}
|
||||
|
||||
[^fn:1]: The `.md` extension is just an example. The extension can be `.html`, `.json` or any of any valid MIME type.
|
||||
@@ -0,0 +1,184 @@
|
||||
---
|
||||
title : "Page Resources"
|
||||
description : "Page Resources -- images, other pages, documents etc. -- have page-relative URLs and their own metadata."
|
||||
date: 2018-01-24
|
||||
categories: ["content management"]
|
||||
keywords: [bundle,content,resources]
|
||||
weight: 4003
|
||||
draft: false
|
||||
toc: true
|
||||
linktitle: "Page Resources"
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 31
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
ResourceType
|
||||
: The main type of the resource. For example, a file of MIME type `image/jpg` has for ResourceType `image`.
|
||||
|
||||
Name
|
||||
: Default value is the filename (relative to the owning page). Can be set in front matter.
|
||||
|
||||
Title
|
||||
: Default blank. Can be set in front matter.
|
||||
|
||||
Permalink
|
||||
: The absolute URL to the resource. Resources of type `page` will have no value.
|
||||
|
||||
RelPermalink
|
||||
: The relative URL to the resource. Resources of type `page` will have no value.
|
||||
|
||||
## Methods
|
||||
ByType
|
||||
: Returns the page resources of the given type.
|
||||
|
||||
```go
|
||||
{{ .Resources.ByType "image" }}
|
||||
```
|
||||
Match
|
||||
: Returns all the page resources (as a slice) whose `Name` matches the given Glob pattern ([examples](https://github.com/gobwas/glob/blob/master/readme.md)). The matching is case-insensitive.
|
||||
|
||||
```go
|
||||
{{ .Resources.Match "images/*" }}
|
||||
```
|
||||
|
||||
GetMatch
|
||||
: Same as `Match` but will return the first match.
|
||||
|
||||
### Pattern Matching
|
||||
```go
|
||||
// Using Match/GetMatch to find this images/sunset.jpg ?
|
||||
.Resources.Match "images/sun*" ✅
|
||||
.Resources.Match "**/Sunset.jpg" ✅
|
||||
.Resources.Match "images/*.jpg" ✅
|
||||
.Resources.Match "**.jpg" ✅
|
||||
.Resources.Match "*" 🚫
|
||||
.Resources.Match "sunset.jpg" 🚫
|
||||
.Resources.Match "*sunset.jpg" 🚫
|
||||
|
||||
```
|
||||
|
||||
## Page Resources Metadata
|
||||
|
||||
Page Resources' metadata is managed from their page's front matter with an array/table parameter named `resources`. You can batch assign values using a [wildcards](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm).
|
||||
|
||||
{{% note %}}
|
||||
Resources of type `page` get `Title` etc. from their own front matter.
|
||||
{{% /note %}}
|
||||
|
||||
name
|
||||
: Sets the value returned in `Name`.
|
||||
|
||||
{{% warning %}}
|
||||
The methods `Match` and `GetMatch` use `Name` to match the resources.
|
||||
{{%/ warning %}}
|
||||
|
||||
title
|
||||
: Sets the value returned in `Title`
|
||||
|
||||
params
|
||||
: A map of custom key/values.
|
||||
|
||||
|
||||
### Resources metadata: YAML Example
|
||||
|
||||
~~~yaml
|
||||
title: Application
|
||||
date : 2018-01-25
|
||||
resources :
|
||||
- src : "images/sunset.jpg"
|
||||
name : "header"
|
||||
- src : "documents/photo_specs.pdf"
|
||||
title : "Photo Specifications"
|
||||
params:
|
||||
icon : "photo"
|
||||
- src : "documents/guide.pdf"
|
||||
title : "Instruction Guide"
|
||||
- src : "documents/checklist.pdf"
|
||||
title : "Document Checklist"
|
||||
- src : "documents/payment.docx"
|
||||
title : "Proof of Payment"
|
||||
- src : "**.pdf"
|
||||
name : "pdf-file-:counter"
|
||||
params :
|
||||
icon : "pdf"
|
||||
- src : "**.docx"
|
||||
params :
|
||||
icon : "word"
|
||||
~~~
|
||||
|
||||
### Resources metadata: TOML Example
|
||||
|
||||
~~~toml
|
||||
title = Application
|
||||
date : 2018-01-25
|
||||
[[resources]]
|
||||
src = "images/sunset.jpg"
|
||||
name = "header"
|
||||
[[resources]]
|
||||
src = "documents/photo_specs.pdf"
|
||||
title = "Photo Specifications"
|
||||
[resources.params]
|
||||
icon = "photo"
|
||||
[[resources]]
|
||||
src = "documents/guide.pdf"
|
||||
title = "Instruction Guide"
|
||||
[[resources]]
|
||||
src = "documents/checklist.pdf"
|
||||
title = "Document Checklist"
|
||||
[[resources]]
|
||||
src = "documents/payment.docx"
|
||||
title = "Proof of Payment"
|
||||
[[resources]]
|
||||
src = "**.pdf"
|
||||
name = "pdf-file-:counter"
|
||||
[resources.params]
|
||||
icon = "pdf"
|
||||
[[resources]]
|
||||
src = "**.docx"
|
||||
[resources.params]
|
||||
icon = "word"
|
||||
~~~
|
||||
|
||||
|
||||
From the example above:
|
||||
|
||||
- `sunset.jpg` will receive a new `Name` and can now be found with `.GetMatch "header"`.
|
||||
- `documents/photo_specs.pdf` will get the `photo` icon.
|
||||
- `documents/checklist.pdf`, `documents/guide.pdf` and `documents/payment.docx` will get `Title` as set by `title`.
|
||||
- Every `PDF` in the bundle except `documents/photo_specs.pdf` will get the `pdf` icon.
|
||||
- All `PDF` files will get a new `Name`. The `name` parameter contains a special placeholder [`:counter`](#counter), so the `Name` will be `pdf-file-1`, `pdf-file-2`, `pdf-file-3`.
|
||||
- Every docx in the bundle will receive the `word` icon.
|
||||
|
||||
{{% warning %}}
|
||||
The __order matters__ --- Only the **first set** values of the `title`, `name` and `params`-**keys** will be used. Consecutive parameters will be set only for the ones not already set. For example, in the above example, `.Params.icon` is already first set to `"photo"` in `src = "documents/photo_specs.pdf"`. So that would not get overridden to `"pdf"` by the later set `src = "**.pdf"` rule.
|
||||
{{%/ warning %}}
|
||||
|
||||
### The `:counter` placeholder in `name` and `title`
|
||||
|
||||
The `:counter` is a special placeholder recognized in `name` and `title` parameters `resources`.
|
||||
|
||||
The counter starts at 1 the first time they are used in either `name` or `title`.
|
||||
|
||||
For example, if a bundle has the resources `photo_specs.pdf`, `other_specs.pdf`, `guide.pdf` and `checklist.pdf`, and the front matter has specified the `resources` as:
|
||||
|
||||
~~~toml
|
||||
[[resources]]
|
||||
src = "*specs.pdf"
|
||||
title = "Specification #:counter"
|
||||
[[resources]]
|
||||
src = "**.pdf"
|
||||
name = "pdf-file-:counter"
|
||||
~~~
|
||||
|
||||
the `Name` and `Title` will be assigned to the resource files as follows:
|
||||
|
||||
| Resource file | `Name` | `Title` |
|
||||
|-------------------|-------------------|-----------------------|
|
||||
| checklist.pdf | `"pdf-file-1.pdf` | `"checklist.pdf"` |
|
||||
| guide.pdf | `"pdf-file-2.pdf` | `"guide.pdf"` |
|
||||
| other\_specs.pdf | `"pdf-file-3.pdf` | `"Specification #1"` |
|
||||
| photo\_specs.pdf | `"pdf-file-4.pdf` | `"Specification #2"` |
|
||||
@@ -38,7 +38,7 @@ blog
|
||||
{{% note %}}
|
||||
When we talk about a **section** in correlation with template selection, it is currently always the root section only (`/blog/funny/mypost/ => blog`).
|
||||
|
||||
It is currently not possible to add a specific layout for one of the sub-sections.
|
||||
If you need a specific template for a sub-section, you need to adjust either the `type` or `layout` in front matter.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
||||
@@ -80,15 +80,41 @@ Hugo ships with a set of predefined shortcodes that represent very common usage.
|
||||
|
||||
The `figure` shortcode can use the following named parameters:
|
||||
|
||||
* `src`
|
||||
* `link`
|
||||
* `title`
|
||||
* `caption`
|
||||
* `class`
|
||||
* `attr` (i.e., attribution)
|
||||
* `attrlink`
|
||||
* `alt`
|
||||
* `width`
|
||||
src
|
||||
: URL of the image to be displayed.
|
||||
|
||||
link
|
||||
: If the image needs to be hyperlinked, URL of the destination.
|
||||
|
||||
target
|
||||
: Optional `target` attribute for the URL if `link` parameter is set.
|
||||
|
||||
rel
|
||||
: Optional `rel` attribute for the URL if `link` parameter is set.
|
||||
|
||||
alt
|
||||
: Alternate text for the image if the image cannot be displayed.
|
||||
|
||||
title
|
||||
: Image title.
|
||||
|
||||
caption
|
||||
: Image caption.
|
||||
|
||||
class
|
||||
: `class` attribute of the HTML `figure` tag.
|
||||
|
||||
height
|
||||
: `height` attribute of the image.
|
||||
|
||||
width
|
||||
: `width` attribute of the image.
|
||||
|
||||
attr
|
||||
: Image attribution text.
|
||||
|
||||
attrlink
|
||||
: If the attribution text needs to be hyperlinked, URL of the destination.
|
||||
|
||||
#### Example `figure` Input
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ If you need to add custom metadata to your taxonomy terms, you will need to crea
|
||||
---
|
||||
{{< /code >}}
|
||||
|
||||
You can later use your custom metadata as shown in the [Taxonomy Terms Templates documentation](/templates/taxonomy-templates/#displaying-custom-meta-data-in-taxonomy-terms-templates).
|
||||
You can later use your custom metadata as shown in the [Taxonomy Terms Templates documentation](/templates/taxonomy-templates/#displaying-custom-metadata-in-taxonomy-terms-templates).
|
||||
|
||||
[`urlize` template function]: /functions/urlize/
|
||||
[content section]: /content-management/sections/
|
||||
|
||||
@@ -118,7 +118,7 @@ aliases:
|
||||
---
|
||||
{{< /code >}}
|
||||
|
||||
Now when you visit any of the locations specified in aliases---i.e., *assuming the same site domain*---you'll be redirected to the page they are specified on. For example, a visitor to `example.com/posts/my-original-url/` will be immediately redirected to `example.com/posts/my-awesome-blog-post/`.
|
||||
Now when you visit any of the locations specified in aliases---i.e., *assuming the same site domain*---you'll be redirected to the page they are specified on. For example, a visitor to `example.com/posts/my-original-url/` will be immediately redirected to `example.com/posts/my-awesome-post/`.
|
||||
|
||||
### Example: Aliases in Multilingual
|
||||
|
||||
@@ -146,7 +146,7 @@ aliases: [/posts/my-old-url/]
|
||||
---
|
||||
```
|
||||
|
||||
Assuming a `baseURL` of `example.com`, the contents of the auto-generated alias `.html` found at `https://example.com/posts/my-old-url/ will contain the following:`
|
||||
Assuming a `baseURL` of `example.com`, the contents of the auto-generated alias `.html` found at `https://example.com/posts/my-old-url/` will contain the following:
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
@@ -161,7 +161,7 @@ Assuming a `baseURL` of `example.com`, the contents of the auto-generated alias
|
||||
</html>
|
||||
```
|
||||
|
||||
The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case. If an end user of your website goes to `https://example.com/posts/my-old-url`, they will now be automatically redirected to the newer, correct URL. The addition of `<meta name="robots" content="noindex">` lets search engine bots know they they should not crawl and index your new alias page.
|
||||
The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case. If an end user of your website goes to `https://example.com/posts/my-old-url`, they will now be automatically redirected to the newer, correct URL. The addition of `<meta name="robots" content="noindex">` lets search engine bots know that they should not crawl and index your new alias page.
|
||||
|
||||
### Customize
|
||||
You may customize this alias page by creating an `alias.html` template in the
|
||||
@@ -222,7 +222,7 @@ Here's the same organization run with `hugo --uglyURLs`:
|
||||
.
|
||||
└── content
|
||||
└── about
|
||||
| └── _index.md // <- https://example.com/about/index.html
|
||||
| └── _index.md // <- https://example.com/about.html
|
||||
├── post
|
||||
| ├── firstpost.md // <- https://example.com/post/firstpost.html
|
||||
| ├── happy
|
||||
|
||||
@@ -90,7 +90,7 @@ Git is a [version control system](https://en.wikipedia.org/wiki/Version_control)
|
||||
|
||||
Go ships with a sub-command called `get` that will download these packages for us when we setup our working environment. The source code of the packages is tracked with Git. `get` will interact with the Git servers of the package hosters in order to fetch all dependencies.
|
||||
|
||||
Move back to the terminal and check if Git is already installed. Type in `git version` and press enter. You can skip the rest of this section if the command returned a version number. Otherwise [download](https://git-scm.com/downloads) the lastest version of Git and follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
||||
Move back to the terminal and check if Git is already installed. Type in `git version` and press enter. You can skip the rest of this section if the command returned a version number. Otherwise [download](https://git-scm.com/downloads) the latest version of Git and follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
||||
|
||||
Finally, check again with `git version` if Git was installed successfully.
|
||||
|
||||
@@ -147,7 +147,7 @@ go get github.com/stretchr/testify
|
||||
|
||||
### Fork the repository
|
||||
|
||||
If you're not fimiliar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation:
|
||||
If you're not familiar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation:
|
||||
|
||||
> A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
|
||||
|
||||
@@ -219,7 +219,7 @@ Now we can create a new branch for your additions:
|
||||
git checkout -b <BRANCH-NAME>
|
||||
```
|
||||
|
||||
You can check on which branch your are with `git branch`. You should see a list of all local branches. The current branch is indicated with a little asterisk.
|
||||
You can check on which branch you are with `git branch`. You should see a list of all local branches. The current branch is indicated with a little asterisk.
|
||||
|
||||
### Contribute to Documentation
|
||||
|
||||
@@ -243,7 +243,7 @@ Sometimes changes on the codebase can cause unintended side effects. Or they don
|
||||
Make sure the commands `go test ./...` passes, and `go build` completes.
|
||||
|
||||
### Formatting
|
||||
The Go code styleguide maybe is opiniated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the styleguide to our addtions:
|
||||
The Go code styleguide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the styleguide to our addtions:
|
||||
|
||||
```
|
||||
go fmt ./...
|
||||
@@ -280,7 +280,7 @@ git log
|
||||
# Exit with q
|
||||
```
|
||||
|
||||
After making the last commit you may forgot something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
|
||||
After making the last commit you may have forgot something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
|
||||
|
||||
```
|
||||
git add --all
|
||||
@@ -348,7 +348,7 @@ Check the commit log if everything looks as expected. Should an error occur you
|
||||
|
||||
### Push commits
|
||||
|
||||
To push our commits to the fork on GitHub we need to speficy a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote url of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
|
||||
To push our commits to the fork on GitHub we need to specify a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote url of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
|
||||
|
||||
```
|
||||
git push --set-upstream <YOUR-GITHUB-USERNAME> <BRANCHNAME>
|
||||
@@ -362,7 +362,7 @@ If you modified your commit history in the last step GitHub will reject your try
|
||||
|
||||
We made a lot of progress. Good work. In this step we finally open a pull request to submit our additions. Open the [Hugo master repository](https://github.com/gohugoio/hugo/) on GitHub in your browser.
|
||||
|
||||
You should find a green button labeld with "New pull request". But GitHub is clever and probably suggests you a pull request like in the beige box below:
|
||||
You should find a green button labeled with "New pull request". But GitHub is clever and probably suggests you a pull request like in the beige box below:
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ Once you have cloned the Hugo repository, you can create a new function via the
|
||||
hugo new functions/newfunction.md
|
||||
```
|
||||
|
||||
The archetype for `functions` according to the Hugo theme is as follows:
|
||||
The archetype for `functions` according to the Hugo docs is as follows:
|
||||
|
||||
{{< code file="archetypes/functions.md" >}}
|
||||
{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md">}}
|
||||
{{< readfile file="/archetypes/functions.md">}}
|
||||
{{< /code >}}
|
||||
|
||||
#### New Function Required Fields
|
||||
|
||||
@@ -4,7 +4,6 @@ linktitle: Hugo
|
||||
description: Hugo is the world's fastest static website engine. It's written in Go (aka Golang) and developed by bep, spf13 and friends.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
menu:
|
||||
main:
|
||||
parent: "section name"
|
||||
@@ -16,4 +15,6 @@ aliases: []
|
||||
toc: false
|
||||
layout: documentation-home
|
||||
---
|
||||
Hugo is the **world's fastest static website engine.** It's written in Go (aka Golang) and developed by [bep](https://github.com/bep), [spf13](https://github.com/spf13) and [friends](https://github.com/gohugoio/hugo/graphs/contributors). Below you will find some of the most common and helpful pages from our documentation.
|
||||
Hugo is the **world's fastest static website engine.** It's written in Go (aka Golang) and developed by [bep](https://github.com/bep), [spf13](https://github.com/spf13) and [friends](https://github.com/gohugoio/hugo/graphs/contributors).
|
||||
|
||||
Below you will find some of the most common and helpful pages from our documentation.
|
||||
|
||||
@@ -10,7 +10,7 @@ menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [advanced]
|
||||
signature: ["apply COLLETION FUNCTION [PARAM...]"]
|
||||
signature: ["apply COLLECTION FUNCTION [PARAM...]"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
@@ -20,16 +20,16 @@ aliases: []
|
||||
---
|
||||
|
||||
{{< todo >}}
|
||||
<!-- POTENTIAL NEW CONTENT: see apply/sequence discussion: https://discourse.gohugo.io/t/apply-printf-on-a-sequence/5722; -->
|
||||
POTENTIAL NEW CONTENT: see apply/sequence discussion: https://discourse.gohugo.io/t/apply-printf-on-a-sequence/5722;
|
||||
{{< /todo >}}
|
||||
|
||||
`apply` expects at least three parameters, depending on the function being applied.
|
||||
|
||||
1. The first parameter is the sequence to operate on
|
||||
1. The first parameter is the sequence to operate on.
|
||||
2. The second parameter is the name of the function as a string, which must be the name of a valid [Hugo function][functions].
|
||||
3. After that, the parameters to the applied function are provided, with the string `"."` standing in for each element of the sequence the function is to be applied against.
|
||||
|
||||
Here is an example of a content file with `name:` as a front matter field:
|
||||
Here is an example of a content file with `names:` as a front matter field:
|
||||
|
||||
```
|
||||
+++
|
||||
@@ -43,19 +43,19 @@ You can then use `apply` as follows:
|
||||
{{ apply .Params.names "urlize" "." }}
|
||||
```
|
||||
|
||||
Which will result as follows:
|
||||
Which will result in the following:
|
||||
|
||||
```
|
||||
"derek-perkins", "joe-bergevin", "tanner-linsley"
|
||||
```
|
||||
|
||||
This is *roughly* equivalent to using the following with [range][]
|
||||
This is *roughly* equivalent to using the following with [range][]:
|
||||
|
||||
```
|
||||
{{ range .Params.names }}{{ . | urlize }}{{ end }}
|
||||
```
|
||||
|
||||
However, it isn’t possible to provide the output of a range to the [`delimit` function][delimit], so you need to `apply` it.
|
||||
However, it is not possible to provide the output of a range to the [`delimit` function][delimit], so you need to `apply` it.
|
||||
|
||||
If you have `post-tag-list.html` and `post-tag-link.html` as [partials][], you *could* use the following snippets, respectively:
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "cond"
|
||||
date: 2017-09-08
|
||||
description: "Return one of two arguments, depending on the value of a third argument."
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
signature: ["cond CONTROL VAR1 VAR2"]
|
||||
aliases: [/functions/cond/]
|
||||
hugoversion: 0.27
|
||||
relatedfuncs: [default]
|
||||
toc: false
|
||||
draft: false
|
||||
needsexamples: false
|
||||
---
|
||||
|
||||
`cond` returns *VAR1* if *CONTROL* is true, or *VAR2* if it is not.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
{{ cond (eq (len $geese) 1) "goose" "geese" }}
|
||||
```
|
||||
|
||||
Would emit "goose" if the `$geese` array has exactly 1 item, or "geese" otherwise.
|
||||
@@ -24,3 +24,28 @@ Useful for turning strings into numbers.
|
||||
```
|
||||
{{ int "123" }} → 123
|
||||
```
|
||||
|
||||
{{% note "Usage Note" %}}
|
||||
If the input string is supposed to represent a decimal number, and if it has
|
||||
leading 0's, then those 0's will have to be removed before passing the string
|
||||
to the `int` function, else that string will be tried to be parsed as an octal
|
||||
number representation.
|
||||
|
||||
The [`strings.TrimLeft` function](/functions/strings.trimleft/) can be used for
|
||||
this purpose.
|
||||
|
||||
```
|
||||
{{ int ("0987" | strings.TrimLeft "0") }}
|
||||
{{ int ("00987" | strings.TrimLeft "0") }}
|
||||
```
|
||||
|
||||
**Explanation**
|
||||
|
||||
The `int` function eventually calls the `ParseInt` function from the Go library
|
||||
`strconv`.
|
||||
|
||||
From its [documentation](https://golang.org/pkg/strconv/#ParseInt):
|
||||
|
||||
> the base is implied by the string's prefix: base 16 for "0x", base 8 for "0",
|
||||
> and base 10 otherwise.
|
||||
{{% /note %}}
|
||||
|
||||
@@ -20,14 +20,19 @@ draft: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
| Function | Description | Example |
|
||||
|----------------|-------------------------------------------------------------------------------|----------------------------------|
|
||||
| `add` | Adds two integers. | `{{add 1 2}}` → 3 |
|
||||
| `div` | Divides two integers. | `{{div 6 3}}` → 2 |
|
||||
| `mod` | Modulus of two integers. | `{{mod 15 3}}` → 0 |
|
||||
| `modBool` | Boolean of modulus of two integers. Evaluates to `true` if result equals 0. | `{{modBool 15 3}}` → true |
|
||||
| `mul` | Multiplies two integers. | `{{mul 2 3}}` → 6 |
|
||||
| `sub` | Subtracts two integers. | `{{sub 3 2}}` → 1 |
|
||||
| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{math.Ceil 2.1}}` → 3 |
|
||||
| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{math.Floor 1.9}}` → 1 |
|
||||
| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{math.Round 1.5}}` → 2 |
|
||||
| Function | Description | Example |
|
||||
|--------------|-----------------------------------------------------------------------------|----------------------------------|
|
||||
| `add` | Adds two numbers. | `{{add 1 2}}` → `3` |
|
||||
| | *If one of the numbers is a float, the result is a float.* | `{{add 1.1 2}}` → `3.1` |
|
||||
| `sub` | Subtracts two numbers. | `{{sub 3 2}}` → `1` |
|
||||
| | *If one of the numbers is a float, the result is a float.* | `{{sub 3 2.5}}` → `0.5` |
|
||||
| `mul` | Multiplies two numbers. | `{{mul 2 3}}` → `6` |
|
||||
| | *If one of the numbers is a float, the result is a float.* | `{{mul 2 3.1}}` → `6.2` |
|
||||
| `div` | Divides two numbers. | `{{div 6 3}}` → `2` |
|
||||
| | | `{{div 6 4}}` → `1` |
|
||||
| | *If one of the numbers is a float, the result is a float.* | `{{div 6 4.0}}` → `1.5` |
|
||||
| `mod` | Modulus of two integers. | `{{mod 15 3}}` → `0` |
|
||||
| `modBool` | Boolean of modulus of two integers. Evaluates to `true` if result equals 0. | `{{modBool 15 3}}` → `true` |
|
||||
| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{math.Ceil 2.1}}` → `3` |
|
||||
| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{math.Floor 1.9}}` → `1` |
|
||||
| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{math.Round 1.5}}` → `2` |
|
||||
|
||||
@@ -134,4 +134,21 @@ Only the following operators are available for `nil`
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Portable `where` filters
|
||||
|
||||
This is especially important for themes, but to list the most relevant pages on the front page or similar, you can use `.Site.Params.mainSections` list.
|
||||
|
||||
This will, by default, list pages from the _section with the most pages_.
|
||||
|
||||
```html
|
||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||
```
|
||||
|
||||
The user can override the default in `config.toml`:
|
||||
|
||||
```toml
|
||||
[params]
|
||||
mainSections = ["blog", "docs"]
|
||||
```
|
||||
|
||||
[intersect]: /functions/intersect/
|
||||
|
||||
@@ -73,23 +73,16 @@ canonifyURLs: false
|
||||
config: "config.toml"
|
||||
contentDir: "content"
|
||||
dataDir: "data"
|
||||
defaultExtension: "html"
|
||||
defaultLayout: "post"
|
||||
# Missing translations will default to this content language
|
||||
defaultContentLanguage: "en"
|
||||
# Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/
|
||||
defaultContentLanguageInSubdir: false
|
||||
disableLiveReload: false
|
||||
# Do not build RSS files
|
||||
disableRSS: false
|
||||
# Do not build Sitemap file
|
||||
disableSitemap: false
|
||||
# Enable GitInfo feature
|
||||
enableGitInfo: false
|
||||
# Build robots.txt file
|
||||
enableRobotsTXT: false
|
||||
# Do not render 404 page
|
||||
disable404: false
|
||||
# Do not inject generator meta tag on homepage
|
||||
disableHugoGeneratorInject: false
|
||||
# Allows you to disable all page types and will render nothing related to 'kind';
|
||||
@@ -216,23 +209,16 @@ canonifyURLs = false
|
||||
config = "config.toml"
|
||||
contentDir = "content"
|
||||
dataDir = "data"
|
||||
defaultExtension = "html"
|
||||
defaultLayout = "post"
|
||||
# Missing translations will default to this content language
|
||||
defaultContentLanguage = "en"
|
||||
# Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/
|
||||
defaultContentLanguageInSubdir = false
|
||||
disableLiveReload = false
|
||||
# Do not build RSS files
|
||||
disableRSS = false
|
||||
# Do not build Sitemap file
|
||||
disableSitemap = false
|
||||
# Enable GitInfo feature
|
||||
enableGitInfo = false
|
||||
# Build robots.txt file
|
||||
enableRobotsTXT = false
|
||||
# Do not render 404 page
|
||||
disable404 = false
|
||||
# Do not inject generator meta tag on homepage
|
||||
disableHugoGeneratorInject = false
|
||||
# Allows you to disable all page types and will render nothing related to 'kind';
|
||||
|
||||
@@ -38,7 +38,7 @@ Running the `hugo new site` generator from the command line will create a direct
|
||||
|
||||
## Directory Structure Explained
|
||||
|
||||
The following is a high-level overview of each of the directories with links to each of their respective sections with in the Hugo docs.
|
||||
The following is a high-level overview of each of the directories with links to each of their respective sections within the Hugo docs.
|
||||
|
||||
[`archetypes`](/content-management/archetypes/)
|
||||
: You can create new content files in Hugo using the `hugo new` command.
|
||||
|
||||
@@ -4,7 +4,7 @@ linktitle: Install Hugo
|
||||
description: Install Hugo on macOS, Windows, Linux, FreeBSD, and on any machine where the Go compiler tool chain can run.
|
||||
date: 2016-11-01
|
||||
publishdate: 2016-11-01
|
||||
lastmod: 2017-02-20
|
||||
lastmod: 2018-01-02
|
||||
categories: [getting started,fundamentals]
|
||||
authors: ["Michael Henderson"]
|
||||
keywords: [install,pc,windows,linux,macos,binary,tarball]
|
||||
@@ -66,23 +66,24 @@ choco install hugo -confirm
|
||||
#### Prerequisite Tools
|
||||
|
||||
* [Git][installgit]
|
||||
* [Go 1.5+][installgo]
|
||||
* [govendor][]
|
||||
* [Go (latest or previous version)][installgo]
|
||||
|
||||
#### 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 because the command is not vendor aware. *You must use `govendor` to fetch Hugo's dependencies.*
|
||||
Hugo uses [dep][] 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 because the command is not vendor aware.
|
||||
|
||||
The simplest way is to use [mage][] (a Make alternative for Go projects.)
|
||||
|
||||
#### Fetch from GitHub
|
||||
|
||||
{{< code file="from-gh.sh" >}}
|
||||
go get github.com/kardianos/govendor
|
||||
govendor get github.com/gohugoio/hugo
|
||||
go install github.com/gohugoio/hugo
|
||||
go get github.com/magefile/mage
|
||||
go get -d github.com/gohugoio/hugo
|
||||
cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo
|
||||
mage vendor
|
||||
mage install
|
||||
{{< /code >}}
|
||||
|
||||
`govendor get` will fetch Hugo and all its dependent libraries to `$GOPATH/src/github.com/gohugoio/hugo`, and `go install` compiles everything into a final `hugo` (or `hugo.exe`) executable inside `$GOPATH/bin/`.
|
||||
|
||||
{{% note %}}
|
||||
If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.
|
||||
{{% /note %}}
|
||||
@@ -453,7 +454,15 @@ You can also install Hugo from the Arch Linux [community](https://www.archlinux.
|
||||
sudo pacman -Sy hugo
|
||||
```
|
||||
|
||||
### Fedora, CentOS, and Red Hat
|
||||
### Fedora
|
||||
|
||||
Fedora provides a package for Hugo. The installation is done with the command :
|
||||
|
||||
```
|
||||
sudo dnf install hugo
|
||||
```
|
||||
|
||||
### CentOS, and Red Hat
|
||||
|
||||
* <https://copr.fedorainfracloud.org/coprs/daftaupe/hugo/>
|
||||
|
||||
@@ -478,7 +487,8 @@ Now that you've installed Hugo, read the [Quick Start guide][quickstart] and exp
|
||||
[content]: /content-management/
|
||||
[@dhersam]: https://github.com/dhersam
|
||||
[forum]: https://discourse.gohugo.io
|
||||
[govendor]: https://github.com/kardianos/govendor
|
||||
[mage]: https://github.com/magefile/mage
|
||||
[dep]: https://github.com/golang/dep
|
||||
[highlight shortcode]: /content-management/shortcodes/#highlight
|
||||
[installgit]: http://git-scm.com/
|
||||
[installgo]: https://golang.org/dl/
|
||||
|
||||
@@ -44,6 +44,7 @@ Usage:
|
||||
|
||||
Available Commands:
|
||||
benchmark Benchmark Hugo by building a site a number of times.
|
||||
check Contains some verification checks
|
||||
config Print the site configuration
|
||||
convert Convert your content to different formats
|
||||
env Print Hugo version and environment info
|
||||
@@ -53,7 +54,6 @@ Available Commands:
|
||||
list Listing out various types of content
|
||||
new Create new content for your site
|
||||
server A high performance webserver
|
||||
undraft Undraft resets the content's draft status
|
||||
version Print the version number of Hugo
|
||||
|
||||
Flags:
|
||||
@@ -62,18 +62,16 @@ Flags:
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
--debug debug output
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 do not render 404 page
|
||||
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
|
||||
--disableRSS do not build RSS files
|
||||
--disableSitemap do not build Sitemap file
|
||||
--enableGitInfo add Git revision, date and author info to the pages
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
-h, --help help for hugo
|
||||
--i18n-warnings print missing translations
|
||||
--ignoreCache ignores the cache directory
|
||||
@@ -82,23 +80,21 @@ Flags:
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--noChmod don't sync permission mode of files
|
||||
--noTimes don't sync modification time of files
|
||||
--pluralizeListTitles pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--quiet build in quiet mode
|
||||
--renderToMemory render to memory (only useful for benchmark testing)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--stepAnalysis display memory and timing of different steps of the program
|
||||
--templateMetrics display metrics about template executions
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--themesDir string filesystem path to themes directory
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
-w, --watch watch filesystem for changes and recreate as needed
|
||||
|
||||
Additional help topics:
|
||||
hugo check Contains some verification checks
|
||||
|
||||
Use "hugo [command] --help" for more information about a command.
|
||||
```
|
||||
|
||||
|
||||
@@ -115,8 +115,8 @@ Do this by adding a custom install script at the root of your project that will
|
||||
|
||||
if [[ ! -f /data/bin/hugo ]]; then
|
||||
cd /tmp
|
||||
wget https://github.com/gohugoio/hugo/releases/download/v0.25.1/hugo_0.25.1_Linux-64bit.tar.gz
|
||||
tar -xzf hugo_0.25.1_Linux-64bit.tar.gz
|
||||
wget https://github.com/gohugoio/hugo/releases/download/v0.31.1/hugo_0.31.1_Linux-64bit.tar.gz
|
||||
tar -xzf hugo_0.31.1_Linux-64bit.tar.gz
|
||||
mv hugo /data/bin/hugo
|
||||
cd -
|
||||
rm -rf /tmp/*
|
||||
@@ -127,6 +127,9 @@ fi
|
||||
{{% note %}}
|
||||
If the install script fails during `nanobox run` you may need to make it executable with `chmod +x install.sh`
|
||||
{{% /note %}}
|
||||
{{% note %}}
|
||||
Make sure to check the version of Hugo you have installed and update the install script to match.
|
||||
{{% /note %}}
|
||||
|
||||
### Generating a New Hugo App
|
||||
|
||||
|
||||
@@ -75,13 +75,9 @@ hugo new about.md
|
||||
The preceding example for the about page leverages archetypes to scaffold a new content file with preconfigured front matter. [Find out more about Hugo's archetypes](/content-management/archetypes/).
|
||||
{{% /note %}}
|
||||
|
||||
Now you can edit `contents/about.md` in your text editor of choice, but this is not necessary for the purposes of this guide. Running the following command will build your Hugo site into the `public` directory. We have added `undraft` to ensure that the example page is no longer in draft mode:
|
||||
Now you can edit `contents/about.md` in your text editor of choice, but this is not necessary for the purposes of this guide. Running the following command will build your Hugo site into the `public` directory.
|
||||
|
||||
{{< code file="hugo-build-undraft.sh" >}}
|
||||
hugo undraft content/about.md
|
||||
{{< /code >}}
|
||||
|
||||
Once the website is build, t's a good idea to run the following command to start a local server and ensure you're changes have been implemented:
|
||||
Once the website is build, it's a good idea to run the following command to start a local server and ensure you're changes have been implemented:
|
||||
|
||||
```
|
||||
hugo server --theme=herring-cove
|
||||
@@ -132,7 +128,7 @@ git push -u origin master
|
||||
|
||||
## Set Up Wercker
|
||||
|
||||
To sign up for a free Wercker account, go to <https://wercker.com> and click the the **Sign Up** button on the top right of the home screen.
|
||||
To sign up for a free Wercker account, go to <https://wercker.com> and click the **Sign Up** button on the top right of the home screen.
|
||||
|
||||
![][3]
|
||||
|
||||
|
||||
@@ -27,13 +27,84 @@ GitHub provides free and fast static hosting over SSL for personal, organization
|
||||
2. You have a GitHub account. [Signing up][ghsignup] for GitHub is free.
|
||||
3. You have a ready-to-publish Hugo website or have at least completed the [Quick Start][].
|
||||
|
||||
If you are working within an Organization account or want to set up a User website on GitHub and would like more information, refer to the [GitHub Pages documentation][ghorgs].
|
||||
## Types of GitHub Pages
|
||||
|
||||
There are 2 types of GitHub Pages:
|
||||
|
||||
- User/Organization Pages (`https://<USERNAME|ORGANIZATION>.github.io/`)
|
||||
- Project Pages (`https://<USERNAME|ORGANIZATION>.github.io/<PROJECT>/`)
|
||||
|
||||
Please refer to the [GitHub Pages documentation][ghorgs] to decide which type of site you would like to create as it will determine which of the below methods to use.
|
||||
|
||||
To create a User/Organization Pages site, follow the single method in the *GitHub User and Organization Pages* section below.
|
||||
|
||||
To create a Project Pages site, choose a method from the *Project Pages* section below.
|
||||
|
||||
## GitHub User or Organization Pages
|
||||
|
||||
As mentioned [the GitHub Pages documentation][ghorgs], you can host a user/organization page in addition to project pages. Here are the key differences in GitHub Pages websites for Users and Organizations:
|
||||
|
||||
1. You must use a `<USERNAME>.github.io` to host your **generated** content
|
||||
2. Content from the `master` branch will be used to publish your GitHub Pages site
|
||||
|
||||
This is a much simpler setup as your Hugo files and generated content are published into two different repositories.
|
||||
|
||||
### Step-by-step Instructions
|
||||
|
||||
1. Create a `<YOUR-PROJECT>` (e.g. `blog`) repository on GitHub. This repository will contain Hugo's content and other source files.
|
||||
2. Create a `<USERNAME>.github.io` GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
|
||||
3. `git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>`
|
||||
4. Make your website work locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
|
||||
5. Once you are happy with the results:
|
||||
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to kill the server
|
||||
* `rm -rf public` to completely remove the `public` directory
|
||||
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.
|
||||
|
||||
### Put it Into a Script
|
||||
|
||||
You're almost done. You can also add a `deploy.sh` script to automate the preceding steps for you. You can also make it executable with `chmod +x deploy.sh`.
|
||||
|
||||
The following are the contents of the `deploy.sh` script:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
|
||||
|
||||
# Build the project.
|
||||
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
|
||||
|
||||
# Go To Public folder
|
||||
cd public
|
||||
# Add changes to git.
|
||||
git add .
|
||||
|
||||
# Commit changes.
|
||||
msg="rebuilding site `date`"
|
||||
if [ $# -eq 1 ]
|
||||
then msg="$1"
|
||||
fi
|
||||
git commit -m "$msg"
|
||||
|
||||
# Push source and build repos.
|
||||
git push origin master
|
||||
|
||||
# Come Back up to the Project Root
|
||||
cd ..
|
||||
```
|
||||
|
||||
|
||||
You can then run `./deploy.sh "Your optional commit message"` to send changes to `<USERNAME>.github.io`. Note that you likely will want to commit changes to your `<YOUR-PROJECT>` repository as well.
|
||||
|
||||
That's it! Your personal page should be up and running at `https://<USERNAME>.github.io` within a couple minutes.
|
||||
|
||||
## GitHub Project Pages
|
||||
|
||||
{{% note %}}
|
||||
Make sure your `baseURL` key-value in your [site configuration](/getting-started/configuration/) reflects the full URL of your GitHub pages repository if you're using the default GH Pages URL (e.g., `username.github.io/myprojectname/`) and not a custom domain.
|
||||
Make sure your `baseURL` key-value in your [site configuration](/getting-started/configuration/) reflects the full URL of your GitHub pages repository if you're using the default GH Pages URL (e.g., `<USERNAME>.github.io/<PROJECT>/`) and not a custom domain.
|
||||
{{% /note %}}
|
||||
|
||||
## Deployment via `/docs` Folder on Master Branch
|
||||
### Deployment of Project Pages from `/docs` folder on `master` branch
|
||||
|
||||
[As described in the GitHub Pages documentation][ghpfromdocs], you can deploy from a folder called `docs/` on your master branch. To effectively use this feature with Hugo, you need to change the Hugo publish directory in your [site's][config] `config.toml` and `config.yaml`, respectively:
|
||||
|
||||
@@ -53,18 +124,18 @@ After running `hugo`, push your master branch to the remote repository and choos
|
||||
The `docs/` option is the simplest approach but requires you set a publish directory in your site configuration. You cannot currently configure GitHub pages to publish from another directory on master, and not everyone prefers the output site live concomitantly with source files in version control.
|
||||
{{% /note %}}
|
||||
|
||||
## Deployment From Your `gh-pages` Branch
|
||||
### Deployment of Project Pages From Your `gh-pages` branch
|
||||
|
||||
You can also tell GitHub pages to treat your `master` branch as the published site or point to a separate `gh-pages` branch. The latter approach is a bit more complex but has some advantages:
|
||||
|
||||
* It keeps your source and generated website in different branches and therefore maintains version control history for both.
|
||||
* Unlike the preceding `docs/` option, it uses the default `public` folder.
|
||||
|
||||
### Preparations for `gh-pages` Branch
|
||||
#### Preparations for `gh-pages` Branch
|
||||
|
||||
These steps only need to be done once. Replace `upstream` with the name of your remote; e.g., `origin`:
|
||||
|
||||
#### Add the Public Folder
|
||||
##### Add the `public` Folder
|
||||
|
||||
First, add the `public` folder to your `.gitignore` file at the project root so that the directory is ignored on the master branch:
|
||||
|
||||
@@ -72,7 +143,7 @@ First, add the `public` folder to your `.gitignore` file at the project root so
|
||||
echo "public" >> .gitignore
|
||||
```
|
||||
|
||||
#### Initialize Your `gh-pages` Branch
|
||||
##### Initialize Your `gh-pages` Branch
|
||||
|
||||
You can now initialize your `gh-pages` branch as an empty [orphan branch][]:
|
||||
|
||||
@@ -84,7 +155,7 @@ git push upstream gh-pages
|
||||
git checkout master
|
||||
```
|
||||
|
||||
### Build and Deployment
|
||||
#### Build and Deployment
|
||||
|
||||
Now check out the `gh-pages` branch into your `public` folder using git's [worktree feature][]. Essentially, the worktree allows you to have multiple branches of the same local repository to be checked out in different directories:
|
||||
|
||||
@@ -106,7 +177,7 @@ If the changes in your local `gh-pages` branch look alright, push them to the re
|
||||
git push upstream gh-pages
|
||||
```
|
||||
|
||||
#### Set `gh-pages` as Your Publish Branch
|
||||
##### Set `gh-pages` as Your Publish Branch
|
||||
|
||||
In order to use your `gh-pages` branch as your publishing branch, you'll need to configure the repository within the GitHub UI. This will likely happen automatically once GitHub realizes you've created this branch. You can also set the branch manually from within your GitHub project:
|
||||
|
||||
@@ -115,7 +186,7 @@ In order to use your `gh-pages` branch as your publishing branch, you'll need to
|
||||
|
||||
After a short while, you'll see the updated contents on your GitHub Pages site.
|
||||
|
||||
### Put it Into a Script
|
||||
#### Put it Into a Script
|
||||
|
||||
To automate these steps, you can create a script with the following contents:
|
||||
|
||||
@@ -153,7 +224,7 @@ cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)
|
||||
|
||||
This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing. Or adding `echo yourdomainname.com >> CNAME` if you set up for your gh-pages to use customize domain.
|
||||
|
||||
## Deployment From Your `master` Branch
|
||||
### Deployment of Project Pages from Your `master` Branch
|
||||
|
||||
To use `master` as your publishing branch, you'll need your rendered website to live at the root of the GitHub repository. Steps should be similar to that of the `gh-pages` branch, with the exception that you will create your GitHub repository with the `public` directory as the root. Note that this does not provide the same benefits of the `gh-pages` branch in keeping your source and output in separate, but version controlled, branches within the same repo.
|
||||
|
||||
@@ -162,64 +233,6 @@ You will also need to set `master` as your publishable branch from within the Gi
|
||||
1. Go to **Settings** → **GitHub Pages**
|
||||
2. From **Source**, select "master branch" and then **Save**.
|
||||
|
||||
## Host GitHub User or Organization Pages
|
||||
|
||||
As mentioned [in this GitHub Help article](https://help.github.com/articles/user-organization-and-project-pages/), you can host a user/organization page in addition to project pages. Here are the key differences in GitHub Pages websites for Users and Organizations:
|
||||
|
||||
1. You must use the `<USERNAME>.github.io` naming scheme for your GitHub repo.
|
||||
2. Content from the `master` branch will be used to publish your GitHub Pages site.
|
||||
|
||||
It becomes much simpler in this case: we'll create two separate repos, one for Hugo's content, and a git submodule with the `public` folder's content in it.
|
||||
|
||||
### Step-by-step Instructions
|
||||
|
||||
1. Create a `<YOUR-PROJECT>` git repository on GitHub. This repository will contain Hugo's content and other source files.
|
||||
2. Create a `<USERNAME>.github.io` GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
|
||||
3. `git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>`
|
||||
4. Make your website work locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
|
||||
5. Once you are happy with the results:
|
||||
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to kill the server
|
||||
* `rm -rf public` to completely remove the `public` directory if there
|
||||
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.
|
||||
|
||||
#### Put it Into a Script
|
||||
|
||||
You're almost done. You can also add a `deploy.sh` script to automate the preceding steps for you. You can also make it executable with `chmod +x deploy.sh`.
|
||||
|
||||
The following are the contents of the `deploy.sh` script:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
|
||||
|
||||
# Build the project.
|
||||
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
|
||||
|
||||
# Go To Public folder
|
||||
cd public
|
||||
# Add changes to git.
|
||||
git add .
|
||||
|
||||
# Commit changes.
|
||||
msg="rebuilding site `date`"
|
||||
if [ $# -eq 1 ]
|
||||
then msg="$1"
|
||||
fi
|
||||
git commit -m "$msg"
|
||||
|
||||
# Push source and build repos.
|
||||
git push origin master
|
||||
|
||||
# Come Back up to the Project Root
|
||||
cd ..
|
||||
```
|
||||
|
||||
|
||||
You can then run `./deploy.sh "Your optional commit message"` to send changes to `<USERNAME>.github.io`. Note that you likely will want to commit changes to your `<YOUR-PROJECT>` repository as well.
|
||||
|
||||
That's it! Your personal page should be up and running at `https://yourusername.github.io` within a couple minutes.
|
||||
|
||||
## Use a Custom Domain
|
||||
|
||||
If you'd like to use a custom domain for your GitHub Pages site, create a file `static/CNAME`. Your custom domain name should be the only contents inside `CNAME`. Since it's inside `static`, the published site will contain the CNAME file at the root of the published site, which is a requirements of GitHub Pages.
|
||||
|
||||
@@ -20,6 +20,14 @@ wip: false
|
||||
aliases: [/tutorials/hosting-on-gitlab/]
|
||||
---
|
||||
|
||||
{{% warning %}}
|
||||
GitLab has temporarily turned off custom domains support because of a security issue. The plan is to re-enable it after the 20th of February.
|
||||
For more information:
|
||||
https://about.gitlab.com/2018/02/05/gitlab-pages-custom-domain-validation/
|
||||
{{% /warning %}}
|
||||
|
||||
{{< todo >}}Remove the above when fixed.{{< /todo >}}
|
||||
|
||||
[GitLab](https://gitlab.com/) makes it incredibly easy to build, deploy, and host your Hugo website via their free GitLab Pages service, which provides [native support for Hugo, as well as numerous other static site generators](https://gitlab.com/pages/hugo).
|
||||
|
||||
## Assumptions
|
||||
|
||||
@@ -24,7 +24,7 @@ draft: false
|
||||
|
||||
## Create a KeyCDN Pull Zone
|
||||
|
||||
The first step will be to login to your KeyCDN account and create a new zone. Name this whatever you like and select the [Pull Zone](https://www.keycdn.com/support/create-a-pull-zone/) option. As for the the origin URL, your site will be running on [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/getting_started_part_one.html) with a URL of `https://youruser.gitlab.io/reponame/`. Use this as the Origin URL.
|
||||
The first step will be to login to your KeyCDN account and create a new zone. Name this whatever you like and select the [Pull Zone](https://www.keycdn.com/support/create-a-pull-zone/) option. As for the origin URL, your site will be running on [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/getting_started_part_one.html) with a URL of `https://youruser.gitlab.io/reponame/`. Use this as the Origin URL.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -59,37 +59,33 @@ Select the repo you want to use for continuous deployment. If you have a large n
|
||||
|
||||
Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you wanted published, your [build command][], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration][config], the default of which is `public`. The following steps assume you are publishing from the `master` branch.
|
||||
|
||||
### Build with a Specific Hugo Version
|
||||
## Configure Hugo Version in Netlify
|
||||
|
||||
Setting the build command to `hugo` will build your site according to the current default Hugo version used by Netlify. You can see the full list of [available Hugo versions in Netlify's Docker file][hugoversions].
|
||||
|
||||
If you want to tell Netlify to build with a specific version (hugo <= 0.20), you can append an underscore followed by the version number to the build command:
|
||||
|
||||
```
|
||||
hugo_0.19
|
||||
```
|
||||
|
||||
Your simple configuration should now look similar to the following:
|
||||
|
||||

|
||||
|
||||
For version hugo > 0.20 you have to [specify version hugo for testing and production](https://www.netlify.com/blog/2017/04/11/netlify-plus-hugo-0.20-and-beyond/) in `netlify.toml` file or set `HUGO_VERSION` as a build environment variable in the Netlify console.
|
||||
You can [set Hugo version](https://www.netlify.com/blog/2017/04/11/netlify-plus-hugo-0.20-and-beyond/) for your environments in `netlify.toml` file or set `HUGO_VERSION` as a build environment variable in the Netlify console.
|
||||
|
||||
For production:
|
||||
|
||||
```
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.26"
|
||||
HUGO_VERSION = "0.36"
|
||||
```
|
||||
|
||||
For testing:
|
||||
|
||||
```
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.26"
|
||||
```
|
||||
HUGO_VERSION = "0.36"
|
||||
```
|
||||
|
||||
Selecting "Deploy site" will immediately take you to a terminal for your build:.
|
||||
The Netlify configuration file can be a little hard to understand and get right for the different environment, and you may get some inspiration and tips from this site's `netlify.toml`:
|
||||
|
||||
{{< code file="netlify.toml" nocode="true" >}}
|
||||
{{< readfile file="netlify.toml" highlight="toml" >}}
|
||||
{{< /code >}}
|
||||
|
||||
## Build and Deploy Site
|
||||
|
||||
In the Netlify console, selecting "Deploy site" will immediately take you to a terminal for your build:.
|
||||
|
||||

|
||||
|
||||
@@ -103,6 +99,8 @@ Once the build is finished---this should only take a few seconds--you should now
|
||||
|
||||
Now every time you push changes to your hosted git repository, Netlify will rebuild and redeploy your site.
|
||||
|
||||
See [this blog post](https://www.netlify.com/blog/2017/04/11/netlify-plus-hugo-0.20-and-beyond/) for more details about how Netlify handles Hugo versions.
|
||||
|
||||
## Use Hugo Themes with Netlify
|
||||
|
||||
The [`git clone` method for installing themes][installthemes] is not supported by Netlify. If you were to use `git clone`, it would require you to recursively remove the `.git` subdirectory from the theme folder and would therefore prevent compatibility with future versions of the theme.
|
||||
@@ -145,7 +143,7 @@ You now have a live website served over https, distributed through CDN, and conf
|
||||
[ghsm]: https://github.com/blog/2104-working-with-submodules
|
||||
[gitsm]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
|
||||
[httpscustom]: https://www.netlify.com/docs/ssl/
|
||||
[hugoversions]: https://github.com/netlify/build-image/blob/master/Dockerfile#L166
|
||||
[hugoversions]: https://github.com/netlify/build-image/blob/master/Dockerfile#L216
|
||||
[installthemes]: /themes/installing/
|
||||
[netlify]: https://www.netlify.com/
|
||||
[netlifysignup]: https://app.netlify.com/signup
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: Maintenance
|
||||
description: Some lists useful for the maintenance of the Hugo docs site.
|
||||
date: 2018-02-09
|
||||
categories: [maintenance]
|
||||
keywords: [maintenance]
|
||||
menu:
|
||||
docs:
|
||||
weight: 200
|
||||
slug:
|
||||
aliases: []
|
||||
toc: true
|
||||
---
|
||||
|
||||
@@ -90,7 +90,7 @@ times decreased anywhere from 10% to 99%.
|
||||
* Add config layout and content directory CLI options {{<gh 1698>}}
|
||||
* Add boolean value comparison to `where` template function {{<gh
|
||||
0xf3c74c9db484c8961e70cb3458f9e41e7832fa12>}}
|
||||
* Do not write to to cache when `ignoreCache` is set {{<gh 2067>}}
|
||||
* Do not write to cache when `ignoreCache` is set {{<gh 2067>}}
|
||||
* Add option to disable rendering of 404 page {{<gh 2037>}}
|
||||
* Mercurial is no longer needed to build Hugo {{<gh 2062 >}}
|
||||
* Do not create `robots.txt` by default {{<gh 2049>}}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
---
|
||||
date: 2018-01-03
|
||||
title: "0.32.2"
|
||||
description: "0.32.2"
|
||||
slug: "0.32.2"
|
||||
title: "0.32.2: One bugfix"
|
||||
description: "Fixes one issue with publishing of processed images when no cache."
|
||||
slug: "0.32.2-relnotes"
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
---
|
||||
date: 2018-01-08
|
||||
title: "Hugo 0.32.3: Some important bug fixes"
|
||||
description: "Fixes multilingual resource (images etc.) handling etc."
|
||||
slug: "0.32.3-relnotes"
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
Hugo `0.32` was a big and [really cool](https://gohugo.io/news/0.32-relnotes/) release, and the [Hugo Forum](https://discourse.gohugo.io/) has been filled with questions from people wanting to upgrade their Hugo sites to be able to use the new image processing feature etc.
|
||||
|
||||
And with that we have discovered some issues, which this release should fix, mostly releated to multilingual sites:
|
||||
|
||||
* Fix multihost detection for sites without language definition [8969331f](https://github.com/gohugoio/hugo/commit/8969331f5be352939883074034adac6b7086ddc8) [@bep](https://github.com/bep) [#4221](https://github.com/gohugoio/hugo/issues/4221)
|
||||
* Fix hugo benchmark --renderToMemory [059e8458](https://github.com/gohugoio/hugo/commit/059e8458d690dbb9fcd3ebd58cfc61b062d3138e) [@bep](https://github.com/bep) [#4218](https://github.com/gohugoio/hugo/issues/4218)
|
||||
* Fix URLs for bundle resources in multihost mode [ab82a27d](https://github.com/gohugoio/hugo/commit/ab82a27d055c3aa177821d81a45a5c6e972aa29e) [@bep](https://github.com/bep) [#4217](https://github.com/gohugoio/hugo/issues/4217)
|
||||
* Fix sub-folder baseURL handling for Page resources [f25d8a9e](https://github.com/gohugoio/hugo/commit/f25d8a9e17fb65fa41dafdcbf0358853d68eaf45) [@bep](https://github.com/bep) [#4228](https://github.com/gohugoio/hugo/issues/4228)
|
||||
* Avoid processing and storing same image for each language [4b04db0f](https://github.com/gohugoio/hugo/commit/4b04db0f0855a1f54895d6c93c52dcea4b1ce3ca) [@bep](https://github.com/bep) [#4231](https://github.com/gohugoio/hugo/issues/4231)
|
||||
* Resources.ByType should return Resources [97c1866e](https://github.com/gohugoio/hugo/commit/97c1866e322284dec46db6f3d235807507f5b69f) [@bep](https://github.com/bep) [#4234](https://github.com/gohugoio/hugo/issues/4234)
|
||||
* Report build time on config.toml change [6feb1387](https://github.com/gohugoio/hugo/commit/6feb138785eeb9e813428d0df30010d9b5fb1059) [@bep](https://github.com/bep) [#4232](https://github.com/gohugoio/hugo/issues/4232)[#4224](https://github.com/gohugoio/hugo/issues/4224)
|
||||
* Fix handling of mixed-case taxonomy folders with content file [2d3189b2](https://github.com/gohugoio/hugo/commit/2d3189b22760e0a8995dae082a6bc5480f770bfe) [@bep](https://github.com/bep) [#4238](https://github.com/gohugoio/hugo/issues/4238)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
---
|
||||
date: 2018-01-11
|
||||
title: "0.32.4: Two bugfixes"
|
||||
description: "Fixes non-ASCII path handling for Page resources."
|
||||
slug: "0.32.4-relnotes"
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
---
|
||||
|
||||
This is a bug-fix release with two of important fixes.
|
||||
|
||||
* Fix non-ASCII path handling for Page resources [f0eecc6a](https://github.com/gohugoio/hugo/commit/f0eecc6a4f541838e9930c98bc982546f65c7a4f) [@bep](https://github.com/bep) [#4241](https://github.com/gohugoio/hugo/issues/4241)
|
||||
* Fix `--cleanDestinationDir` [5235a5bf](https://github.com/gohugoio/hugo/commit/5235a5bf5ef44b3789341e1d25b681a7bb14771a) [@biodranik](https://github.com/biodranik) [#4246](https://github.com/gohugoio/hugo/issues/4246)[#4248](https://github.com/gohugoio/hugo/issues/4248)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
@@ -0,0 +1,76 @@
|
||||
|
||||
---
|
||||
date: 2018-01-18
|
||||
title: "Hugo 0.33: The New Kinder Surprise!"
|
||||
description: "Hugo 0.33 comes with resource (images etc.) metadata, `type` and `layout` for all page types, `url` in front matter for list pages …"
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
Hugo `0.33` is the first main Hugo release of the new year, and it is safe to say that [@bep](https://github.com/bep) has turned off his lazy Christmas mode :smiley:
|
||||
|
||||
This is a full makeover of the layout selection logic with full custom `layout` and `type` support (many have asked for this). Also, Hugo now respects the `url` value in front matter for all page types, including sections. Also, you can now configure `uglyURLs` per section.
|
||||
|
||||
But this release is also a follow-up to the `0.32` release which was all about bundles with resources and powerful image processing. With this release it is now simple to add metadata to your images and other bundle resources.
|
||||
|
||||
[@bep](https://github.com/bep) has added a section with examples of both `resources` configuration in both `YAML` and `TOML` front matter in his [test site](http://hugotest.bep.is/resourcemeta/). The example below shows a sample of how it would look like in `YAML`:
|
||||
|
||||
```yaml
|
||||
date: 2017-01-17
|
||||
title: My Bundle With YAML Resource Metadata
|
||||
resources:
|
||||
- src: "image-4.png"
|
||||
title: "The Fourth Image"
|
||||
- src: "*.png"
|
||||
name: "my-cool-image-:counter"
|
||||
title: "The Image #:counter"
|
||||
params:
|
||||
byline: "bep"
|
||||
```
|
||||
|
||||
This release represents **41 contributions by 3 contributors** to the main Hugo code base.
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 22553+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 197+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
## Notes
|
||||
* We have re-implemented and unified the template layout lookup logic. This has made it more powerful and much simpler to understand. We don't expect any sites to break because of this. We have tested lots of Hugo sites, including the 200 [themes](http://themes.gohugo.io/).
|
||||
* The `indexes` type is removed from template lookup. It's not in the documentation, and is a legacy term inherited from very old Hugo versions.
|
||||
* If you have sub-dirs in your shiny new bundles (e.g. `my-bundle/images`) and use the `*Prefix*` methods to find them, we have made an unintended change that affects you. See [this issue](https://github.com/gohugoio/hugo/issues/4295).
|
||||
|
||||
## Enhancements
|
||||
|
||||
### Templates
|
||||
|
||||
* Respect `Type` and `Layout` for list template selection [51dd462c](https://github.com/gohugoio/hugo/commit/51dd462c3958f7cf032b06503f1f200a6aceebb9) [@bep](https://github.com/bep) [#3005](https://github.com/gohugoio/hugo/issues/3005)[#3245](https://github.com/gohugoio/hugo/issues/3245)
|
||||
|
||||
### Core
|
||||
|
||||
* Allow `url` in front matter for list type pages [8a409894](https://github.com/gohugoio/hugo/commit/8a409894bdb0972e152a2eccc47a2738568e1cfc) [@bep](https://github.com/bep) [#4263](https://github.com/gohugoio/hugo/issues/4263)
|
||||
* Improve `.Site.GetPage` for regular translated pages. Before this change it was not possible to say "get me the current language edition of the given content page if possible." Now you can do that by doing a lookup without any extensions: `.Site.GetPage "page" "post/mypost"` [9409bc0f](https://github.com/gohugoio/hugo/commit/9409bc0f799a8057836a14ccdf2833a55902175e) [@bep](https://github.com/bep) [#4285](https://github.com/gohugoio/hugo/issues/4285)
|
||||
* Add front matter metadata to `Resource` [20c9b6ec](https://github.com/gohugoio/hugo/commit/20c9b6ec81171d1c586ea31d5d08b40b0edaffc6) [@bep](https://github.com/bep) [#4244](https://github.com/gohugoio/hugo/issues/4244)
|
||||
* Implement `Resources.ByPrefix` [46db900d](https://github.com/gohugoio/hugo/commit/46db900dab9c0e6fcd9d227f10a32fb24f5c8bd9) [@bep](https://github.com/bep) [#4266](https://github.com/gohugoio/hugo/issues/4266)
|
||||
* Make `GetByPrefix` work for Page resources [60c9f3b1](https://github.com/gohugoio/hugo/commit/60c9f3b1c34b69771e25a66906f150f460d73223) [@bep](https://github.com/bep) [#4264](https://github.com/gohugoio/hugo/issues/4264)
|
||||
* Make `Resources.GetByPrefix` case insensitive [db85e834](https://github.com/gohugoio/hugo/commit/db85e83403913cff4b8737b138932b28e5bf6160) [@bep](https://github.com/bep) [#4258](https://github.com/gohugoio/hugo/issues/4258)
|
||||
* Update `Chroma` and other third-party deps [64f0e9d1](https://github.com/gohugoio/hugo/commit/64f0e9d1c1d4ff2249fd9cf9749e70485002b36d) [@bep](https://github.com/bep) [#4267](https://github.com/gohugoio/hugo/issues/4267)
|
||||
* Remove superflous `BuildDate` logic [13d53b31](https://github.com/gohugoio/hugo/commit/13d53b31f19240879122d6b7e4aaeb60b5130a3c) [@bep](https://github.com/bep) [#4272](https://github.com/gohugoio/hugo/issues/4272)
|
||||
* Run benchmarks 3 times [b6ea6d07](https://github.com/gohugoio/hugo/commit/b6ea6d07d0b072d850fb066c78976acd6c2f5e81) [@bep](https://github.com/bep)
|
||||
* Support `uglyURLs` per section [57e10f17](https://github.com/gohugoio/hugo/commit/57e10f174e51cc5e1cf5f37eed30a0f3b153dd64) [@bep](https://github.com/bep) [#4256](https://github.com/gohugoio/hugo/issues/4256)
|
||||
* Update CONTRIBUTING.md [1046e936](https://github.com/gohugoio/hugo/commit/1046e9363f2e382fd0b4aac838735ae4cbbebe5a) [@vassudanagunta](https://github.com/vassudanagunta)
|
||||
* Support offline builds [d5803da1](https://github.com/gohugoio/hugo/commit/d5803da1befba5446d1b2c1ad16f6467dc7b3991) [@vassudanagunta](https://github.com/vassudanagunta)
|
||||
|
||||
## Fixes
|
||||
|
||||
* Fix handling of mixed-case taxonomy folders with content file [2d3189b2](https://github.com/gohugoio/hugo/commit/2d3189b22760e0a8995dae082a6bc5480f770bfe) [@bep](https://github.com/bep) [#4238](https://github.com/gohugoio/hugo/issues/4238)
|
||||
* Fix handling of very long image file names [ecaf1451](https://github.com/gohugoio/hugo/commit/ecaf14514e06321823bdd10235cf23e7d654ba77) [@bep](https://github.com/bep) [#4261](https://github.com/gohugoio/hugo/issues/4261)
|
||||
* Update `Afero` to avoid panic on "file name is too long" [f8a119b6](https://github.com/gohugoio/hugo/commit/f8a119b606d55aa4f31f16e5a3cadc929c99e4f8) [@bep](https://github.com/bep) [#4240](https://github.com/gohugoio/hugo/issues/4240)
|
||||
* And now really fix the server watch logic [d4f8f88e](https://github.com/gohugoio/hugo/commit/d4f8f88e67f958b8010f90cb9b9854114e52dac2) [@bep](https://github.com/bep) [#4275](https://github.com/gohugoio/hugo/issues/4275)
|
||||
* Fix server without watch [4e524ffc](https://github.com/gohugoio/hugo/commit/4e524ffcfff48c017717e261c6067416aa56410f) [@bep](https://github.com/bep) [#4275](https://github.com/gohugoio/hugo/issues/4275)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
@@ -0,0 +1,44 @@
|
||||
|
||||
---
|
||||
date: 2018-01-22
|
||||
title: "Hugo 0.34: Pattern matching to filter images and other resources"
|
||||
description: "Hugo 0.34 adds full glob with super-asterisk support, for example `*.jpg`."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
Hugo `0.34` is a small release. It contains a few smaller bug-fixes, but more important is an overhaul of the API used to find images and other resources in your page bundles.
|
||||
|
||||
We have added two simple methods on the `Resources` object:
|
||||
|
||||
* `.Match` finds every resource matching a pattern. Examples: `.Match "images/*.jpg"` finds every JPEG image in `images` and `.Match "**.jpg"` finds every JPEG image in the bundle.
|
||||
* `.GetMatch` finds the first resource matching the pattern given.
|
||||
|
||||
**Note: The path separators used are Unix-style forward slashes, even on Windows.**
|
||||
|
||||
It uses [standard wildcard syntax](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm) with the addition of the `**`, aka super-asterisk, which matches across path boundaries.
|
||||
|
||||
Thanks to [@gobwas](https://github.com/gobwas/glob) for a fast and easy-to-use Glob library.
|
||||
|
||||
This release represents **5 contributions by 1 contributors** to the main Hugo code base.
|
||||
|
||||
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
|
||||
which has received **25 contributions by 16 contributors**. A special thanks to [@bep](https://github.com/bep), [@rmetzler](https://github.com/rmetzler), [@chris-rudmin](https://github.com/chris-rudmin), and [@stkevintan](https://github.com/stkevintan) for their work on the documentation site.
|
||||
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 22689+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 197+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
## Notes
|
||||
* `Resources.GetByPrefix` and `Resources.ByPrefix` are depracated. They still work, but will eventually be removed. Use `Resources.Match` (many) and `Resources.GetMatch` (one).
|
||||
* When filtering bundles pages in sub-folders, you need to include the sub-folder when matching. This was a bug introduced in `0.33` and gets it in line with images and other resources.
|
||||
|
||||
## Enhancements
|
||||
|
||||
* Add `Resources.Match` and `Resources.GetMatch` [94213801](https://github.com/gohugoio/hugo/commit/9421380168f66620cb73203e1267814b3086d805) [@bep](https://github.com/bep) [#4301](https://github.com/gohugoio/hugo/issues/4301)
|
||||
|
||||
## Fixes
|
||||
* Add validation for `defaultContentLanguage` [4d5e4f37](https://github.com/gohugoio/hugo/commit/4d5e4f379a890a3c6cbc11ddb40d77a90f14c015) [@bep](https://github.com/bep) [#4298](https://github.com/gohugoio/hugo/issues/4298)
|
||||
* Fix lookup of pages bundled in sub-folders in `ByPrefix` etc. [5d030869](https://github.com/gohugoio/hugo/commit/5d03086981b4a7d4bc450269a6a2e0fd22dbeed7) [@bep](https://github.com/bep) [#4295](https://github.com/gohugoio/hugo/issues/4295)
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
---
|
||||
date: 2018-01-31
|
||||
title: "0.35"
|
||||
description: "0.35"
|
||||
slug: "0.35"
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
The most notable new feature in Hugo `0.35` is perhaps **Headless Bundles**.
|
||||
|
||||
This means that you in your `index.md` front matter can say:
|
||||
|
||||
```yaml
|
||||
headless: true
|
||||
```
|
||||
And
|
||||
* it will have no `Permalink` and no rendered HTML in `/public`
|
||||
* it will not be part of `.Site.RegularPages` etc.
|
||||
|
||||
But you can get it by:
|
||||
|
||||
* `.Site.GetPage ...`
|
||||
|
||||
The use cases are many:
|
||||
|
||||
* Shared media libraries
|
||||
* Reusable page content "snippets"
|
||||
* ...
|
||||
|
||||
But this release contains more goodies than possible to sum up in one paragraph, so study the release notes carefully. It represents **42 contributions by 8 contributors** to the main Hugo code base.
|
||||
|
||||
[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@vassudanagunta](https://github.com/vassudanagunta), [@yanzay](https://github.com/yanzay), and [@robertbasic](https://github.com/robertbasic) for their ongoing contributions.
|
||||
|
||||
And as always a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the documentation and the themes site in pristine condition.
|
||||
|
||||
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
|
||||
which has received **28 contributions by 5 contributors**. A special thanks to [@bep](https://github.com/bep), [@kaushalmodi](https://github.com/kaushalmodi), [@regisphilibert](https://github.com/regisphilibert), and [@salim-b](https://github.com/salim-b) for their work on the documentation site.
|
||||
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 22967+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 197+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
* Deprecate `useModTimeAsFallback` [adfd4370](https://github.com/gohugoio/hugo/commit/adfd4370b67fd7181178bd6b3b1d07356beaac71) [@bep](https://github.com/bep) [#4351](https://github.com/gohugoio/hugo/issues/4351)
|
||||
* Deprecate CLI flags `canonifyURLs`, `pluralizeListTitles`, `preserveTaxonomyNames`, `uglyURLs` [f08ea02d](https://github.com/gohugoio/hugo/commit/f08ea02d24d42929676756950f3affaca7fd8c01) [@bep](https://github.com/bep) [#4347](https://github.com/gohugoio/hugo/issues/4347)
|
||||
* Remove undraft command [2fa70c93](https://github.com/gohugoio/hugo/commit/2fa70c9344b231c9d999bbafdfa4acbf27ed9f6e) [@robertbasic](https://github.com/robertbasic) [#4353](https://github.com/gohugoio/hugo/issues/4353)
|
||||
|
||||
## Enhancements
|
||||
|
||||
### Templates
|
||||
|
||||
* Update Twitter card to also consider images in `.Resources` [25d691da](https://github.com/gohugoio/hugo/commit/25d691daff57d7c6d7d0f63af3991d22e3f788fe) [@bep](https://github.com/bep) [#4349](https://github.com/gohugoio/hugo/issues/4349)
|
||||
* Seed random on init only [83c761b7](https://github.com/gohugoio/hugo/commit/83c761b71a980aee6331179b271c7e24e999e8eb) [@liguoqinjim](https://github.com/liguoqinjim)
|
||||
* Remove duplicate layout lookup layouts [b2fcbb1f](https://github.com/gohugoio/hugo/commit/b2fcbb1f9774aa1e929b8575c0e1ac366ab2fb73) [@bep](https://github.com/bep) [#4319](https://github.com/gohugoio/hugo/issues/4319)
|
||||
* Add "removable-media" interface to `snapcraft.yaml` [f0c0ece4](https://github.com/gohugoio/hugo/commit/f0c0ece44d55b6c2997cbd106d1bc099ea1a2fa7) [@anthonyfok](https://github.com/anthonyfok) [#3837](https://github.com/gohugoio/hugo/issues/3837)
|
||||
|
||||
### Other
|
||||
|
||||
* Add a way to disable one or more languages [6413559f](https://github.com/gohugoio/hugo/commit/6413559f7575e2653d76227a8037a7edbaae82aa) [@bep](https://github.com/bep) [#4297](https://github.com/gohugoio/hugo/issues/4297)[#4329](https://github.com/gohugoio/hugo/issues/4329)
|
||||
* Handle newly created files in Fast Render Mode [1707dae8](https://github.com/gohugoio/hugo/commit/1707dae8d3634006017eb6d040df4dbafc53d92f) [@yanzay](https://github.com/yanzay) [#4339](https://github.com/gohugoio/hugo/issues/4339)
|
||||
* Extract the Fast Render Mode logic into a method [94e736c5](https://github.com/gohugoio/hugo/commit/94e736c5e167a0ee70a528e1c19d64a47e7929c2) [@bep](https://github.com/bep) [#4339](https://github.com/gohugoio/hugo/issues/4339)
|
||||
* Remove unused code [ae5a45be](https://github.com/gohugoio/hugo/commit/ae5a45be6f0ee4d5c52b38fd28b22b55d9cd7b2d) [@bep](https://github.com/bep)
|
||||
* Add the last lookup variant for the `GetPage` index [3446fe9b](https://github.com/gohugoio/hugo/commit/3446fe9b8937610b8b628b2c212eb25888a7c1bb) [@bep](https://github.com/bep) [#4312](https://github.com/gohugoio/hugo/issues/4312)
|
||||
* Simplify bundle lookup via `.Site.GetPage`, `ref`, `relref` [517b6b62](https://github.com/gohugoio/hugo/commit/517b6b62389d23bfe41fe3ae551a691b11bdcaa7) [@bep](https://github.com/bep) [#4312](https://github.com/gohugoio/hugo/issues/4312)
|
||||
* Remove some now superflous Fast Render Mode code [feeed073](https://github.com/gohugoio/hugo/commit/feeed073c3320b09fb38168ce272ac88b987f1d2) [@bep](https://github.com/bep) [#4339](https://github.com/gohugoio/hugo/issues/4339)
|
||||
* Make resource counters for `name` and `title` independent [df20b054](https://github.com/gohugoio/hugo/commit/df20b05463fef42aba93d5208e410a7ecc56da5d) [@bep](https://github.com/bep) [#4335](https://github.com/gohugoio/hugo/issues/4335)
|
||||
* Provide .Name to the archetype templates [863a812e](https://github.com/gohugoio/hugo/commit/863a812e07193541b42732b0e227f3d320433f01) [@bep](https://github.com/bep) [#4348](https://github.com/gohugoio/hugo/issues/4348)
|
||||
* Only set `url` if permalink in metadata and remove duplicate confirm msg [3752348e](https://github.com/gohugoio/hugo/commit/3752348ef13ced8f6f528b42ee7d76a12a97ae5c) [@lildude](https://github.com/lildude) [#1887](https://github.com/gohugoio/hugo/issues/1887)
|
||||
* Start Resources :counter first time they're used [7b472e46](https://github.com/gohugoio/hugo/commit/7b472e46084b603045b87cea870ffc73ac1cf7e7) [@bep](https://github.com/bep) [#4335](https://github.com/gohugoio/hugo/issues/4335)
|
||||
* Update to Go 1.9.3 [a91aba1c](https://github.com/gohugoio/hugo/commit/a91aba1c1562259dffd321a608f38c38dd4d5aeb) [@bep](https://github.com/bep) [#4328](https://github.com/gohugoio/hugo/issues/4328)
|
||||
* Support pages without front matter [91bb774a](https://github.com/gohugoio/hugo/commit/91bb774ae4e129f7ed0624754b31479c960ef774) [@vassudanagunta](https://github.com/vassudanagunta) [#4320](https://github.com/gohugoio/hugo/issues/4320)[#4320](https://github.com/gohugoio/hugo/issues/4320)
|
||||
* Add page metadata dates tests [3f0379ad](https://github.com/gohugoio/hugo/commit/3f0379adb72389954ca2be6a9f2ebfcd65c6c440) [@vassudanagunta](https://github.com/vassudanagunta)
|
||||
* Re-generate CLI docs [1e27d058](https://github.com/gohugoio/hugo/commit/1e27d0589118a114e49c032e4bd68b4798e44a5b) [@bep](https://github.com/bep)
|
||||
* Remove and update deprecation status [d418c2c2](https://github.com/gohugoio/hugo/commit/d418c2c2eacdc1dc6fffe839e0a90600867878ca) [@bep](https://github.com/bep)
|
||||
* Shorten the stale setup [4a7c2b36](https://github.com/gohugoio/hugo/commit/4a7c2b3695fe7b88861f2155ea7ef635fe425cd4) [@bep](https://github.com/bep)
|
||||
* Add a `GetPage` to the site benchmarks [a1956391](https://github.com/gohugoio/hugo/commit/a19563910eec5fed08f3b02563b9a7b38026183d) [@bep](https://github.com/bep)
|
||||
* Add headless bundle support [0432c64d](https://github.com/gohugoio/hugo/commit/0432c64dd22e4610302162678bb93661ba68d758) [@bep](https://github.com/bep) [#4311](https://github.com/gohugoio/hugo/issues/4311)
|
||||
* Merge matching resources params maps [5a0819b9](https://github.com/gohugoio/hugo/commit/5a0819b9b5eb9e79826cfa0a65f235d9821b1ac4) [@bep](https://github.com/bep) [#4315](https://github.com/gohugoio/hugo/issues/4315)
|
||||
* Add some general code contribution criterias [78c86330](https://github.com/gohugoio/hugo/commit/78c863305f337ed4faf3cf0a23675f28b0ae5641) [@bep](https://github.com/bep)
|
||||
* Tighten page kind logic, introduce tests [8125b4b0](https://github.com/gohugoio/hugo/commit/8125b4b03d10eb73f8aea3f9ea41172aba8df082) [@vassudanagunta](https://github.com/vassudanagunta)
|
||||
|
||||
## Fixes
|
||||
* Fix `robots.txt` in multihost mode [4d912e2a](https://github.com/gohugoio/hugo/commit/4d912e2aad39bfe8d76672cf53b01317792e02c5) [@bep](https://github.com/bep) [#4193](https://github.com/gohugoio/hugo/issues/4193)
|
||||
* Fix `--uglyURLs` from comand line regression [016398ff](https://github.com/gohugoio/hugo/commit/016398ffe2e0a073453cf46a9d6bf72d693c11e5) [@bep](https://github.com/bep) [#4343](https://github.com/gohugoio/hugo/issues/4343)
|
||||
* Avoid unescape in `highlight` [ebdd8cba](https://github.com/gohugoio/hugo/commit/ebdd8cba3f5965a8ac897833f313d772271de649) [@bep](https://github.com/bep) [#4219](https://github.com/gohugoio/hugo/issues/4219)
|
||||
* Fix Docker build [a34213f0](https://github.com/gohugoio/hugo/commit/a34213f0b5624de101272aab469ca9b6fe0c273f) [@skoblenick](https://github.com/skoblenick) [#4076](https://github.com/gohugoio/hugo/issues/4076)[#4077](https://github.com/gohugoio/hugo/issues/4077)
|
||||
* Fix language params handling [ae742cb1](https://github.com/gohugoio/hugo/commit/ae742cb1bdf35b81aa0ede5453da6b0c4a4fccf2) [@bep](https://github.com/bep) [#4356](https://github.com/gohugoio/hugo/issues/4356)[#4352](https://github.com/gohugoio/hugo/issues/4352)
|
||||
* Fix handling of top-level page bundles [4eb2fec6](https://github.com/gohugoio/hugo/commit/4eb2fec67c3a72a3ac98aa834dc56fd4504626d8) [@bep](https://github.com/bep) [#4332](https://github.com/gohugoio/hugo/issues/4332)
|
||||
* Fix `baseURL` server regression for multilingual sites [ed4a00e4](https://github.com/gohugoio/hugo/commit/ed4a00e46f2344320a22f07febe5aec4075cb3fb) [@bep](https://github.com/bep) [#4333](https://github.com/gohugoio/hugo/issues/4333)
|
||||
* Fix "date" page param [322c5672](https://github.com/gohugoio/hugo/commit/322c567220aa4123a5d707629c1bebd375599912) [@vassudanagunta](https://github.com/vassudanagunta) [#4323](https://github.com/gohugoio/hugo/issues/4323)
|
||||
* Fix typo in comment [912147ab](https://github.com/gohugoio/hugo/commit/912147ab896e69a450b7100c3d6bf81a7bf78b5a) [@yanzay](https://github.com/yanzay)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user