mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-01 11:12:37 +00:00
Compare commits
161 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 288723a049 | |||
| f4b416bbef | |||
| 058f25146c | |||
| 3dd7e8b7a7 | |||
| 14786c4d8f | |||
| 30c0d485ea | |||
| 089fe49309 | |||
| 118b83d74b | |||
| adbd5bc47f | |||
| c1d325934e | |||
| d99db71ab5 | |||
| 503ca6de6c | |||
| b3daa1f4bf | |||
| df1677a6e8 | |||
| 05e42bc643 | |||
| 0a81a6b4ba | |||
| 60dfb9a6e0 | |||
| 2e0465764b | |||
| 6233ddf9d1 | |||
| e66d813bcb | |||
| f5ed04bd4a | |||
| 7730d683e8 | |||
| bb048d811d | |||
| 9299a16c99 | |||
| a9be687b81 | |||
| b32ffed6ab | |||
| 77cbd001ff | |||
| 764f1304e1 | |||
| d9a78b61ad | |||
| 23ba779fab | |||
| 550cec0b1f | |||
| b88a105a7c | |||
| b3443b3d0c | |||
| c97216e4f0 | |||
| bb04010cbf | |||
| 76dc811c65 | |||
| 488631fe0a | |||
| fdd62eb4c3 | |||
| b6f2e3b438 | |||
| c61998d3ac | |||
| 45ad8ac381 | |||
| 133cfd1710 | |||
| db1a5af15d | |||
| 9ccc958ce7 | |||
| 30e471b8c6 | |||
| f711b170e4 | |||
| 9536f7cd05 | |||
| 1ac47cd88a | |||
| ba0b22ef44 | |||
| c9c19d7945 | |||
| 1d52bfbb47 | |||
| 142ebba2c5 | |||
| bf633ea2f2 | |||
| 6faf47e8dd | |||
| 7954bc0f0f | |||
| c4bf03a558 | |||
| 3164103310 | |||
| 6a5170116c | |||
| 325009c3fd | |||
| bc53cd7b15 | |||
| 4e07b4144f | |||
| 89a3f47a21 | |||
| 35be07f7c8 | |||
| 6f84570d8f | |||
| 8964162573 | |||
| e939aaed8b | |||
| d2b3f00df7 | |||
| fa53b13ca0 | |||
| c3c10f2c7c | |||
| ad5ef43838 | |||
| 5109ed520f | |||
| 45e0908b86 | |||
| 41180c51e1 | |||
| 811f381e23 | |||
| 7d783a1c0e | |||
| 49d5e7da42 | |||
| 190508ae1e | |||
| 04bdb596ad | |||
| fe71cb6f5f | |||
| 68ace43431 | |||
| ecf5e081b5 | |||
| 5c31e0c341 | |||
| 7c30e2cbb0 | |||
| 60bd332c1f | |||
| 6a30874f19 | |||
| 15ec031d98 | |||
| 01e54609e7 | |||
| 5800a20a25 | |||
| e2e8bcbec3 | |||
| 66a169a249 | |||
| 2cc4765670 | |||
| 856fc445da | |||
| a6ed645a34 | |||
| 23488f874c | |||
| 8d2580f07c | |||
| 06e5633400 | |||
| dae5a7c61c | |||
| a58741a172 | |||
| d32fd8e328 | |||
| 0859d9dfe6 | |||
| 384a6ac4bd | |||
| 4fc67fe44a | |||
| 47fdfd5196 | |||
| d45e358a05 | |||
| 24fab99841 | |||
| 6a986b7c07 | |||
| 8cf55aff00 | |||
| 8717a60cc0 | |||
| 2818878994 | |||
| b6a30283f0 | |||
| 9d68f695e7 | |||
| 57adc539fc | |||
| b277cb33e4 | |||
| a354d130dc | |||
| f806e951fd | |||
| 524c67107a | |||
| 396759a09b | |||
| e6079a9c04 | |||
| b5e1dc5892 | |||
| d3681f51c0 | |||
| 4f576e1c08 | |||
| b4a14c25fe | |||
| cb8eb47260 | |||
| e94d4f0177 | |||
| 8a69d23567 | |||
| d9697e275e | |||
| 09d960f173 | |||
| a3a3f5b861 | |||
| 404e2994e5 | |||
| 2a7f6dda12 | |||
| 9e850c1f64 | |||
| ab86851a1e | |||
| 53b6235bb4 | |||
| 61c27b58b3 | |||
| 932ae52709 | |||
| 30694a133a | |||
| 23ba0edf71 | |||
| fb33d8286d | |||
| 81ed564793 | |||
| 19c5910485 | |||
| 80c7ea60a0 | |||
| 0d29a0f781 | |||
| b8fabce217 | |||
| b180477631 | |||
| c31e083ead | |||
| 9436f0b0c3 | |||
| 7a89dce53b | |||
| f8fd5796bb | |||
| 173b544982 | |||
| df411ec81a | |||
| 0b34af2161 | |||
| c0370e0ee3 | |||
| ba45da9d03 | |||
| 5c3b210368 | |||
| 5a4002bc89 | |||
| 18126434f1 | |||
| dda269f175 | |||
| 2d613dd905 | |||
| 642ba6cab2 | |||
| d1d6aa6340 | |||
| 0375cbd025 |
@@ -1,7 +1,7 @@
|
||||
defaults: &defaults
|
||||
working_directory: /go/src/github.com/gohugoio
|
||||
docker:
|
||||
- image: bepsays/ci-goreleaser:0.30.5-2
|
||||
- image: bepsays/ci-goreleaser:0.34.2-6
|
||||
|
||||
version: 2
|
||||
jobs:
|
||||
@@ -12,10 +12,11 @@ jobs:
|
||||
path: hugo
|
||||
- run:
|
||||
command: |
|
||||
go get -d github.com/magefile/mage/...
|
||||
git clone git@github.com:gohugoio/hugoDocs.git
|
||||
cd hugo
|
||||
make vendor
|
||||
make check
|
||||
mage vendor
|
||||
mage check
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: .
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"ArtifactsDest": "GoBuilds/",
|
||||
"OutPath": "{{.Dest}}{{.PS}}{{.AppName}}{{.PS}}{{.Version}}{{.PS}}{{.AppName}}_{{.Version}}_{{.Os}}_{{.Arch}}{{.Ext}}",
|
||||
"BuildConstraints": "linux windows darwin freebsd netbsd openbsd dragonfly",
|
||||
"ConfigVersion": "0.9"
|
||||
}
|
||||
+6
-4
@@ -2,8 +2,8 @@ language: go
|
||||
sudo: required
|
||||
dist: precise
|
||||
go:
|
||||
- 1.8.3
|
||||
- 1.9
|
||||
- 1.8.5
|
||||
- 1.9.2
|
||||
- tip
|
||||
os:
|
||||
- linux
|
||||
@@ -13,9 +13,11 @@ matrix:
|
||||
- go: tip
|
||||
fast_finish: true
|
||||
install:
|
||||
- make vendor
|
||||
- go get github.com/magefile/mage
|
||||
- mage vendor
|
||||
script:
|
||||
- make hugo-race check
|
||||
- mage hugoRace
|
||||
- mage -v check
|
||||
- ./hugo -s docs/
|
||||
- ./hugo --renderToMemory -s docs/
|
||||
before_install:
|
||||
|
||||
+23
-15
@@ -57,7 +57,7 @@ To make the contribution process as seamless as possible, we ask for the followi
|
||||
* Run `go fmt`.
|
||||
* Add documentation if you are adding new features or changing functionality. The docs site lives in `/docs`.
|
||||
* Squash your commits into a single commit. `git rebase -i`. It’s okay to force update your pull request with `git push -f`.
|
||||
* Ensure that `make check` succeeds. [Travis CI](https://travis-ci.org/gohugoio/hugo) (Linux and macOS) and [AppVeyor](https://ci.appveyor.com/project/gohugoio/hugo/branch/master) (Windows) will fail the build if `make check` fails.
|
||||
* Ensure that `mage check` succeeds. [Travis CI](https://travis-ci.org/gohugoio/hugo) (Linux and macOS) and [AppVeyor](https://ci.appveyor.com/project/gohugoio/hugo/branch/master) (Windows) will fail the build if `mage check` fails.
|
||||
* Follow the **Git Commit Message Guidelines** below.
|
||||
|
||||
### Git Commit Message Guidelines
|
||||
@@ -90,29 +90,29 @@ Fixes #1949
|
||||
|
||||
### Vendored Dependencies
|
||||
|
||||
Hugo uses [govendor](https://github.com/kardianos/govendor) to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository.
|
||||
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 govendor** to fetch and manage Hugo's dependencies.
|
||||
|
||||
### Fetch the Sources From GitHub
|
||||
You **must use Go Dep** to fetch and manage Hugo's dependencies.
|
||||
|
||||
```
|
||||
go get -u github.com/kardianos/govendor
|
||||
govendor get github.com/gohugoio/hugo
|
||||
```
|
||||
|
||||
### Using Git Remotes
|
||||
### Fetch 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. Fetch the Hugo sources as described above.
|
||||
1. Install Go Dep and get the Hugo source:
|
||||
|
||||
1. Change to the Hugo source directory:
|
||||
```
|
||||
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:
|
||||
|
||||
```
|
||||
cd $HOME/go/src/github.com/gohugoio/hugo
|
||||
dep ensure
|
||||
```
|
||||
|
||||
1. Create a new branch for your changes (the branch name is arbitrary):
|
||||
@@ -145,11 +145,19 @@ started:
|
||||
|
||||
### Build 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
|
||||
|
||||
```bash
|
||||
cd $HOME/go/src/github.com/gohugoio/hugo
|
||||
make hugo
|
||||
mage hugo
|
||||
# or to install in $HOME/go/bin:
|
||||
make install
|
||||
mage install
|
||||
```
|
||||
|
||||
### Updating the Hugo Sources
|
||||
@@ -160,6 +168,6 @@ well.
|
||||
|
||||
```
|
||||
git pull
|
||||
make vendor
|
||||
mage vendor
|
||||
```
|
||||
|
||||
|
||||
+12
-23
@@ -1,30 +1,19 @@
|
||||
FROM golang:1.9.0-alpine3.6 AS build
|
||||
|
||||
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 go install -ldflags '-s -w'
|
||||
|
||||
FROM alpine:3.6
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV PATH $GOPATH/bin:$PATH
|
||||
|
||||
RUN \
|
||||
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
|
||||
apk add --no-cache \
|
||||
dumb-init && \
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
gcc \
|
||||
musl-dev \
|
||||
go \
|
||||
git && \
|
||||
mkdir -p \
|
||||
${GOPATH}/bin \
|
||||
${GOPATH}/pkg \
|
||||
${GOPATH}/src && \
|
||||
go get github.com/kardianos/govendor && \
|
||||
govendor get github.com/gohugoio/hugo && \
|
||||
cd $GOPATH/src/github.com/gohugoio/hugo && \
|
||||
rm -f $GOPATH/bin/hugo && \
|
||||
go install -ldflags '-s -w' && \
|
||||
cd $GOPATH && \
|
||||
rm -rf pkg src .cache bin/govendor && \
|
||||
apk del .build-deps
|
||||
|
||||
dumb-init
|
||||
COPY --from=build /go/bin/hugo /bin/hugo
|
||||
USER hugo
|
||||
WORKDIR /site
|
||||
VOLUME /site
|
||||
|
||||
Generated
+290
@@ -0,0 +1,290 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/BurntSushi/toml"
|
||||
packages = ["."]
|
||||
revision = "a368813c5e648fee92e5f6c30e3944ff9d5e8895"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/PuerkitoBio/purell"
|
||||
packages = ["."]
|
||||
revision = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/PuerkitoBio/urlesc"
|
||||
packages = ["."]
|
||||
revision = "de5bf2ad457846296e2031421a34e2568e304e35"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/alecthomas/chroma"
|
||||
packages = [".","formatters","formatters/html","lexers","styles"]
|
||||
revision = "9c81d25368bedda10b71f4cde071d6bae7312008"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/bep/gitmap"
|
||||
packages = ["."]
|
||||
revision = "de8030ebafb76c6e84d50ee6d143382637c00598"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/chaseadamsio/goorgeous"
|
||||
packages = ["."]
|
||||
revision = "7daffad08e0d467847663af3655dcc4cbcda48e8"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/cpuguy83/go-md2man"
|
||||
packages = ["md2man"]
|
||||
revision = "1d903dcb749992f3741d744c0f8376b4bd7eb3e1"
|
||||
version = "v1.0.7"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/danwakefield/fnmatch"
|
||||
packages = ["."]
|
||||
revision = "cbb64ac3d964b81592e64f957ad53df015803288"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/dchest/cssmin"
|
||||
packages = ["."]
|
||||
revision = "fb8d9b44afdc258bfff6052d3667521babcb2239"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/dlclark/regexp2"
|
||||
packages = [".","syntax"]
|
||||
revision = "487489b64fb796de2e55f4e8a4ad1e145f80e957"
|
||||
version = "v1.1.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/eknkc/amber"
|
||||
packages = [".","parser"]
|
||||
revision = "cdade1c073850f4ffc70a829e31235ea6892853b"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/fortytw2/leaktest"
|
||||
packages = ["."]
|
||||
revision = "7dad53304f9614c1c365755c1176a8e876fee3e8"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/fsnotify/fsnotify"
|
||||
packages = ["."]
|
||||
revision = "629574ca2a5df945712d3079857300b5e4da0236"
|
||||
version = "v1.4.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gorilla/websocket"
|
||||
packages = ["."]
|
||||
revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/go-immutable-radix"
|
||||
packages = ["."]
|
||||
revision = "8aac2701530899b64bdea735a1de8da899815220"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/golang-lru"
|
||||
packages = ["simplelru"]
|
||||
revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/hcl"
|
||||
packages = [".","hcl/ast","hcl/parser","hcl/scanner","hcl/strconv","hcl/token","json/parser","json/scanner","json/token"]
|
||||
revision = "23c074d0eceb2b8a5bfdbb271ab780cde70f05a8"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/inconshreveable/mousetrap"
|
||||
packages = ["."]
|
||||
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||
version = "v1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/jdkato/prose"
|
||||
packages = ["internal/util","transform"]
|
||||
revision = "20d3663d4bc9dd10d75abcde9d92e04b4861c674"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/kardianos/osext"
|
||||
packages = ["."]
|
||||
revision = "ae77be60afb1dcacde03767a8c37337fad28ac14"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/kyokomi/emoji"
|
||||
packages = ["."]
|
||||
revision = "7e06b236c489543f53868841f188a294e3383eab"
|
||||
version = "v1.5"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/magefile/mage"
|
||||
packages = ["mg","sh"]
|
||||
revision = "2f974307b636f59c13b88704cf350a4772fef271"
|
||||
version = "v1.0.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/magiconair/properties"
|
||||
packages = ["."]
|
||||
revision = "be5ece7dd465ab0765a9682137865547526d1dfb"
|
||||
version = "v1.7.3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/inflect"
|
||||
packages = ["."]
|
||||
revision = "ea17041f342f81e8849284b87bc3db1a6fc596bb"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/miekg/mmark"
|
||||
packages = ["."]
|
||||
revision = "fd2f6c1403b37925bd7fe13af05853b8ae58ee5f"
|
||||
version = "v1.3.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/mapstructure"
|
||||
packages = ["."]
|
||||
revision = "06020f85339e21b2478f756a78e295255ffa4d6a"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/nicksnyder/go-i18n"
|
||||
packages = ["i18n/bundle","i18n/language","i18n/translation"]
|
||||
revision = "0dc1626d56435e9d605a29875701721c54bc9bbd"
|
||||
version = "v1.10.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pelletier/go-toml"
|
||||
packages = ["."]
|
||||
revision = "16398bac157da96aa88f98a2df640c7f32af1da2"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/russross/blackfriday"
|
||||
packages = ["."]
|
||||
revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c"
|
||||
version = "v1.5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/sanitized_anchor_name"
|
||||
packages = ["."]
|
||||
revision = "86672fcb3f950f35f2e675df2240550f2a50762f"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/afero"
|
||||
packages = [".","mem"]
|
||||
revision = "8d919cbe7e2627e417f3e45c3c0e489a5b7e2536"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/cast"
|
||||
packages = ["."]
|
||||
revision = "acbeb36b902d72a7a4c18e8f3241075e7ab763e4"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/cobra"
|
||||
packages = [".","doc"]
|
||||
revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/fsync"
|
||||
packages = ["."]
|
||||
revision = "12a01e648f05a938100a26858d2d59a120307a18"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/jwalterweatherman"
|
||||
packages = ["."]
|
||||
revision = "12bd96e66386c1960ab0f74ced1362f66f552f7b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/nitro"
|
||||
packages = ["."]
|
||||
revision = "24d7ef30a12da0bdc5e2eb370a79c659ddccf0e8"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/pflag"
|
||||
packages = ["."]
|
||||
revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/viper"
|
||||
packages = ["."]
|
||||
revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert","require"]
|
||||
revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
|
||||
version = "v1.1.4"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/yosssi/ace"
|
||||
packages = ["."]
|
||||
revision = "ea038f4770b6746c3f8f84f14fa60d9fe1205b56"
|
||||
version = "v0.0.5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/image"
|
||||
packages = ["riff","vp8","vp8l","webp"]
|
||||
revision = "f7e31b4ea2e3413ab91b4e7d2dc83e5f8d19a44c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
packages = ["idna"]
|
||||
revision = "cd69bc3fc700721b709c3a59e16e24c67b58f6ff"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "8dbc5d05d6edcc104950cc299a1ce6641235bc86"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/text"
|
||||
packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable","width"]
|
||||
revision = "c01e4764d870b77f8abe5096ee19ad20d80e8075"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "a7cec7b1df49f84fdd4073cc70139d56c62c5fffcc7e3fcea5ca29615d4b9568"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/BurntSushi/toml"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/PuerkitoBio/purell"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/alecthomas/chroma"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/bep/gitmap"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/chaseadamsio/goorgeous"
|
||||
revision = "7daffad08e0d467847663af3655dcc4cbcda48e8"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/dchest/cssmin"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/magefile/mage"
|
||||
version = "v1"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/eknkc/amber"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/fortytw2/leaktest"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/fsnotify/fsnotify"
|
||||
version = "1.4.2"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gorilla/websocket"
|
||||
version = "1.2.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/go-immutable-radix"
|
||||
|
||||
[[constraint]]
|
||||
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"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/miekg/mmark"
|
||||
version = "1.3.6"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/mapstructure"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/nicksnyder/go-i18n"
|
||||
version = "1.10.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/russross/blackfriday"
|
||||
version = "1.5.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/afero"
|
||||
version = "1.0.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/cast"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/cobra"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/fsync"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/jwalterweatherman"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/nitro"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/pflag"
|
||||
version = "1.0.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/viper"
|
||||
version = "1.0.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/stretchr/testify"
|
||||
version = "1.1.4"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/yosssi/ace"
|
||||
version = "0.0.5"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/image"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/text"
|
||||
|
||||
[[constraint]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
@@ -1,86 +0,0 @@
|
||||
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
||||
|
||||
PACKAGE = github.com/gohugoio/hugo
|
||||
COMMIT_HASH = `git rev-parse --short HEAD 2>/dev/null`
|
||||
BUILD_DATE = `date +%FT%T%z`
|
||||
LDFLAGS = -ldflags "-X ${PACKAGE}/hugolib.CommitHash=${COMMIT_HASH} -X ${PACKAGE}/hugolib.BuildDate=${BUILD_DATE}"
|
||||
NOGI_LDFLAGS = -ldflags "-X ${PACKAGE}/hugolib.BuildDate=${BUILD_DATE}"
|
||||
|
||||
# allow user to override go executable by running as GOEXE=xxx make ... on unix-like systems
|
||||
GOEXE ?= go
|
||||
|
||||
.PHONY: vendor docker check fmt lint test test-race vet test-cover-html help
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
vendor: ## Install govendor and sync Hugo's vendored dependencies
|
||||
${GOEXE} get github.com/kardianos/govendor
|
||||
govendor sync ${PACKAGE}
|
||||
|
||||
hugo: vendor ## Build hugo binary
|
||||
${GOEXE} build ${LDFLAGS} ${PACKAGE}
|
||||
|
||||
hugo-race: vendor ## Build hugo binary with race detector enabled
|
||||
${GOEXE} build -race ${LDFLAGS} ${PACKAGE}
|
||||
|
||||
install: vendor ## Install hugo binary
|
||||
${GOEXE} install ${LDFLAGS} ${PACKAGE}
|
||||
|
||||
hugo-no-gitinfo: LDFLAGS = ${NOGI_LDFLAGS}
|
||||
hugo-no-gitinfo: vendor hugo ## Build hugo without git info
|
||||
|
||||
docker: ## Build hugo Docker container
|
||||
docker build -t hugo .
|
||||
docker rm -f hugo-build || true
|
||||
docker run --name hugo-build hugo ls /go/bin
|
||||
docker cp hugo-build:/go/bin/hugo .
|
||||
docker rm hugo-build
|
||||
|
||||
govendor: vendor # Deprecated: use "vendor" target
|
||||
get: vendor # Deprecated: use "vendor"
|
||||
gitinfo: hugo # Deprecated: use "hugo" target
|
||||
install-gitinfo: install # Deprecated: use "install" target
|
||||
no-git-info: hugo-no-gitinfo # Deprecated: use "hugo-no-gitinfo" target
|
||||
|
||||
check: test-race test386 fmt vet ## Run tests and linters
|
||||
|
||||
test386: ## Run tests in 32-bit mode
|
||||
GOARCH=386 govendor test +local
|
||||
|
||||
test: ## Run tests
|
||||
govendor test +local
|
||||
|
||||
test-race: ## Run tests with race detector
|
||||
govendor test -race +local
|
||||
|
||||
fmt: ## Run gofmt linter
|
||||
@for d in `govendor list -no-status +local | sed 's/github.com.gohugoio.hugo/./'` ; do \
|
||||
if [ "`gofmt -l $$d/*.go | tee /dev/stderr`" ]; then \
|
||||
echo "^ improperly formatted go files" && echo && exit 1; \
|
||||
fi \
|
||||
done
|
||||
|
||||
lint: ## Run golint linter
|
||||
@for d in `govendor list -no-status +local | sed 's/github.com.gohugoio.hugo/./'` ; do \
|
||||
if [ "`golint $$d | tee /dev/stderr`" ]; then \
|
||||
echo "^ golint errors!" && echo && exit 1; \
|
||||
fi \
|
||||
done
|
||||
|
||||
vet: ## Run go vet linter
|
||||
@if [ "`govendor vet +local | tee /dev/stderr`" ]; then \
|
||||
echo "^ go vet errors!" && echo && exit 1; \
|
||||
fi
|
||||
|
||||
test-cover-html: PACKAGES = $(shell govendor list -no-status +local | sed 's/github.com.gohugoio.hugo/./')
|
||||
test-cover-html: ## Generate test coverage report
|
||||
echo "mode: count" > coverage-all.out
|
||||
$(foreach pkg,$(PACKAGES),\
|
||||
govendor test -coverprofile=coverage.out -covermode=count $(pkg);\
|
||||
tail -n +2 coverage.out >> coverage-all.out;)
|
||||
${GOEXE} tool cover -html=coverage-all.out
|
||||
|
||||
check-vendor: ## Verify that vendored packages match git HEAD
|
||||
@git diff-index --quiet HEAD vendor/ || (echo "check-vendor target failed: vendored packages out of sync" && echo && git diff vendor/ && exit 1)
|
||||
|
||||
help:
|
||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
@@ -19,23 +19,22 @@ A Fast and Flexible Static Site Generator built with love by [spf13](http://spf1
|
||||
## Overview
|
||||
|
||||
Hugo is a static HTML and CSS website generator written in [Go][].
|
||||
It is optimized for speed, easy use and configurability.
|
||||
It is optimized for speed, ease of use, and configurability.
|
||||
Hugo takes a directory with content and templates and renders them into a full HTML website.
|
||||
|
||||
Hugo relies on Markdown files with front matter for meta data.
|
||||
And you can run Hugo from any directory.
|
||||
Hugo relies on Markdown files with front matter for metadata, and you can run Hugo from any directory.
|
||||
This works well for shared hosts and other systems where you don’t have a privileged account.
|
||||
|
||||
Hugo renders a typical website of moderate size in a fraction of a second.
|
||||
A good rule of thumb is that each piece of content renders in around 1 millisecond.
|
||||
|
||||
Hugo is designed to work well for any kind of website including blogs, tumbles and docs.
|
||||
Hugo is designed to work well for any kind of website including blogs, tumbles, and docs.
|
||||
|
||||
#### Supported Architectures
|
||||
|
||||
Currently, we provide pre-built Hugo binaries for Windows, Linux, FreeBSD, NetBSD and macOS (Darwin) and [Android](https://gist.github.com/bep/a0d8a26cf6b4f8bc992729b8e50b480b) for x64, i386 and ARM architectures.
|
||||
Currently, we provide pre-built Hugo binaries for Windows, Linux, FreeBSD, NetBSD, macOS (Darwin), and [Android](https://gist.github.com/bep/a0d8a26cf6b4f8bc992729b8e50b480b) for x64, i386 and ARM architectures.
|
||||
|
||||
Hugo may also be compiled from source wherever the Go compiler tool chain can run, e.g. for other operating systems including DragonFly BSD, OpenBSD, Plan 9 and Solaris.
|
||||
Hugo may also be compiled from source wherever the Go compiler tool chain can run, e.g. for other operating systems including DragonFly BSD, OpenBSD, Plan 9, and Solaris.
|
||||
|
||||
**Complete documentation is available at [Hugo Documentation][].**
|
||||
|
||||
@@ -100,6 +99,7 @@ When reporting the issue, please provide the version of Hugo in use (`hugo versi
|
||||
The Hugo project welcomes all contributors and contributions regardless of skill or experience level.
|
||||
If you are interested in helping with the project, we will help you with your contribution.
|
||||
Hugo is a very active project with many contributions happening daily.
|
||||
|
||||
Because we want to create the best possible product for our users and the best contribution experience for our developers,
|
||||
we have a set of guidelines which ensure that all contributions are acceptable.
|
||||
The guidelines are not intended as a filter or barrier to participation.
|
||||
|
||||
+3
-2
@@ -1,5 +1,4 @@
|
||||
init:
|
||||
- copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe
|
||||
- set PATH=%PATH%;C:\MinGW\bin;%GOPATH%\bin
|
||||
- go version
|
||||
- go env
|
||||
@@ -10,8 +9,10 @@ clone_folder: C:\GOPATH\src\github.com\gohugoio\hugo
|
||||
install:
|
||||
- gem install asciidoctor
|
||||
- pip install docutils
|
||||
- go get github.com/magefile/mage
|
||||
|
||||
build_script:
|
||||
- make hugo-race check
|
||||
- mage 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 -cpuprofile cpu.prof
|
||||
|
||||
+10
-2
@@ -14,6 +14,7 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/gohugoio/hugo/common/types"
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
@@ -21,7 +22,9 @@ import (
|
||||
|
||||
type commandeer struct {
|
||||
*deps.DepsCfg
|
||||
pathSpec *helpers.PathSpec
|
||||
pathSpec *helpers.PathSpec
|
||||
visitedURLs *types.EvictingStringQueue
|
||||
|
||||
configured bool
|
||||
}
|
||||
|
||||
@@ -39,6 +42,10 @@ func (c *commandeer) PathSpec() *helpers.PathSpec {
|
||||
return c.pathSpec
|
||||
}
|
||||
|
||||
func (c *commandeer) languages() helpers.Languages {
|
||||
return c.Cfg.Get("languagesSorted").(helpers.Languages)
|
||||
}
|
||||
|
||||
func (c *commandeer) initFs(fs *hugofs.Fs) error {
|
||||
c.DepsCfg.Fs = fs
|
||||
ps, err := helpers.NewPathSpec(fs, c.Cfg)
|
||||
@@ -58,5 +65,6 @@ func newCommandeer(cfg *deps.DepsCfg) (*commandeer, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &commandeer{DepsCfg: cfg, pathSpec: ps}, nil
|
||||
|
||||
return &commandeer{DepsCfg: cfg, pathSpec: ps, visitedURLs: types.NewEvictingStringQueue(10)}, nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// Copyright 2017-present 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 (
|
||||
"os"
|
||||
|
||||
"github.com/alecthomas/chroma"
|
||||
"github.com/alecthomas/chroma/formatters/html"
|
||||
"github.com/alecthomas/chroma/styles"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type genChromaStyles struct {
|
||||
style string
|
||||
highlightStyle string
|
||||
linesStyle string
|
||||
cmd *cobra.Command
|
||||
}
|
||||
|
||||
// TODO(bep) highlight
|
||||
func createGenChromaStyles() *genChromaStyles {
|
||||
g := &genChromaStyles{
|
||||
cmd: &cobra.Command{
|
||||
Use: "chromastyles",
|
||||
Short: "Generate CSS stylesheet for the Chroma code highlighter",
|
||||
Long: `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`,
|
||||
},
|
||||
}
|
||||
|
||||
g.cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return g.generate()
|
||||
}
|
||||
|
||||
g.cmd.PersistentFlags().StringVar(&g.style, "style", "friendly", "highlighter style (see https://help.farbox.com/pygments.html)")
|
||||
g.cmd.PersistentFlags().StringVar(&g.highlightStyle, "highlightStyle", "bg:#ffffcc", "style used for highlighting lines (see https://github.com/alecthomas/chroma)")
|
||||
g.cmd.PersistentFlags().StringVar(&g.linesStyle, "linesStyle", "", "style used for line numbers (see https://github.com/alecthomas/chroma)")
|
||||
|
||||
return g
|
||||
}
|
||||
|
||||
func (g *genChromaStyles) generate() error {
|
||||
builder := styles.Get(g.style).Builder()
|
||||
if g.highlightStyle != "" {
|
||||
builder.Add(chroma.LineHighlight, g.highlightStyle)
|
||||
}
|
||||
if g.linesStyle != "" {
|
||||
builder.Add(chroma.LineNumbers, g.linesStyle)
|
||||
}
|
||||
style, err := builder.Build()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
formatter := html.New(html.WithClasses())
|
||||
formatter.WriteCSS(os.Stdout, style)
|
||||
return nil
|
||||
}
|
||||
+110
-175
@@ -22,7 +22,6 @@ import (
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -30,6 +29,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
src "github.com/gohugoio/hugo/source"
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
|
||||
"github.com/gohugoio/hugo/parser"
|
||||
@@ -199,6 +200,7 @@ func AddCommands() {
|
||||
genCmd.AddCommand(gendocCmd)
|
||||
genCmd.AddCommand(genmanCmd)
|
||||
genCmd.AddCommand(createGenDocsHelper().cmd)
|
||||
genCmd.AddCommand(createGenChromaStyles().cmd)
|
||||
}
|
||||
|
||||
// initHugoBuilderFlags initializes all common flags, typically used by the
|
||||
@@ -240,6 +242,8 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().Bool("enableGitInfo", false, "add Git revision, date and author info to the pages")
|
||||
|
||||
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().BoolP("forceSyncStatic", "", false, "copy all files when static is changed.")
|
||||
@@ -388,7 +392,7 @@ func InitializeConfig(subCmdVs ...*cobra.Command) (*deps.DepsCfg, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cfg.Logger.INFO.Println("Using config file:", viper.ConfigFileUsed())
|
||||
cfg.Logger.INFO.Println("Using config file:", config.ConfigFileUsed())
|
||||
|
||||
themeDir := c.PathSpec().GetThemeDir()
|
||||
if themeDir != "" {
|
||||
@@ -474,6 +478,8 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
|
||||
"forceSyncStatic",
|
||||
"noTimes",
|
||||
"noChmod",
|
||||
"templateMetrics",
|
||||
"templateMetricsHints",
|
||||
}
|
||||
|
||||
// Remove these in Hugo 0.23.
|
||||
@@ -521,7 +527,7 @@ func (c *commandeer) watchConfig() {
|
||||
|
||||
func (c *commandeer) build(watches ...bool) error {
|
||||
if err := c.copyStatic(); err != nil {
|
||||
return fmt.Errorf("Error copying static files to %s: %s", c.PathSpec().AbsPathify(c.Cfg.GetString("publishDir")), err)
|
||||
return fmt.Errorf("Error copying static files: %s", err)
|
||||
}
|
||||
watch := false
|
||||
if len(watches) > 0 && watches[0] {
|
||||
@@ -532,70 +538,64 @@ func (c *commandeer) build(watches ...bool) error {
|
||||
}
|
||||
|
||||
if buildWatch {
|
||||
watchDirs, err := c.getDirList()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
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(0))
|
||||
utils.CheckErr(c.Logger, c.newWatcher(false, watchDirs...))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *commandeer) getStaticSourceFs() afero.Fs {
|
||||
source := c.Fs.Source
|
||||
themeDir, err := c.PathSpec().GetThemeStaticDirPath()
|
||||
staticDir := c.PathSpec().GetStaticDirPath() + helpers.FilePathSeparator
|
||||
useTheme := true
|
||||
useStatic := true
|
||||
|
||||
if err != nil {
|
||||
if err != helpers.ErrThemeUndefined {
|
||||
c.Logger.WARN.Println(err)
|
||||
}
|
||||
useTheme = false
|
||||
} else {
|
||||
if _, err := source.Stat(themeDir); os.IsNotExist(err) {
|
||||
c.Logger.WARN.Println("Unable to find Theme Static Directory:", themeDir)
|
||||
useTheme = false
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := source.Stat(staticDir); os.IsNotExist(err) {
|
||||
c.Logger.WARN.Println("Unable to find Static Directory:", staticDir)
|
||||
useStatic = false
|
||||
}
|
||||
|
||||
if !useStatic && !useTheme {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !useStatic {
|
||||
c.Logger.INFO.Println(themeDir, "is the only static directory available to sync from")
|
||||
return afero.NewReadOnlyFs(afero.NewBasePathFs(source, themeDir))
|
||||
}
|
||||
|
||||
if !useTheme {
|
||||
c.Logger.INFO.Println(staticDir, "is the only static directory available to sync from")
|
||||
return afero.NewReadOnlyFs(afero.NewBasePathFs(source, staticDir))
|
||||
}
|
||||
|
||||
c.Logger.INFO.Println("using a UnionFS for static directory comprised of:")
|
||||
c.Logger.INFO.Println("Base:", themeDir)
|
||||
c.Logger.INFO.Println("Overlay:", staticDir)
|
||||
base := afero.NewReadOnlyFs(afero.NewBasePathFs(source, themeDir))
|
||||
overlay := afero.NewReadOnlyFs(afero.NewBasePathFs(source, staticDir))
|
||||
return afero.NewCopyOnWriteFs(base, overlay)
|
||||
func (c *commandeer) copyStatic() error {
|
||||
return c.doWithPublishDirs(c.copyStaticTo)
|
||||
}
|
||||
|
||||
func (c *commandeer) copyStatic() error {
|
||||
func (c *commandeer) doWithPublishDirs(f func(dirs *src.Dirs, publishDir string) error) error {
|
||||
publishDir := c.PathSpec().AbsPathify(c.Cfg.GetString("publishDir")) + helpers.FilePathSeparator
|
||||
// If root, remove the second '/'
|
||||
if publishDir == "//" {
|
||||
publishDir = helpers.FilePathSeparator
|
||||
}
|
||||
|
||||
languages := c.languages()
|
||||
|
||||
if !languages.IsMultihost() {
|
||||
dirs, err := src.NewDirs(c.Fs, c.Cfg, c.DepsCfg.Logger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return f(dirs, publishDir)
|
||||
}
|
||||
|
||||
for _, l := range languages {
|
||||
dir := filepath.Join(publishDir, l.Lang)
|
||||
dirs, err := src.NewDirs(c.Fs, l, c.DepsCfg.Logger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := f(dirs, dir); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *commandeer) copyStaticTo(dirs *src.Dirs, publishDir string) error {
|
||||
|
||||
// If root, remove the second '/'
|
||||
if publishDir == "//" {
|
||||
publishDir = helpers.FilePathSeparator
|
||||
}
|
||||
|
||||
// Includes both theme/static & /static
|
||||
staticSourceFs := c.getStaticSourceFs()
|
||||
staticSourceFs, err := dirs.CreateStaticFs()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if staticSourceFs == nil {
|
||||
c.Logger.WARN.Println("No static directories found to sync")
|
||||
@@ -626,12 +626,17 @@ func (c *commandeer) copyStatic() error {
|
||||
}
|
||||
|
||||
// getDirList provides NewWatcher() with a list of directories to watch for changes.
|
||||
func (c *commandeer) getDirList() []string {
|
||||
func (c *commandeer) getDirList() ([]string, error) {
|
||||
var a []string
|
||||
dataDir := c.PathSpec().AbsPathify(c.Cfg.GetString("dataDir"))
|
||||
i18nDir := c.PathSpec().AbsPathify(c.Cfg.GetString("i18nDir"))
|
||||
staticSyncer, err := newStaticSyncer(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
layoutDir := c.PathSpec().GetLayoutDirPath()
|
||||
staticDir := c.PathSpec().GetStaticDirPath()
|
||||
staticDirs := staticSyncer.d.AbsStaticDirs
|
||||
|
||||
walker := func(path string, fi os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
@@ -650,12 +655,12 @@ func (c *commandeer) getDirList() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
if path == staticDir && os.IsNotExist(err) {
|
||||
c.Logger.WARN.Println("Skip staticDir:", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if os.IsNotExist(err) {
|
||||
for _, staticDir := range staticDirs {
|
||||
if path == staticDir && os.IsNotExist(err) {
|
||||
c.Logger.WARN.Println("Skip staticDir:", err)
|
||||
}
|
||||
}
|
||||
// Ignore.
|
||||
return nil
|
||||
}
|
||||
@@ -702,17 +707,18 @@ func (c *commandeer) getDirList() []string {
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, c.PathSpec().AbsPathify(c.Cfg.GetString("contentDir")), walker)
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, i18nDir, walker)
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, layoutDir, walker)
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, staticDir, walker)
|
||||
for _, staticDir := range staticDirs {
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, staticDir, walker)
|
||||
}
|
||||
|
||||
if c.PathSpec().ThemeSet() {
|
||||
themesDir := c.PathSpec().GetThemeDir()
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "layouts"), walker)
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "static"), walker)
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "i18n"), walker)
|
||||
_ = helpers.SymbolicWalk(c.Fs.Source, filepath.Join(themesDir, "data"), walker)
|
||||
}
|
||||
|
||||
return a
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func (c *commandeer) recreateAndBuildSites(watching bool) (err error) {
|
||||
@@ -763,15 +769,29 @@ func (c *commandeer) rebuildSites(events []fsnotify.Event) error {
|
||||
if err := c.initSites(); err != nil {
|
||||
return err
|
||||
}
|
||||
return Hugo.Build(hugolib.BuildCfg{PrintStats: !quiet, Watching: true}, events...)
|
||||
visited := c.visitedURLs.PeekAllSet()
|
||||
doLiveReload := !buildWatch && !c.Cfg.GetBool("disableLiveReload")
|
||||
if doLiveReload && !c.Cfg.GetBool("disableFastRender") {
|
||||
home := c.pathSpec.PrependBasePath("/")
|
||||
// Make sure we always render the home page
|
||||
visited[home] = true
|
||||
}
|
||||
return Hugo.Build(hugolib.BuildCfg{PrintStats: !quiet, Watching: true, RecentlyVisited: visited}, events...)
|
||||
}
|
||||
|
||||
// newWatcher creates a new watcher to watch filesystem events.
|
||||
func (c *commandeer) newWatcher(port int) error {
|
||||
// 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 {
|
||||
if runtime.GOOS == "darwin" {
|
||||
tweakLimit()
|
||||
}
|
||||
|
||||
staticSyncer, err := newStaticSyncer(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
watcher, err := watcher.New(1 * time.Second)
|
||||
var wg sync.WaitGroup
|
||||
|
||||
@@ -783,7 +803,7 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
for _, d := range c.getDirList() {
|
||||
for _, d := range dirList {
|
||||
if d != "" {
|
||||
_ = watcher.Add(d)
|
||||
}
|
||||
@@ -843,7 +863,7 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
if err := watcher.Add(path); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if !c.isStatic(path) {
|
||||
} else if !staticSyncer.isStatic(path) {
|
||||
// Hugo's rebuilding logic is entirely file based. When you drop a new folder into
|
||||
// /content on OSX, the above logic will handle future watching of those files,
|
||||
// but the initial CREATE is lost.
|
||||
@@ -860,7 +880,7 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
}
|
||||
}
|
||||
|
||||
if c.isStatic(ev.Name) {
|
||||
if staticSyncer.isStatic(ev.Name) {
|
||||
staticEvents = append(staticEvents, ev)
|
||||
} else {
|
||||
dynamicEvents = append(dynamicEvents, ev)
|
||||
@@ -868,99 +888,20 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
}
|
||||
|
||||
if len(staticEvents) > 0 {
|
||||
publishDir := c.PathSpec().AbsPathify(c.Cfg.GetString("publishDir")) + helpers.FilePathSeparator
|
||||
|
||||
// If root, remove the second '/'
|
||||
if publishDir == "//" {
|
||||
publishDir = helpers.FilePathSeparator
|
||||
}
|
||||
|
||||
c.Logger.FEEDBACK.Println("\nStatic file changes detected")
|
||||
const layout = "2006-01-02 15:04 -0700"
|
||||
const layout = "2006-01-02 15:04:05.000 -0700"
|
||||
c.Logger.FEEDBACK.Println(time.Now().Format(layout))
|
||||
|
||||
if c.Cfg.GetBool("forceSyncStatic") {
|
||||
c.Logger.FEEDBACK.Printf("Syncing all static files\n")
|
||||
err := c.copyStatic()
|
||||
if err != nil {
|
||||
utils.StopOnErr(c.Logger, err, fmt.Sprintf("Error copying static files to %s", publishDir))
|
||||
utils.StopOnErr(c.Logger, err, "Error copying static files to publish dir")
|
||||
}
|
||||
} else {
|
||||
staticSourceFs := c.getStaticSourceFs()
|
||||
|
||||
if staticSourceFs == nil {
|
||||
c.Logger.WARN.Println("No static directories found to sync")
|
||||
return
|
||||
}
|
||||
|
||||
syncer := fsync.NewSyncer()
|
||||
syncer.NoTimes = c.Cfg.GetBool("noTimes")
|
||||
syncer.NoChmod = c.Cfg.GetBool("noChmod")
|
||||
syncer.SrcFs = staticSourceFs
|
||||
syncer.DestFs = c.Fs.Destination
|
||||
|
||||
// prevent spamming the log on changes
|
||||
logger := helpers.NewDistinctFeedbackLogger()
|
||||
|
||||
for _, ev := range staticEvents {
|
||||
// Due to our approach of layering both directories and the content's rendered output
|
||||
// into one we can't accurately remove a file not in one of the source directories.
|
||||
// If a file is in the local static dir and also in the theme static dir and we remove
|
||||
// it from one of those locations we expect it to still exist in the destination
|
||||
//
|
||||
// If Hugo generates a file (from the content dir) over a static file
|
||||
// the content generated file should take precedence.
|
||||
//
|
||||
// Because we are now watching and handling individual events it is possible that a static
|
||||
// event that occupies the same path as a content generated file will take precedence
|
||||
// until a regeneration of the content takes places.
|
||||
//
|
||||
// Hugo assumes that these cases are very rare and will permit this bad behavior
|
||||
// The alternative is to track every single file and which pipeline rendered it
|
||||
// and then to handle conflict resolution on every event.
|
||||
|
||||
fromPath := ev.Name
|
||||
|
||||
// If we are here we already know the event took place in a static dir
|
||||
relPath, err := c.PathSpec().MakeStaticPathRelative(fromPath)
|
||||
if err != nil {
|
||||
c.Logger.ERROR.Println(err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Remove || rename is harder and will require an assumption.
|
||||
// Hugo takes the following approach:
|
||||
// If the static file exists in any of the static source directories after this event
|
||||
// Hugo will re-sync it.
|
||||
// If it does not exist in all of the static directories Hugo will remove it.
|
||||
//
|
||||
// This assumes that Hugo has not generated content on top of a static file and then removed
|
||||
// the source of that static file. In this case Hugo will incorrectly remove that file
|
||||
// from the published directory.
|
||||
if ev.Op&fsnotify.Rename == fsnotify.Rename || ev.Op&fsnotify.Remove == fsnotify.Remove {
|
||||
if _, err := staticSourceFs.Stat(relPath); os.IsNotExist(err) {
|
||||
// If file doesn't exist in any static dir, remove it
|
||||
toRemove := filepath.Join(publishDir, relPath)
|
||||
logger.Println("File no longer exists in static dir, removing", toRemove)
|
||||
_ = c.Fs.Destination.RemoveAll(toRemove)
|
||||
} else if err == nil {
|
||||
// If file still exists, sync it
|
||||
logger.Println("Syncing", relPath, "to", publishDir)
|
||||
if err := syncer.Sync(filepath.Join(publishDir, relPath), relPath); err != nil {
|
||||
c.Logger.ERROR.Println(err)
|
||||
}
|
||||
} else {
|
||||
c.Logger.ERROR.Println(err)
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// For all other event operations Hugo will sync static.
|
||||
logger.Println("Syncing", relPath, "to", publishDir)
|
||||
if err := syncer.Sync(filepath.Join(publishDir, relPath), relPath); err != nil {
|
||||
c.Logger.ERROR.Println(err)
|
||||
}
|
||||
if err := staticSyncer.syncsStaticEvents(staticEvents); err != nil {
|
||||
c.Logger.ERROR.Println(err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -970,7 +911,7 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
// force refresh when more than one file
|
||||
if len(staticEvents) > 0 {
|
||||
for _, ev := range staticEvents {
|
||||
path, _ := c.PathSpec().MakeStaticPathRelative(ev.Name)
|
||||
path := staticSyncer.d.MakeStaticPathRelative(ev.Name)
|
||||
livereload.RefreshPath(path)
|
||||
}
|
||||
|
||||
@@ -981,6 +922,16 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
}
|
||||
|
||||
if len(dynamicEvents) > 0 {
|
||||
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 -0700"
|
||||
c.Logger.FEEDBACK.Println(time.Now().Format(layout))
|
||||
@@ -989,26 +940,20 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
c.Logger.ERROR.Println("Failed to rebuild site:", err)
|
||||
}
|
||||
|
||||
if !buildWatch && !c.Cfg.GetBool("disableLiveReload") {
|
||||
|
||||
if doLiveReload {
|
||||
navigate := c.Cfg.GetBool("navigateToChanged")
|
||||
|
||||
// We have fetched the same page above, but it may have
|
||||
// changed.
|
||||
var p *hugolib.Page
|
||||
|
||||
if navigate {
|
||||
|
||||
// It is probably more confusing than useful
|
||||
// to navigate to a new URL on RENAME etc.
|
||||
// so for now we use the WRITE and CREATE events only.
|
||||
name := pickOneWriteOrCreatePath(dynamicEvents)
|
||||
|
||||
if name != "" {
|
||||
p = Hugo.GetContentPage(name)
|
||||
if onePageName != "" {
|
||||
p = Hugo.GetContentPage(onePageName)
|
||||
}
|
||||
}
|
||||
|
||||
if p != nil {
|
||||
livereload.NavigateToPath(p.RelPermalink())
|
||||
livereload.NavigateToPathForPort(p.RelPermalink(), p.Site.ServerPort())
|
||||
} else {
|
||||
livereload.ForceRefresh()
|
||||
}
|
||||
@@ -1022,14 +967,8 @@ func (c *commandeer) newWatcher(port int) error {
|
||||
}
|
||||
}()
|
||||
|
||||
if port > 0 {
|
||||
if !c.Cfg.GetBool("disableLiveReload") {
|
||||
livereload.Initialize()
|
||||
http.HandleFunc("/livereload.js", livereload.ServeJS)
|
||||
http.HandleFunc("/livereload", livereload.Handler)
|
||||
}
|
||||
|
||||
go c.serve(port)
|
||||
if serve {
|
||||
go c.serve()
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
@@ -1048,10 +987,6 @@ func pickOneWriteOrCreatePath(events []fsnotify.Event) string {
|
||||
return name
|
||||
}
|
||||
|
||||
func (c *commandeer) isStatic(path string) bool {
|
||||
return strings.HasPrefix(path, c.PathSpec().GetStaticDirPath()) || (len(c.PathSpec().GetThemesDirPath()) > 0 && strings.HasPrefix(path, c.PathSpec().GetThemesDirPath()))
|
||||
}
|
||||
|
||||
// isThemeVsHugoVersionMismatch returns whether the current Hugo version is
|
||||
// less than the theme's min_version.
|
||||
func (c *commandeer) isThemeVsHugoVersionMismatch() (mismatch bool, requiredMinVersion string) {
|
||||
|
||||
+1
-1
@@ -347,7 +347,7 @@ description = ""
|
||||
homepage = "http://example.com/"
|
||||
tags = []
|
||||
features = []
|
||||
min_version = "0.27"
|
||||
min_version = "0.31"
|
||||
|
||||
[author]
|
||||
name = ""
|
||||
|
||||
+196
-49
@@ -19,12 +19,16 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/livereload"
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -38,7 +42,11 @@ var (
|
||||
serverAppend bool
|
||||
serverInterface string
|
||||
serverPort int
|
||||
liveReloadPort int
|
||||
serverWatch bool
|
||||
noHTTPCache bool
|
||||
|
||||
disableFastRender bool
|
||||
)
|
||||
|
||||
var serverCmd = &cobra.Command{
|
||||
@@ -84,12 +92,16 @@ func init() {
|
||||
initHugoBuilderFlags(serverCmd)
|
||||
|
||||
serverCmd.Flags().IntVarP(&serverPort, "port", "p", 1313, "port on which the server will listen")
|
||||
serverCmd.Flags().IntVar(&liveReloadPort, "liveReloadPort", -1, "port for live reloading (i.e. 443 in HTTPS proxy situations)")
|
||||
serverCmd.Flags().StringVarP(&serverInterface, "bind", "", "127.0.0.1", "interface to which the server will bind")
|
||||
serverCmd.Flags().BoolVarP(&serverWatch, "watch", "w", true, "watch filesystem for changes and recreate as needed")
|
||||
serverCmd.Flags().BoolVar(&noHTTPCache, "noHTTPCache", false, "prevent HTTP caching")
|
||||
serverCmd.Flags().BoolVarP(&serverAppend, "appendPort", "", true, "append port to baseURL")
|
||||
serverCmd.Flags().BoolVar(&disableLiveReload, "disableLiveReload", false, "watch without enabling live browser reload on rebuild")
|
||||
serverCmd.Flags().BoolVar(&navigateToChanged, "navigateToChanged", false, "navigate to changed content file on live browser reload")
|
||||
serverCmd.Flags().BoolVar(&renderToDisk, "renderToDisk", false, "render to Destination path (default is render to memory & serve from there)")
|
||||
serverCmd.Flags().BoolVar(&disableFastRender, "disableFastRender", false, "enables full re-renders on changes")
|
||||
|
||||
serverCmd.Flags().String("memstats", "", "log memory usage to this file")
|
||||
serverCmd.Flags().String("meminterval", "100ms", "interval to poll memory usage (requires --memstats), valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\".")
|
||||
|
||||
@@ -116,6 +128,10 @@ func server(cmd *cobra.Command, args []string) error {
|
||||
c.Set("navigateToChanged", navigateToChanged)
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("disableFastRender") {
|
||||
c.Set("disableFastRender", disableFastRender)
|
||||
}
|
||||
|
||||
if serverWatch {
|
||||
c.Set("watch", true)
|
||||
}
|
||||
@@ -125,29 +141,58 @@ func server(cmd *cobra.Command, args []string) error {
|
||||
c.watchConfig()
|
||||
}
|
||||
|
||||
l, err := net.Listen("tcp", net.JoinHostPort(serverInterface, strconv.Itoa(serverPort)))
|
||||
if err == nil {
|
||||
l.Close()
|
||||
} else {
|
||||
if serverCmd.Flags().Changed("port") {
|
||||
// port set explicitly by user -- he/she probably meant it!
|
||||
return newSystemErrorF("Server startup failed: %s", err)
|
||||
languages := c.languages()
|
||||
serverPorts := make([]int, 1)
|
||||
|
||||
if languages.IsMultihost() {
|
||||
serverPorts = make([]int, len(languages))
|
||||
}
|
||||
|
||||
currentServerPort := serverPort
|
||||
|
||||
for i := 0; i < len(serverPorts); i++ {
|
||||
l, err := net.Listen("tcp", net.JoinHostPort(serverInterface, strconv.Itoa(currentServerPort)))
|
||||
if err == nil {
|
||||
l.Close()
|
||||
serverPorts[i] = currentServerPort
|
||||
} else {
|
||||
if i == 0 && serverCmd.Flags().Changed("port") {
|
||||
// port set explicitly by user -- he/she probably meant it!
|
||||
return newSystemErrorF("Server startup failed: %s", err)
|
||||
}
|
||||
jww.ERROR.Println("port", serverPort, "already in use, attempting to use an available port")
|
||||
sp, err := helpers.FindAvailablePort()
|
||||
if err != nil {
|
||||
return newSystemError("Unable to find alternative port to use:", err)
|
||||
}
|
||||
serverPorts[i] = sp.Port
|
||||
}
|
||||
jww.ERROR.Println("port", serverPort, "already in use, attempting to use an available port")
|
||||
sp, err := helpers.FindAvailablePort()
|
||||
if err != nil {
|
||||
return newSystemError("Unable to find alternative port to use:", err)
|
||||
}
|
||||
serverPort = sp.Port
|
||||
|
||||
currentServerPort = serverPorts[i] + 1
|
||||
}
|
||||
|
||||
c.Set("port", serverPort)
|
||||
|
||||
baseURL, err = fixURL(c.Cfg, baseURL)
|
||||
if err != nil {
|
||||
return err
|
||||
if liveReloadPort != -1 {
|
||||
c.Set("liveReloadPort", liveReloadPort)
|
||||
} else {
|
||||
c.Set("liveReloadPort", serverPorts[0])
|
||||
}
|
||||
|
||||
if languages.IsMultihost() {
|
||||
for i, language := range languages {
|
||||
baseURL, err = fixURL(language, baseURL, serverPorts[i])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
language.Set("baseURL", baseURL)
|
||||
}
|
||||
} else {
|
||||
baseURL, err = fixURL(c.Cfg, baseURL, serverPorts[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.Set("baseURL", baseURL)
|
||||
}
|
||||
c.Set("baseURL", baseURL)
|
||||
|
||||
if err := memStats(); err != nil {
|
||||
jww.ERROR.Println("memstats error:", err)
|
||||
@@ -175,63 +220,165 @@ func server(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// Watch runs its own server as part of the routine
|
||||
if serverWatch {
|
||||
watchDirs := c.getDirList()
|
||||
baseWatchDir := c.Cfg.GetString("workingDir")
|
||||
for i, dir := range watchDirs {
|
||||
watchDirs[i], _ = helpers.GetRelativePath(dir, baseWatchDir)
|
||||
|
||||
watchDirs, err := c.getDirList()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rootWatchDirs := strings.Join(helpers.UniqueStrings(helpers.ExtractRootPaths(watchDirs)), ",")
|
||||
baseWatchDir := c.Cfg.GetString("workingDir")
|
||||
relWatchDirs := make([]string, len(watchDirs))
|
||||
for i, dir := range watchDirs {
|
||||
relWatchDirs[i], _ = helpers.GetRelativePath(dir, baseWatchDir)
|
||||
}
|
||||
|
||||
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(serverPort)
|
||||
err = c.newWatcher(true, watchDirs...)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
c.serve(serverPort)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *commandeer) serve(port int) {
|
||||
if renderToDisk {
|
||||
jww.FEEDBACK.Println("Serving pages from " + c.PathSpec().AbsPathify(c.Cfg.GetString("publishDir")))
|
||||
} else {
|
||||
jww.FEEDBACK.Println("Serving pages from memory")
|
||||
type fileServer struct {
|
||||
ports []int
|
||||
baseURLs []string
|
||||
roots []string
|
||||
c *commandeer
|
||||
}
|
||||
|
||||
func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, error) {
|
||||
baseURL := f.baseURLs[i]
|
||||
root := f.roots[i]
|
||||
port := f.ports[i]
|
||||
|
||||
publishDir := f.c.Cfg.GetString("publishDir")
|
||||
|
||||
if root != "" {
|
||||
publishDir = filepath.Join(publishDir, root)
|
||||
}
|
||||
|
||||
httpFs := afero.NewHttpFs(c.Fs.Destination)
|
||||
fs := filesOnlyFs{httpFs.Dir(c.PathSpec().AbsPathify(c.Cfg.GetString("publishDir")))}
|
||||
fileserver := http.FileServer(fs)
|
||||
absPublishDir := f.c.PathSpec().AbsPathify(publishDir)
|
||||
|
||||
if i == 0 {
|
||||
if renderToDisk {
|
||||
jww.FEEDBACK.Println("Serving pages from " + absPublishDir)
|
||||
} else {
|
||||
jww.FEEDBACK.Println("Serving pages from memory")
|
||||
}
|
||||
}
|
||||
|
||||
httpFs := afero.NewHttpFs(f.c.Fs.Destination)
|
||||
fs := filesOnlyFs{httpFs.Dir(absPublishDir)}
|
||||
|
||||
doLiveReload := !buildWatch && !f.c.Cfg.GetBool("disableLiveReload")
|
||||
fastRenderMode := doLiveReload && !f.c.Cfg.GetBool("disableFastRender")
|
||||
|
||||
if i == 0 && fastRenderMode {
|
||||
jww.FEEDBACK.Println("Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender")
|
||||
}
|
||||
|
||||
// We're only interested in the path
|
||||
u, err := url.Parse(c.Cfg.GetString("baseURL"))
|
||||
u, err := url.Parse(baseURL)
|
||||
if err != nil {
|
||||
jww.ERROR.Fatalf("Invalid baseURL: %s", err)
|
||||
}
|
||||
if u.Path == "" || u.Path == "/" {
|
||||
http.Handle("/", fileserver)
|
||||
} else {
|
||||
http.Handle(u.Path, http.StripPrefix(u.Path, fileserver))
|
||||
return nil, "", fmt.Errorf("Invalid baseURL: %s", err)
|
||||
}
|
||||
|
||||
jww.FEEDBACK.Printf("Web Server is available at %s (bind address %s)\n", u.String(), serverInterface)
|
||||
jww.FEEDBACK.Println("Press Ctrl+C to stop")
|
||||
decorate := func(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if noHTTPCache {
|
||||
w.Header().Set("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0")
|
||||
w.Header().Set("Pragma", "no-cache")
|
||||
}
|
||||
|
||||
if fastRenderMode {
|
||||
p := r.RequestURI
|
||||
if strings.HasSuffix(p, "/") || strings.HasSuffix(p, "html") || strings.HasSuffix(p, "htm") {
|
||||
f.c.visitedURLs.Add(p)
|
||||
}
|
||||
}
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
fileserver := decorate(http.FileServer(fs))
|
||||
mu := http.NewServeMux()
|
||||
|
||||
if u.Path == "" || u.Path == "/" {
|
||||
mu.Handle("/", fileserver)
|
||||
} else {
|
||||
mu.Handle(u.Path, http.StripPrefix(u.Path, fileserver))
|
||||
}
|
||||
|
||||
endpoint := net.JoinHostPort(serverInterface, strconv.Itoa(port))
|
||||
err = http.ListenAndServe(endpoint, nil)
|
||||
if err != nil {
|
||||
jww.ERROR.Printf("Error: %s\n", err.Error())
|
||||
os.Exit(1)
|
||||
|
||||
return mu, endpoint, nil
|
||||
}
|
||||
|
||||
func (c *commandeer) serve() {
|
||||
|
||||
isMultiHost := Hugo.IsMultihost()
|
||||
|
||||
var (
|
||||
baseURLs []string
|
||||
roots []string
|
||||
ports []int
|
||||
)
|
||||
|
||||
if isMultiHost {
|
||||
for _, s := range Hugo.Sites {
|
||||
baseURLs = append(baseURLs, s.BaseURL.String())
|
||||
roots = append(roots, s.Language.Lang)
|
||||
ports = append(ports, s.Info.ServerPort())
|
||||
}
|
||||
} else {
|
||||
s := Hugo.Sites[0]
|
||||
baseURLs = []string{s.BaseURL.String()}
|
||||
roots = []string{""}
|
||||
ports = append(ports, s.Info.ServerPort())
|
||||
}
|
||||
|
||||
srv := &fileServer{
|
||||
ports: ports,
|
||||
baseURLs: baseURLs,
|
||||
roots: roots,
|
||||
c: c,
|
||||
}
|
||||
|
||||
doLiveReload := !c.Cfg.GetBool("disableLiveReload")
|
||||
|
||||
if doLiveReload {
|
||||
livereload.Initialize()
|
||||
}
|
||||
|
||||
for i, _ := range baseURLs {
|
||||
mu, endpoint, err := srv.createEndpoint(i)
|
||||
|
||||
if doLiveReload {
|
||||
mu.HandleFunc("/livereload.js", livereload.ServeJS)
|
||||
mu.HandleFunc("/livereload", livereload.Handler)
|
||||
}
|
||||
jww.FEEDBACK.Printf("Web Server is available at %s (bind address %s)\n", endpoint, serverInterface)
|
||||
go func() {
|
||||
err = http.ListenAndServe(endpoint, mu)
|
||||
if err != nil {
|
||||
jww.ERROR.Printf("Error: %s\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
jww.FEEDBACK.Println("Press Ctrl+C to stop")
|
||||
}
|
||||
|
||||
// fixURL massages the baseURL into a form needed for serving
|
||||
// all pages correctly.
|
||||
func fixURL(cfg config.Provider, s string) (string, error) {
|
||||
func fixURL(cfg config.Provider, s string, port int) (string, error) {
|
||||
useLocalhost := false
|
||||
if s == "" {
|
||||
s = cfg.GetString("baseURL")
|
||||
@@ -273,7 +420,7 @@ func fixURL(cfg config.Provider, s string) (string, error) {
|
||||
return "", fmt.Errorf("Failed to split baseURL hostpost: %s", err)
|
||||
}
|
||||
}
|
||||
u.Host += fmt.Sprintf(":%d", serverPort)
|
||||
u.Host += fmt.Sprintf(":%d", port)
|
||||
}
|
||||
|
||||
return u.String(), nil
|
||||
|
||||
@@ -47,7 +47,7 @@ func TestFixURL(t *testing.T) {
|
||||
v.Set("baseURL", test.CfgBaseURL)
|
||||
serverAppend = test.AppendPort
|
||||
serverPort = test.Port
|
||||
result, err := fixURL(v, baseURL)
|
||||
result, err := fixURL(v, baseURL, serverPort)
|
||||
if err != nil {
|
||||
t.Errorf("Test #%d %s: unexpected error %s", i, test.TestName, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
// Copyright 2017 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 (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
src "github.com/gohugoio/hugo/source"
|
||||
"github.com/spf13/fsync"
|
||||
)
|
||||
|
||||
type staticSyncer struct {
|
||||
c *commandeer
|
||||
d *src.Dirs
|
||||
}
|
||||
|
||||
func newStaticSyncer(c *commandeer) (*staticSyncer, error) {
|
||||
dirs, err := src.NewDirs(c.Fs, c.Cfg, c.DepsCfg.Logger)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &staticSyncer{c: c, d: dirs}, nil
|
||||
}
|
||||
|
||||
func (s *staticSyncer) isStatic(path string) bool {
|
||||
return s.d.IsStatic(path)
|
||||
}
|
||||
|
||||
func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
|
||||
c := s.c
|
||||
|
||||
syncFn := func(dirs *src.Dirs, publishDir string) error {
|
||||
staticSourceFs, err := dirs.CreateStaticFs()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if staticSourceFs == nil {
|
||||
c.Logger.WARN.Println("No static directories found to sync")
|
||||
return nil
|
||||
}
|
||||
|
||||
syncer := fsync.NewSyncer()
|
||||
syncer.NoTimes = c.Cfg.GetBool("noTimes")
|
||||
syncer.NoChmod = c.Cfg.GetBool("noChmod")
|
||||
syncer.SrcFs = staticSourceFs
|
||||
syncer.DestFs = c.Fs.Destination
|
||||
|
||||
// prevent spamming the log on changes
|
||||
logger := helpers.NewDistinctFeedbackLogger()
|
||||
|
||||
for _, ev := range staticEvents {
|
||||
// Due to our approach of layering both directories and the content's rendered output
|
||||
// into one we can't accurately remove a file not in one of the source directories.
|
||||
// If a file is in the local static dir and also in the theme static dir and we remove
|
||||
// it from one of those locations we expect it to still exist in the destination
|
||||
//
|
||||
// If Hugo generates a file (from the content dir) over a static file
|
||||
// the content generated file should take precedence.
|
||||
//
|
||||
// Because we are now watching and handling individual events it is possible that a static
|
||||
// event that occupies the same path as a content generated file will take precedence
|
||||
// until a regeneration of the content takes places.
|
||||
//
|
||||
// Hugo assumes that these cases are very rare and will permit this bad behavior
|
||||
// The alternative is to track every single file and which pipeline rendered it
|
||||
// and then to handle conflict resolution on every event.
|
||||
|
||||
fromPath := ev.Name
|
||||
|
||||
// If we are here we already know the event took place in a static dir
|
||||
relPath := dirs.MakeStaticPathRelative(fromPath)
|
||||
if relPath == "" {
|
||||
// Not member of this virtual host.
|
||||
continue
|
||||
}
|
||||
|
||||
// Remove || rename is harder and will require an assumption.
|
||||
// Hugo takes the following approach:
|
||||
// If the static file exists in any of the static source directories after this event
|
||||
// Hugo will re-sync it.
|
||||
// If it does not exist in all of the static directories Hugo will remove it.
|
||||
//
|
||||
// This assumes that Hugo has not generated content on top of a static file and then removed
|
||||
// the source of that static file. In this case Hugo will incorrectly remove that file
|
||||
// from the published directory.
|
||||
if ev.Op&fsnotify.Rename == fsnotify.Rename || ev.Op&fsnotify.Remove == fsnotify.Remove {
|
||||
if _, err := staticSourceFs.Stat(relPath); os.IsNotExist(err) {
|
||||
// If file doesn't exist in any static dir, remove it
|
||||
toRemove := filepath.Join(publishDir, relPath)
|
||||
|
||||
logger.Println("File no longer exists in static dir, removing", toRemove)
|
||||
_ = c.Fs.Destination.RemoveAll(toRemove)
|
||||
} else if err == nil {
|
||||
// If file still exists, sync it
|
||||
logger.Println("Syncing", relPath, "to", publishDir)
|
||||
|
||||
if err := syncer.Sync(filepath.Join(publishDir, relPath), relPath); err != nil {
|
||||
c.Logger.ERROR.Println(err)
|
||||
}
|
||||
} else {
|
||||
c.Logger.ERROR.Println(err)
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// For all other event operations Hugo will sync static.
|
||||
logger.Println("Syncing", relPath, "to", publishDir)
|
||||
if err := syncer.Sync(filepath.Join(publishDir, relPath), relPath); err != nil {
|
||||
c.Logger.ERROR.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.doWithPublishDirs(syncFn)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Copyright 2017-present 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 types contains types shared between packages in Hugo.
|
||||
package types
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// EvictingStringQueue is a queue which automatically evicts elements from the head of
|
||||
// the queue when attempting to add new elements onto the queue and it is full.
|
||||
// This queue orders elements LIFO (last-in-first-out). It throws away duplicates.
|
||||
// Note: This queue currently does not contain any remove (poll etc.) methods.
|
||||
type EvictingStringQueue struct {
|
||||
size int
|
||||
vals []string
|
||||
set map[string]bool
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// NewEvictingStringQueue creates a new queue with the given size.
|
||||
func NewEvictingStringQueue(size int) *EvictingStringQueue {
|
||||
return &EvictingStringQueue{size: size, set: make(map[string]bool)}
|
||||
}
|
||||
|
||||
// Add adds a new string to the tail of the queue if it's not already there.
|
||||
func (q *EvictingStringQueue) Add(v string) {
|
||||
q.mu.Lock()
|
||||
if q.set[v] {
|
||||
q.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
if len(q.set) == q.size {
|
||||
// Full
|
||||
delete(q.set, q.vals[0])
|
||||
q.vals = append(q.vals[:0], q.vals[1:]...)
|
||||
}
|
||||
q.set[v] = true
|
||||
q.vals = append(q.vals, v)
|
||||
q.mu.Unlock()
|
||||
}
|
||||
|
||||
// Peek looks at the last element added to the queue.
|
||||
func (q *EvictingStringQueue) Peek() string {
|
||||
q.mu.Lock()
|
||||
l := len(q.vals)
|
||||
if l == 0 {
|
||||
q.mu.Unlock()
|
||||
return ""
|
||||
}
|
||||
elem := q.vals[l-1]
|
||||
q.mu.Unlock()
|
||||
return elem
|
||||
}
|
||||
|
||||
// PeekAll looks at all the elements in the queue, with the newest first.
|
||||
func (q *EvictingStringQueue) PeekAll() []string {
|
||||
q.mu.Lock()
|
||||
vals := make([]string, len(q.vals))
|
||||
copy(vals, q.vals)
|
||||
q.mu.Unlock()
|
||||
for i, j := 0, len(vals)-1; i < j; i, j = i+1, j-1 {
|
||||
vals[i], vals[j] = vals[j], vals[i]
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
// PeekAllSet returns PeekAll as a set.
|
||||
func (q *EvictingStringQueue) PeekAllSet() map[string]bool {
|
||||
all := q.PeekAll()
|
||||
set := make(map[string]bool)
|
||||
for _, v := range all {
|
||||
set[v] = true
|
||||
}
|
||||
|
||||
return set
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright 2017-present 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 types
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestEvictingStringQueue(t *testing.T) {
|
||||
assert := require.New(t)
|
||||
|
||||
queue := NewEvictingStringQueue(3)
|
||||
|
||||
assert.Equal("", queue.Peek())
|
||||
queue.Add("a")
|
||||
queue.Add("b")
|
||||
queue.Add("a")
|
||||
assert.Equal("b", queue.Peek())
|
||||
queue.Add("b")
|
||||
assert.Equal("b", queue.Peek())
|
||||
|
||||
queue.Add("a")
|
||||
queue.Add("b")
|
||||
|
||||
assert.Equal([]string{"b", "a"}, queue.PeekAll())
|
||||
assert.Equal("b", queue.Peek())
|
||||
queue.Add("c")
|
||||
queue.Add("d")
|
||||
// Overflowed, a should now be removed.
|
||||
assert.Equal([]string{"d", "c", "b"}, queue.PeekAll())
|
||||
assert.Len(queue.PeekAllSet(), 3)
|
||||
assert.True(queue.PeekAllSet()["c"])
|
||||
}
|
||||
|
||||
func TestEvictingStringQueueConcurrent(t *testing.T) {
|
||||
var wg sync.WaitGroup
|
||||
val := "someval"
|
||||
|
||||
queue := NewEvictingStringQueue(3)
|
||||
|
||||
for j := 0; j < 100; j++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
queue.Add(val)
|
||||
v := queue.Peek()
|
||||
if v != val {
|
||||
t.Error("wrong val")
|
||||
}
|
||||
vals := queue.PeekAll()
|
||||
if len(vals) != 1 || vals[0] != val {
|
||||
t.Error("wrong val")
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
Vendored
+18
-2
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
"github.com/gohugoio/hugo/metrics"
|
||||
"github.com/gohugoio/hugo/output"
|
||||
"github.com/gohugoio/hugo/tpl"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
@@ -47,6 +48,8 @@ type Deps struct {
|
||||
WithTemplate func(templ tpl.TemplateHandler) error `json:"-"`
|
||||
|
||||
translationProvider ResourceProvider
|
||||
|
||||
Metrics metrics.Provider
|
||||
}
|
||||
|
||||
// ResourceProvider is used to create and refresh, and clone resources needed.
|
||||
@@ -114,6 +117,11 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
contentSpec, err := helpers.NewContentSpec(cfg.Language)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
d := &Deps{
|
||||
Fs: fs,
|
||||
Log: logger,
|
||||
@@ -121,11 +129,15 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
translationProvider: cfg.TranslationProvider,
|
||||
WithTemplate: cfg.WithTemplate,
|
||||
PathSpec: ps,
|
||||
ContentSpec: helpers.NewContentSpec(cfg.Language),
|
||||
ContentSpec: contentSpec,
|
||||
Cfg: cfg.Language,
|
||||
Language: cfg.Language,
|
||||
}
|
||||
|
||||
if cfg.Cfg.GetBool("templateMetrics") {
|
||||
d.Metrics = metrics.NewProvider(cfg.Cfg.GetBool("templateMetricsHints"))
|
||||
}
|
||||
|
||||
return d, nil
|
||||
}
|
||||
|
||||
@@ -139,7 +151,11 @@ func (d Deps) ForLanguage(l *helpers.Language) (*Deps, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
d.ContentSpec = helpers.NewContentSpec(l)
|
||||
d.ContentSpec, err = helpers.NewContentSpec(l)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
d.Cfg = l
|
||||
d.Language = l
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
/.idea
|
||||
/public
|
||||
nohup.out
|
||||
|
||||
@@ -10,6 +10,10 @@ Note that this repository contains solely the documentation for Hugo. For contri
|
||||
|
||||
*Pull requests shall **only** contain changes to the actual documentation. However, changes on the code base of Hugo **and** the documentation shall be a single, atomic pull request in the [hugo](https://github.com/gohugoio/hugo) repository.*
|
||||
|
||||
## Branches
|
||||
|
||||
* The `master` branch is where the site is automatically built from, and is the place to put changes relevant to the current Hugo version.
|
||||
* The `next` branch is where we store changes that is related to the next Hugo release. This can be previewed here: https://next--gohugoio.netlify.com/
|
||||
|
||||
## Build
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "{{ replace .TranslationBaseName "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
description: ""
|
||||
categories: []
|
||||
#tags: []
|
||||
keywords: []
|
||||
slug: ""
|
||||
aliases: []
|
||||
toc: false
|
||||
|
||||
+20
-1
@@ -21,6 +21,11 @@ disableAliases = true
|
||||
# It is (currently) not in use, but you can do ```go in a content file if you want to.
|
||||
pygmentsCodeFences = true
|
||||
|
||||
pygmentsOptions = ""
|
||||
# Use the Chroma stylesheet
|
||||
pygmentsUseClasses = true
|
||||
pygmentsUseClassic = false
|
||||
|
||||
# See https://help.farbox.com/pygments.html
|
||||
pygmentsStyle = "friendly"
|
||||
|
||||
@@ -45,6 +50,20 @@ baseName = "_headers"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
|
||||
[related]
|
||||
|
||||
threshold = 80
|
||||
includeNewer = true
|
||||
toLower = false
|
||||
|
||||
[[related.indices]]
|
||||
name = "keywords"
|
||||
weight = 100
|
||||
[[related.indices]]
|
||||
name = "date"
|
||||
weight = 10
|
||||
pattern = "2006"
|
||||
|
||||
[social]
|
||||
twitter = "GoHugoIO"
|
||||
|
||||
@@ -52,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.27"
|
||||
release = "0.31"
|
||||
## Setting this to true will add a "noindex" to *EVERY* page on the site
|
||||
removefromexternalsearch = false
|
||||
## Gh repo for site footer (include trailing slash)
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: []
|
||||
#tags: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "about"
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Improved performance, security and ease of use are just a few of th
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
#tags: [ssg,static,performance,security]
|
||||
keywords: [ssg,static,performance,security]
|
||||
menu:
|
||||
docs:
|
||||
parent: "about"
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2016-02-01
|
||||
publishdate: 2016-02-01
|
||||
lastmod: 2016-03-02
|
||||
categories: ["about hugo"]
|
||||
#tags: ["License","apache"]
|
||||
keywords: ["License","apache"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "about"
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [about hugo]
|
||||
#tags: [about,contribute,roadmap]
|
||||
keywords: [about,contribute,roadmap]
|
||||
menu:
|
||||
docs:
|
||||
parent: "about"
|
||||
@@ -42,7 +42,7 @@ Feel free to [contribute to Hugo's development][devcontribute], [improve Hugo's
|
||||
[doccontribute]: /contribute/documentation/
|
||||
[hosting and deployment]: /hosting-and-deployment/
|
||||
[migrate]: /tools/migrations/
|
||||
[milestones]: https://github.com/gohugoio/hugo/milestone/14
|
||||
[milestones]: https://github.com/gohugoio/hugo/milestones/
|
||||
[newissue]: https://github.com/gohugoio/hugo/issues/
|
||||
[related forum thread]: https://discourse.gohugo.io/t/web-based-editor/155
|
||||
[themes]: /themes/
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
---
|
||||
title: Command Line Reference
|
||||
linktitle: CLI Overview
|
||||
description: Comprehensive list of Hugo templating functions, including basic and advanced usage examples.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [commands]
|
||||
#tags: [cli,command line]
|
||||
menu:
|
||||
docs:
|
||||
parent: "commands"
|
||||
weight: 1
|
||||
weight: 01 #rem
|
||||
draft: false
|
||||
aliases: [/cli/]
|
||||
---
|
||||
|
||||
The following list contains auto-generated and up-to-date (thanks to [Cobra][]) documentation for all the CLI commands in Hugo.
|
||||
|
||||
|
||||
[Cobra]: https://github.com/spf13/cobra
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo"
|
||||
slug: hugo
|
||||
url: /commands/hugo/
|
||||
@@ -34,6 +34,7 @@ hugo [flags]
|
||||
--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.)
|
||||
@@ -55,6 +56,8 @@ hugo [flags]
|
||||
--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/
|
||||
@@ -77,4 +80,4 @@ hugo [flags]
|
||||
* [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 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo benchmark"
|
||||
slug: hugo_benchmark
|
||||
url: /commands/hugo_benchmark/
|
||||
@@ -50,6 +50,8 @@ hugo benchmark [flags]
|
||||
--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/
|
||||
@@ -59,6 +61,7 @@ hugo benchmark [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -69,4 +72,4 @@ hugo benchmark [flags]
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo check"
|
||||
slug: hugo_check
|
||||
url: /commands/hugo_check/
|
||||
@@ -23,6 +23,7 @@ Contains some verification checks
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -34,4 +35,4 @@ Contains some verification checks
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo check ulimit](/commands/hugo_check_ulimit/) - Check system ulimit settings
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo check ulimit"
|
||||
slug: hugo_check_ulimit
|
||||
url: /commands/hugo_check_ulimit/
|
||||
@@ -28,6 +28,7 @@ hugo check ulimit [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -38,4 +39,4 @@ hugo check ulimit [flags]
|
||||
### SEE ALSO
|
||||
* [hugo check](/commands/hugo_check/) - Contains some verification checks
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo config"
|
||||
slug: hugo_config
|
||||
url: /commands/hugo_config/
|
||||
@@ -27,6 +27,7 @@ hugo config [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -37,4 +38,4 @@ hugo config [flags]
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo convert"
|
||||
slug: hugo_convert
|
||||
url: /commands/hugo_convert/
|
||||
@@ -28,6 +28,7 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -41,4 +42,4 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
|
||||
* [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 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo convert toJSON"
|
||||
slug: hugo_convert_toJSON
|
||||
url: /commands/hugo_convert_tojson/
|
||||
@@ -28,6 +28,7 @@ hugo convert toJSON [flags]
|
||||
|
||||
```
|
||||
--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)
|
||||
-o, --output string filesystem path to write files to
|
||||
@@ -41,4 +42,4 @@ hugo convert toJSON [flags]
|
||||
### SEE ALSO
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo convert toTOML"
|
||||
slug: hugo_convert_toTOML
|
||||
url: /commands/hugo_convert_totoml/
|
||||
@@ -28,6 +28,7 @@ hugo convert toTOML [flags]
|
||||
|
||||
```
|
||||
--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)
|
||||
-o, --output string filesystem path to write files to
|
||||
@@ -41,4 +42,4 @@ hugo convert toTOML [flags]
|
||||
### SEE ALSO
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo convert toYAML"
|
||||
slug: hugo_convert_toYAML
|
||||
url: /commands/hugo_convert_toyaml/
|
||||
@@ -28,6 +28,7 @@ hugo convert toYAML [flags]
|
||||
|
||||
```
|
||||
--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)
|
||||
-o, --output string filesystem path to write files to
|
||||
@@ -41,4 +42,4 @@ hugo convert toYAML [flags]
|
||||
### SEE ALSO
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo env"
|
||||
slug: hugo_env
|
||||
url: /commands/hugo_env/
|
||||
@@ -27,6 +27,7 @@ hugo env [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -37,4 +38,4 @@ hugo env [flags]
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo gen"
|
||||
slug: hugo_gen
|
||||
url: /commands/hugo_gen/
|
||||
@@ -23,6 +23,7 @@ A collection of several useful generators.
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -33,7 +34,8 @@ 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 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo gen autocomplete"
|
||||
slug: hugo_gen_autocomplete
|
||||
url: /commands/hugo_gen_autocomplete/
|
||||
@@ -45,6 +45,7 @@ hugo gen autocomplete [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -55,4 +56,4 @@ hugo gen autocomplete [flags]
|
||||
### SEE ALSO
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo gen chromastyles"
|
||||
slug: hugo_gen_chromastyles
|
||||
url: /commands/hugo_gen_chromastyles/
|
||||
---
|
||||
## hugo gen chromastyles
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
hugo gen chromastyles [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for chromastyles
|
||||
--highlightStyle string style used for highlighting lines (see https://github.com/alecthomas/chroma) (default "bg:#ffffcc")
|
||||
--linesStyle string style used for line numbers (see https://github.com/alecthomas/chroma)
|
||||
--style string highlighter style (see https://help.farbox.com/pygments.html) (default "friendly")
|
||||
```
|
||||
|
||||
### 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 gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo gen doc"
|
||||
slug: hugo_gen_doc
|
||||
url: /commands/hugo_gen_doc/
|
||||
@@ -34,6 +34,7 @@ hugo gen doc [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -44,4 +45,4 @@ hugo gen doc [flags]
|
||||
### SEE ALSO
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo gen man"
|
||||
slug: hugo_gen_man
|
||||
url: /commands/hugo_gen_man/
|
||||
@@ -30,6 +30,7 @@ hugo gen man [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -40,4 +41,4 @@ hugo gen man [flags]
|
||||
### SEE ALSO
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo import"
|
||||
slug: hugo_import
|
||||
url: /commands/hugo_import/
|
||||
@@ -25,6 +25,7 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -36,4 +37,4 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo import jekyll"
|
||||
slug: hugo_import_jekyll
|
||||
url: /commands/hugo_import_jekyll/
|
||||
@@ -30,6 +30,7 @@ hugo import jekyll [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -40,4 +41,4 @@ hugo import jekyll [flags]
|
||||
### SEE ALSO
|
||||
* [hugo import](/commands/hugo_import/) - Import your site from others.
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo list"
|
||||
slug: hugo_list
|
||||
url: /commands/hugo_list/
|
||||
@@ -26,6 +26,7 @@ List requires a subcommand, e.g. `hugo list drafts`.
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -39,4 +40,4 @@ List requires a subcommand, e.g. `hugo list 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 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo list drafts"
|
||||
slug: hugo_list_drafts
|
||||
url: /commands/hugo_list_drafts/
|
||||
@@ -27,6 +27,7 @@ hugo list drafts [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -38,4 +39,4 @@ hugo list drafts [flags]
|
||||
### SEE ALSO
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo list expired"
|
||||
slug: hugo_list_expired
|
||||
url: /commands/hugo_list_expired/
|
||||
@@ -28,6 +28,7 @@ hugo list expired [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -39,4 +40,4 @@ hugo list expired [flags]
|
||||
### SEE ALSO
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo list future"
|
||||
slug: hugo_list_future
|
||||
url: /commands/hugo_list_future/
|
||||
@@ -28,6 +28,7 @@ hugo list future [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -39,4 +40,4 @@ hugo list future [flags]
|
||||
### SEE ALSO
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo new"
|
||||
slug: hugo_new
|
||||
url: /commands/hugo_new/
|
||||
@@ -35,6 +35,7 @@ hugo new [path] [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -47,4 +48,4 @@ hugo new [path] [flags]
|
||||
* [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 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo new site"
|
||||
slug: hugo_new_site
|
||||
url: /commands/hugo_new_site/
|
||||
@@ -31,6 +31,7 @@ hugo new site [path] [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -42,4 +43,4 @@ hugo new site [path] [flags]
|
||||
### SEE ALSO
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo new theme"
|
||||
slug: hugo_new_theme
|
||||
url: /commands/hugo_new_theme/
|
||||
@@ -30,6 +30,7 @@ hugo new theme [name] [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -41,4 +42,4 @@ hugo new theme [name] [flags]
|
||||
### SEE ALSO
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo server"
|
||||
slug: hugo_server
|
||||
url: /commands/hugo_server/
|
||||
@@ -43,6 +43,7 @@ hugo server [flags]
|
||||
-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
|
||||
@@ -53,10 +54,12 @@ hugo server [flags]
|
||||
--i18n-warnings print missing translations
|
||||
--ignoreCache ignores the cache directory
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--liveReloadPort int port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1)
|
||||
--meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms")
|
||||
--memstats string log memory usage to this file
|
||||
--navigateToChanged navigate to changed content file on live browser reload
|
||||
--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)
|
||||
-p, --port int port on which the server will listen (default 1313)
|
||||
@@ -64,6 +67,8 @@ hugo server [flags]
|
||||
--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
|
||||
--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/
|
||||
@@ -74,6 +79,7 @@ hugo server [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -84,4 +90,4 @@ hugo server [flags]
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo undraft"
|
||||
slug: hugo_undraft
|
||||
url: /commands/hugo_undraft/
|
||||
@@ -29,6 +29,7 @@ hugo undraft path/to/content [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -39,4 +40,4 @@ hugo undraft path/to/content [flags]
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-07-16T23:23:14+02:00
|
||||
date: 2017-11-18T10:28:35+01:00
|
||||
title: "hugo version"
|
||||
slug: hugo_version
|
||||
url: /commands/hugo_version/
|
||||
@@ -27,6 +27,7 @@ hugo version [flags]
|
||||
|
||||
```
|
||||
--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
|
||||
@@ -37,4 +38,4 @@ hugo version [flags]
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 16-Jul-2017
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2017
|
||||
|
||||
@@ -9,7 +9,7 @@ menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 1
|
||||
#tags: [source, organization]
|
||||
keywords: [source, organization]
|
||||
categories: [content management]
|
||||
weight: 01 #rem
|
||||
draft: false
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Archetypes allow you to create new instances of content types and s
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
#tags: [archetypes,generators,metadata,front matter]
|
||||
keywords: [archetypes,generators,metadata,front matter]
|
||||
categories: ["content management"]
|
||||
menu:
|
||||
docs:
|
||||
@@ -29,7 +29,7 @@ See above
|
||||
|
||||
**Archetypes** are content files in the [archetypes directory][] of your project that contain preconfigured [front matter][] for your website's [content types][]. Archetypes facilitate consistent metadata across your website content and allow content authors to quickly generate instances of a content type via the `hugo new` command.
|
||||
|
||||
{{< youtube S3Tj3UcTFz8 >}}
|
||||
{{< youtube bcme8AzVh6o >}}
|
||||
|
||||
The `hugo new` generator for archetypes assumes your working directory is the content folder at the root of your project. Hugo is able to infer the appropriate archetype by assuming the content type from the content section passed to the CLI command:
|
||||
|
||||
@@ -94,7 +94,7 @@ Default archetypes are convenient if your content's front matter stays consisten
|
||||
|
||||
### Create the Default Archetype
|
||||
|
||||
When you create a new Hugo project using `hugo new site`, you'll notice that Hugo has already scaffolded a file at `archetypes/default.md`.
|
||||
When you create a new Hugo project using `hugo new site`, you'll notice that Hugo has already scaffolded a file at `archetypes/default.md`.
|
||||
|
||||
The following examples are from a site that's using `tags` and `categories` as [taxonomies][]. If we assume that all content files will require these two key-values, we can create a `default.md` archetype that *extends* Hugo's base archetype. In this example, we are including "golang" and "hugo" as tags and "web development" as a category.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ description:
|
||||
date: 2016-08-22
|
||||
publishdate: 2017-03-12
|
||||
lastmod: 2017-03-12
|
||||
#tags: [authors]
|
||||
keywords: [authors]
|
||||
categories: ["content management"]
|
||||
menu:
|
||||
docs:
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Hugo ships with an internal Disqus template, but this isn't the onl
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-09
|
||||
#tags: [sections,content,organization]
|
||||
keywords: [sections,content,organization]
|
||||
categories: [project organization, fundamentals]
|
||||
menu:
|
||||
docs:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
title: Cross References
|
||||
title: Links and Cross References
|
||||
description: Hugo makes it easy to link documents together.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-31
|
||||
categories: [content management]
|
||||
#tags: ["cross references","references", "anchors", "urls"]
|
||||
keywords: ["cross references","references", "anchors", "urls"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -21,12 +21,12 @@ toc: true
|
||||
## Use `ref` and `relref`
|
||||
|
||||
```
|
||||
{{</* ref "document" */>}}
|
||||
{{</* ref "document.md" */>}}
|
||||
{{</* ref "#anchor" */>}}
|
||||
{{</* ref "document#anchor" */>}}
|
||||
{{</* relref "document" */>}}
|
||||
{{</* ref "document.md#anchor" */>}}
|
||||
{{</* relref "document.md" */>}}
|
||||
{{</* relref "#anchor" */>}}
|
||||
{{</* relref "document#anchor" */>}}
|
||||
{{</* relref "document.md#anchor" */>}}
|
||||
```
|
||||
|
||||
The single parameter to `ref` is a string with a content `documentname` (e.g., `about.md`) with or without an appended in-document `anchor` (`#who`) without spaces.
|
||||
@@ -120,4 +120,4 @@ Ensuring heading uniqueness across the site is accomplished with a unique identi
|
||||
[built-in Hugo shortcodes]: /content-management/shortcodes/#using-the-built-in-shortcodes
|
||||
[lists]: /templates/lists/
|
||||
[output formats]: /templates/output-formats/
|
||||
[shortcode]: /content-management/shortcodes/
|
||||
[shortcode]: /content-management/shortcodes/
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
lastmod: 2017-04-06
|
||||
categories: [content management]
|
||||
#tags: [markdown,asciidoc,mmark,content format]
|
||||
keywords: [markdown,asciidoc,mmark,content format]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-01-09
|
||||
publishdate: 2017-01-09
|
||||
lastmod: 2017-02-24
|
||||
categories: [content management]
|
||||
#tags: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"]
|
||||
keywords: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -19,6 +19,8 @@ toc: true
|
||||
|
||||
**Front matter** allows you to keep metadata attached to an instance of a [content type][]---i.e., embedded inside a content file---and is one of the many features that gives Hugo its strength.
|
||||
|
||||
{{< youtube Yh2xKRJGff4 >}}
|
||||
|
||||
## Front Matter Formats
|
||||
|
||||
Hugo supports three formats for front matter, each with their own identifying tokens.
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-31
|
||||
categories: [content management]
|
||||
#tags: [menus]
|
||||
keywords: [menus]
|
||||
draft: false
|
||||
menu:
|
||||
docs:
|
||||
@@ -18,7 +18,7 @@ toc: true
|
||||
---
|
||||
|
||||
{{% note "Lazy Blogger"%}}
|
||||
If all you want is a simple menu for your sections, see the ["Section Menu for Lazy Bloggers" in Menu Templates](/templates/menu-templates/#section-menu-for-lazy-blogger).
|
||||
If all you want is a simple menu for your sections, see the ["Section Menu for Lazy Bloggers" in Menu Templates](/templates/menu-templates/#section-menu-for-lazy-bloggers).
|
||||
{{% /note %}}
|
||||
|
||||
You can do this:
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
lastmod: 2017-01-10
|
||||
categories: [content management]
|
||||
#tags: [multilingual,i18n, internationalization]
|
||||
keywords: [multilingual,i18n, internationalization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -59,6 +59,52 @@ If you want all of the languages to be put below their respective language code,
|
||||
|
||||
Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc.
|
||||
|
||||
## Configure Multilingual Multihost
|
||||
|
||||
From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details.
|
||||
|
||||
This means that you can now confugre a `baseURL` per `language`:
|
||||
|
||||
|
||||
> If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
[languages]
|
||||
[languages.no]
|
||||
baseURL = "https://example.no"
|
||||
languageName = "Norsk"
|
||||
weight = 1
|
||||
title = "På norsk"
|
||||
|
||||
[languages.en]
|
||||
baseURL = "https://example.com"
|
||||
languageName = "English"
|
||||
weight = 2
|
||||
title = "In English"
|
||||
```
|
||||
|
||||
With the above, the two sites will be generated into `public` with their own root:
|
||||
|
||||
```bash
|
||||
public
|
||||
├── en
|
||||
└── no
|
||||
```
|
||||
|
||||
**All URLs (i.e `.Permalink` etc.) will be generated from that root. So the English home page above will have its `.Permalink` set to `https://example.com/`.**
|
||||
|
||||
When you run `hugo server` we will start multiple HTTP servers. You will typlically see something like this in the console:
|
||||
|
||||
```bash
|
||||
Web Server is available at 127.0.0.1:1313 (bind address 127.0.0.1)
|
||||
Web Server is available at 127.0.0.1:1314 (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
Live reload and `--navigateToChanged` between the servers work as expected.
|
||||
|
||||
## Taxonomies and Blackfriday
|
||||
|
||||
Taxonomies and [Blackfriday configuration][config] can also be set per language:
|
||||
@@ -102,22 +148,28 @@ In this example, the `about.md` will be assigned the configured `defaultContentL
|
||||
|
||||
This way, you can slowly start to translate your current content without having to rename everything. If left unspecified, the default value for `defaultContentLanguage` is `en`.
|
||||
|
||||
By having the same *base filename*, the content pieces are linked together as translated pieces.
|
||||
By having the same **directory and base filename**, the content pieces are linked together as translated pieces.
|
||||
|
||||
You can also set the key used to link the translations explicitly in front matter:
|
||||
|
||||
```yaml
|
||||
translationKey: "my-story"
|
||||
```
|
||||
|
||||
|
||||
{{% note %}}
|
||||
**Before Hugo 0.31**, the file's directory was not considered when looking for translations. This did not work when you named all of your content files, say, `index.md`. Now we use the full content path.
|
||||
{{% /note %}}
|
||||
|
||||
If you need distinct URLs per language, you can set the slug in the non-default language file. For example, you can define a custom slug for a French translation in the front matter of `content/about.fr.md` as follows:
|
||||
|
||||
```
|
||||
```yaml
|
||||
slug: "a-propos"
|
||||
|
||||
```
|
||||
|
||||
At render, Hugo will build both `/about/` and `/a-propos/` as properly linked translated pages.
|
||||
|
||||
{{%note %}}
|
||||
Hugo currently uses the base filename as the translation key, which can be an issue with identical filenames in different sections.
|
||||
We will fix this in https://github.com/gohugoio/hugo/issues/2699
|
||||
{{% /note %}}
|
||||
{{< todo >}}Rewrite/remove the above one issue is fixed.{{< /todo >}}
|
||||
|
||||
## Link to Translated Content
|
||||
|
||||
@@ -146,6 +198,13 @@ Hugo uses [go-i18n][] to support string translations. [See the project's source
|
||||
|
||||
Translations are collected from the `themes/<THEME>/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646][] with names such as `en-US.toml`, `fr.toml`, etc.
|
||||
|
||||
{{% note %}}
|
||||
From **Hugo 0.31** you no longer need to use a valid language code. It _can be_ anything.
|
||||
|
||||
See https://github.com/gohugoio/hugo/issues/3564
|
||||
|
||||
{{% /note %}}
|
||||
|
||||
From within your templates, use the `i18n` function like this:
|
||||
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [content management,fundamentals]
|
||||
#tags: [sections,content,organization]
|
||||
keywords: [sections,content,organization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -24,6 +24,8 @@ This section is not updated with the new nested sections support in Hugo 0.24, s
|
||||
See above
|
||||
{{% /todo %}}
|
||||
|
||||
{{< youtube 0GZxidrlaRM >}}
|
||||
|
||||
## Organization of Content Source
|
||||
|
||||
In Hugo, your content should be organized in a manner that reflects the rendered website.
|
||||
|
||||
@@ -3,7 +3,7 @@ title: Related Content
|
||||
description: List related content in "See Also" sections.
|
||||
date: 2017-09-05
|
||||
categories: [content management]
|
||||
#tags: [content]
|
||||
keywords: [content]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -57,6 +57,10 @@ type PageGenealogist interface {
|
||||
## Configure Related Content
|
||||
Hugo provides a sensible default configuration of Related Content, but you can fine-tune this in your configuration, on the global or language level if needed.
|
||||
|
||||
{{% note %}}
|
||||
If you add a `related` config section, you need to add a complete configuration. It is not possible to just set, say, `includeNewer` and use the rest from the Hugo defaults.
|
||||
{{% /note %}}
|
||||
|
||||
Below is a sample `config.toml` section:
|
||||
|
||||
```
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [content management]
|
||||
#tags: [lists,sections,content types,organization]
|
||||
keywords: [lists,sections,content types,organization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -43,12 +43,12 @@ The following example shows a content directory structure for a website that has
|
||||
| ├── event-2.md // <- example.com/events/event-2/
|
||||
| └── event-3.md // <- example.com/events/event-3/
|
||||
└── posts
|
||||
| ├── _index.md // <- example.com/posts/
|
||||
| ├── event-1.md // <- example.com/posts/event-1/
|
||||
| ├── event-2.md // <- example.com/posts/event-2/
|
||||
| ├── event-3.md // <- example.com/posts/event-3/
|
||||
| ├── event-4.md // <- example.com/posts/event-4/
|
||||
| └── event-5.md // <- example.com/posts/event-5/
|
||||
| ├── _index.md // <- example.com/posts/
|
||||
| ├── post-1.md // <- example.com/posts/post-1/
|
||||
| ├── post-2.md // <- example.com/posts/post-2/
|
||||
| ├── post-3.md // <- example.com/posts/post-3/
|
||||
| ├── post-4.md // <- example.com/posts/post-4/
|
||||
| └── post-5.md // <- example.com/posts/post-5/
|
||||
```
|
||||
|
||||
## Content Section Lists
|
||||
|
||||
@@ -12,7 +12,7 @@ menu:
|
||||
weight: 35
|
||||
weight: 35 #rem
|
||||
categories: [content management]
|
||||
#tags: [markdown,content,shortcodes]
|
||||
keywords: [markdown,content,shortcodes]
|
||||
draft: false
|
||||
aliases: [/extras/shortcodes/]
|
||||
toc: true
|
||||
@@ -30,6 +30,8 @@ In addition to cleaner Markdown, shortcodes can be updated any time to reflect n
|
||||
|
||||
## Use Shortcodes
|
||||
|
||||
{{< youtube 2xkNJL4gJ9E >}}
|
||||
|
||||
In your content files, a shortcode can be called by calling `{{%/* shortcodename parameters */%}}`. Shortcode parameters are space delimited, and parameters with internal spaces can be quoted.
|
||||
|
||||
The first word in the shortcode declaration is always the name of the shortcode. Parameters follow the name. Depending upon how the shortcode is defined, the parameters may be named, positional, or both, although you can't mix parameter types in a single call. The format for named parameters models that of HTML with the format `name="value"`.
|
||||
@@ -86,6 +88,7 @@ The `figure` shortcode can use the following named parameters:
|
||||
* `attr` (i.e., attribution)
|
||||
* `attrlink`
|
||||
* `alt`
|
||||
* `width`
|
||||
|
||||
#### Example `figure` Input
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Static Files
|
||||
description: "The `static` folder is where you place all your **static files**."
|
||||
date: 2017-11-18
|
||||
categories: [content management]
|
||||
keywords: [source, directories]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 130
|
||||
weight: 130 #rem
|
||||
aliases: [/static-files]
|
||||
toc: true
|
||||
---
|
||||
|
||||
The `static` folder is where you place all your **static files**, e.g. stylesheets, JavaScript, images etc.
|
||||
|
||||
You can set the name of the static folder to use in your configuration file, for example `config.toml`. From **Hugo 0.31** you can configure as many static directories as you need. All the files in all the static directories will form a union filesystem.
|
||||
|
||||
Example:
|
||||
|
||||
```toml
|
||||
staticDir = ["static1", "static2"]
|
||||
[languages]
|
||||
[languages.no]
|
||||
staticDir = ["staticDir_override", "static_no"]
|
||||
baseURL = "https://example.no"
|
||||
languageName = "Norsk"
|
||||
weight = 1
|
||||
title = "På norsk"
|
||||
|
||||
[languages.en]
|
||||
staticDir2 = "static_en"
|
||||
baseURL = "https://example.com"
|
||||
languageName = "English"
|
||||
weight = 2
|
||||
title = "In English"
|
||||
```
|
||||
|
||||
In the above, with no theme used:
|
||||
|
||||
* The English site will get its static files as a union of "static1", "static2" and "static_en". On file duplicates, the right-most version will win.
|
||||
* The Norwegian site will get its static files as a union of "staticDir_override" and "static_no".
|
||||
|
||||
**Note:** The example above is a [multihost setup](/content-management/multilingual/#configure-multilingual-multihost). In a regular setup, all the static directories will be available to all sites.
|
||||
@@ -6,7 +6,7 @@ date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
lastmod: 2017-01-10
|
||||
categories: [content management]
|
||||
#tags: [summaries,abstracts,read more]
|
||||
keywords: [summaries,abstracts,read more]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
---
|
||||
title: Syntax Highlighting
|
||||
description: Hugo comes with reallly fast syntax highlighting from Chroma.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
keywords: [highlighting,pygments,chroma,code blocks,syntax]
|
||||
categories: [content management]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 300
|
||||
weight: 20
|
||||
sections_weight: 20
|
||||
draft: false
|
||||
aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
From Hugo 0.28, the default syntax hightlighter in Hugo is [Chroma](https://github.com/alecthomas/chroma); it is built in Go and is really, really fast -- and for the most important parts compatible with Pygments.
|
||||
|
||||
If you want to continue to use Pygments (see below), set `pygmentsUseClassic=true` in your site config.
|
||||
|
||||
The example below shows a simple code snippet from the Hugo source highlighted with the `highlight` shortcode. Note that the gohugo.io site is generated with `pygmentsUseClasses=true` (see [Generate Syntax Highlighter CSS](#generate-syntax-highlighter-css)).
|
||||
|
||||
* `linenos=inline` or `linenos=table` (`table` will give copy-and-paste friendly code blocks) turns on line numbers.
|
||||
* `hl_lines` lists a set of line numbers or line number ranges to be highlighted. Note that the hyphen range syntax is only supported for Chroma.
|
||||
* `linenostart=199` starts the line number count from 199.
|
||||
|
||||
With that, this:
|
||||
|
||||
```
|
||||
{{</* highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" */>}}
|
||||
// ... code
|
||||
{{</* / highlight */>}}
|
||||
```
|
||||
|
||||
Gives this:
|
||||
|
||||
{{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}}
|
||||
// GetTitleFunc returns a func that can be used to transform a string to
|
||||
// title case.
|
||||
//
|
||||
// The supported styles are
|
||||
//
|
||||
// - "Go" (strings.Title)
|
||||
// - "AP" (see https://www.apstylebook.com/)
|
||||
// - "Chicago" (see http://www.chicagomanualofstyle.org/home.html)
|
||||
//
|
||||
// If an unknown or empty style is provided, AP style is what you get.
|
||||
func GetTitleFunc(style string) func(s string) string {
|
||||
switch strings.ToLower(style) {
|
||||
case "go":
|
||||
return strings.Title
|
||||
case "chicago":
|
||||
tc := transform.NewTitleConverter(transform.ChicagoStyle)
|
||||
return tc.Title
|
||||
default:
|
||||
tc := transform.NewTitleConverter(transform.APStyle)
|
||||
return tc.Title
|
||||
}
|
||||
}
|
||||
{{< / highlight >}}
|
||||
|
||||
|
||||
## Configure Syntax Hightlighter
|
||||
To make the transition from Pygments to Chroma seamless, they share a common set of configuration options:
|
||||
|
||||
pygmentsOptions
|
||||
: A comma separated list of options. See below for a full list.
|
||||
|
||||
pygmentsCodefences
|
||||
: Set to true to enable syntax highlighting in code fences with a language tag in markdown (see below for an example).
|
||||
|
||||
pygmentsStyle
|
||||
: The style of code highlighting. See https://help.farbox.com/pygments.html for a gallery. Note that this option is not relevant when `pygmentsUseClasses` is set.
|
||||
|
||||
pygmentsUseClasses
|
||||
: Set to `true` to use CSS classes to format your highlighted code. See [Generate Syntax Highlighter CSS](#generate-syntax-highlighter-css).
|
||||
|
||||
pygmentsCodefencesGuessSyntax
|
||||
: Set to `true` to try to do syntax highlighting on code fenced blocks in markdown without a language tag.
|
||||
|
||||
pygmentsUseClassic
|
||||
: Set to true to use Pygments instead of the much faster Chroma.
|
||||
|
||||
### Options
|
||||
|
||||
`pygmentsOptions` can be set either in site config or overridden per code block in the Highlight shortcode or template func.
|
||||
|
||||
noclasses
|
||||
: Use inline style.
|
||||
|
||||
linenos
|
||||
: For Chroma, any value in this setting will print line numbers. Pygments has some more fine grained control.
|
||||
|
||||
linenostart
|
||||
: Start the line numbers from this value (default is 1).
|
||||
|
||||
|
||||
hl_lines
|
||||
: Highlight a space separated list of line numbers. For Chroma, you can provide a list of ranges, i.e. "3-8 10-20".
|
||||
|
||||
|
||||
The full set of supported options for Pygments is: `encoding`, `outencoding`, `nowrap`, `full`, `title`, `style`, `noclasses`, `classprefix`, `cssclass`, `cssstyles`, `prestyles`, `linenos`, `hl_lines`, `linenostart`, `linenostep`, `linenospecial`, `nobackground`, `lineseparator`, `lineanchors`, `linespans`, `anchorlinenos`, `startinline`. See the [Pygments HTML Formatter Documentation](http://pygments.org/docs/formatters/#HtmlFormatter) for details.
|
||||
|
||||
|
||||
## Generate Syntax Highlighter CSS
|
||||
|
||||
If you run with `pygmentsUseClasses=true` in your site config, you need a style sheet.
|
||||
|
||||
You can generate one with Hugo:
|
||||
|
||||
```bash
|
||||
hugo gen chromastyles --style=monokai > syntax.css
|
||||
```
|
||||
|
||||
Run `hugo gen chromastyles -h` for more options. See https://help.farbox.com/pygments.html for a gallery of available styles.
|
||||
|
||||
|
||||
## Highlight Shortcode
|
||||
|
||||
Highlighting is carried out via the [built-in shortcode](/content-management/shortcodes/) `highlight`. `highlight` takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that `highlight` is *not* used for client-side javascript highlighting.
|
||||
|
||||
### Example `highlight` Shortcode
|
||||
|
||||
{{< code file="example-highlight-shortcode-input.md" >}}
|
||||
{{</* highlight html */>}}
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Data.Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
{{</* /highlight */>}}
|
||||
{{< /code >}}
|
||||
|
||||
|
||||
|
||||
## Highlight Template Func
|
||||
|
||||
See [Highlight](/functions/highlight/).
|
||||
|
||||
## Highlight in Code Fences
|
||||
|
||||
It is also possible to add syntax highlighting with GitHub flavored code fences. To enable this, set the `pygmentsCodeFences` to `true` in Hugo's [configuration file](/getting-started/configuration/);
|
||||
|
||||
````
|
||||
```html
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Data.Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
```
|
||||
````
|
||||
|
||||
|
||||
## Highlight with Pygments Classic
|
||||
|
||||
If you for some reason don't want to use the built-in Chroma highlighter, you can set `pygmentsUseClassic=true` in your config and add Pygments to your path.
|
||||
|
||||
{{% note "Disclaimers on Pygments" %}}
|
||||
* Pygments is relatively slow and _causes a performance hit when building your site_, but Hugo has been designed to cache the results to disk.
|
||||
* The caching can be turned off by setting the `--ignoreCache` flag to `true`.
|
||||
* The languages available for highlighting depend on your Pygments installation.
|
||||
{{% /note %}}
|
||||
|
||||
If you have never worked with Pygments before, here is a brief primer:
|
||||
|
||||
+ Install Python from [python.org](https://www.python.org/downloads/). Version 2.7.x is already sufficient.
|
||||
+ Run `pip install Pygments` in order to install Pygments. Once installed, Pygments gives you a command `pygmentize`. Make sure it sits in your PATH; otherwise, Hugo will not be able to find and use it.
|
||||
|
||||
On Debian and Ubuntu systems, you may also install Pygments by running `sudo apt-get install python3-pygments`.
|
||||
|
||||
|
||||
|
||||
[Prism]: http://prismjs.com
|
||||
[prismdownload]: http://prismjs.com/download.html
|
||||
[Highlight.js]: http://highlightjs.org/
|
||||
[Rainbow]: http://craig.is/making/rainbows
|
||||
[Syntax Highlighter]: http://alexgorbatchev.com/SyntaxHighlighter/
|
||||
[Google Prettify]: https://github.com/google/code-prettify
|
||||
[Yandex]: http://yandex.ru/
|
||||
@@ -5,7 +5,7 @@ description: Hugo includes support for user-defined taxonomies to help you demo
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
#tags: [taxonomies,metadata,front matter,terms]
|
||||
keywords: [taxonomies,metadata,front matter,terms]
|
||||
categories: [content management]
|
||||
menu:
|
||||
docs:
|
||||
@@ -32,7 +32,7 @@ Term
|
||||
Value
|
||||
: a piece of content assigned to a term
|
||||
|
||||
{{< youtube "-np9GX6cL38" >}}
|
||||
{{< youtube pCPCQgqC8RA >}}
|
||||
|
||||
## Example Taxonomy: Movie Website
|
||||
|
||||
@@ -54,26 +54,26 @@ To continue with the example of a movie site, the following demonstrates content
|
||||
```
|
||||
Actor <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
The Sixth Sense <- Content
|
||||
Unbreakable <- Content
|
||||
Moonrise Kingdom <- Content
|
||||
The Sixth Sense <- Value
|
||||
Unbreakable <- Value
|
||||
Moonrise Kingdom <- Value
|
||||
Samuel L. Jackson <- Term
|
||||
Unbreakable <- Content
|
||||
The Avengers <- Content
|
||||
xXx <- Content
|
||||
Unbreakable <- Value
|
||||
The Avengers <- Value
|
||||
xXx <- Value
|
||||
```
|
||||
|
||||
From the perspective of the content, the relationships would appear differently, although the data and labels used are the same:
|
||||
|
||||
```
|
||||
Unbreakable <- Content
|
||||
Unbreakable <- Value
|
||||
Actors <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
Samuel L. Jackson <- Term
|
||||
Director <- Taxonomy
|
||||
M. Night Shyamalan <- Term
|
||||
...
|
||||
Moonrise Kingdom <- Content
|
||||
Moonrise Kingdom <- Value
|
||||
Actors <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
Bill Murray <- Term
|
||||
@@ -132,7 +132,7 @@ Note that if you use `preserveTaxonomyNames` and intend to manually construct UR
|
||||
{{% note %}}
|
||||
You can add content and front matter to your taxonomy list and taxonomy terms pages. See [Content Organization](/content-management/organization/) for more information on how to add an `_index.md` for this purpose.
|
||||
|
||||
Note also that taxonomy [permalinks](/content-management/urls/) are *not* configurable.
|
||||
Much like regular pages, taxonomy list [permalinks](/content-management/urls/) are configurable, but taxonomy term page permalinks are not.
|
||||
{{% /note %}}
|
||||
|
||||
## Add Taxonomies to Content
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [content management]
|
||||
#tags: [table of contents, toc]
|
||||
keywords: [table of contents, toc]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
@@ -45,6 +45,10 @@ Hugo will take this Markdown and create a table of contents from `## Introductio
|
||||
|
||||
The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` element with a child `<ul>`, whose child `<li>` elements begin with any `<h1>`'s (i.e., `#` in markdown) inside your content.'
|
||||
|
||||
{{% note "Table of contents not available for MMark" %}}
|
||||
Hugo documents created in the [MMark](/content-management/formats/#mmark) Markdown dialect do not currently display TOCs. TOCs are, however, compatible with all other supported Markdown formats.
|
||||
{{% /note %}}
|
||||
|
||||
## Template Example: Basic TOC
|
||||
|
||||
The following is an example of a very basic [single page template][]:
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [content management]
|
||||
#tags: [lists,sections,content types,types,organization]
|
||||
keywords: [lists,sections,content types,types,organization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Hugo supports permalinks, aliases, link canonicalization, and multi
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-09
|
||||
#tags: [aliases,redirects,permalinks,urls]
|
||||
keywords: [aliases,redirects,permalinks,urls]
|
||||
categories: [content management]
|
||||
menu:
|
||||
docs:
|
||||
@@ -43,7 +43,9 @@ permalinks:
|
||||
post = "/:year/:month/:title/"
|
||||
{{< /code >}}
|
||||
|
||||
Only the content under `post/` will have the new URL structure. For example, the file `content/post/sample-entry.md` with `date: 2017-02-27T19:20:00-05:00` in its front matter will render to `public/2017/02/sample-entry/index.html` at build time and therefore be reachable at `https://example.com/2013/11/sample-entry/`.
|
||||
Only the content under `post/` will have the new URL structure. For example, the file `content/post/sample-entry.md` with `date: 2017-02-27T19:20:00-05:00` in its front matter will render to `public/2017/02/sample-entry/index.html` at build time and therefore be reachable at `https://example.com/2017/02/sample-entry/`.
|
||||
|
||||
You can also configure permalinks of taxonomies with the same syntax, by using the plural form of the taxonomy instead of the section. You will probably only want to use the configuration values `:slug` or `:title`.
|
||||
|
||||
### Permalink Configuration Values
|
||||
|
||||
@@ -73,6 +75,9 @@ The following is a list of values that can be used in a `permalink` definition i
|
||||
`:section`
|
||||
: the content's section
|
||||
|
||||
`:sections`
|
||||
: the content's sections hierarchy
|
||||
|
||||
`:title`
|
||||
: the content's title
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
#tags: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "contribute"
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
#tags: [dev,open source]
|
||||
keywords: [dev,open source]
|
||||
authors: [digitalcraftsman]
|
||||
menu:
|
||||
docs:
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
#tags: [docs,documentation,community, contribute]
|
||||
keywords: [docs,documentation,community, contribute]
|
||||
menu:
|
||||
docs:
|
||||
parent: "contribute"
|
||||
@@ -143,8 +143,7 @@ This example HTML code block tells Hugo users the following:
|
||||
2. This snippet is complete enough to be downloaded and implemented in a Hugo project, as demonstrated by `download="single.html"`.
|
||||
|
||||
```
|
||||
{{%/* code file="layouts/_default/single.html" download="single.html" */%}}
|
||||
```
|
||||
{{</* code file="layouts/_default/single.html" download="single.html" */>}}
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
<article>
|
||||
@@ -162,8 +161,7 @@ This example HTML code block tells Hugo users the following:
|
||||
</article>
|
||||
</main>
|
||||
{{ end }}
|
||||
```
|
||||
{{%/* /code */%}}
|
||||
{{</* /code */>}}
|
||||
```
|
||||
|
||||
##### Example 'code' Display
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-27
|
||||
categories: [contribute]
|
||||
#tags: [contribute,themes,design]
|
||||
keywords: [contribute,themes,design]
|
||||
authors: [digitalcraftsman]
|
||||
menu:
|
||||
docs:
|
||||
@@ -105,7 +105,7 @@ min_version = 0.13
|
||||
|
||||
{{% note %}}
|
||||
1. This is different from the `theme.toml` file created by `hugo new theme` in Hugo versions before v0.14.
|
||||
2. Only `theme.toml` is accepted; ie. not `theme.yaml` andnot `theme.json`.
|
||||
2. Only `theme.toml` is accepted; ie. not `theme.yaml` and `theme.json`.
|
||||
{{% /note %}}
|
||||
|
||||
### Images
|
||||
@@ -147,4 +147,4 @@ If you add screenshots to the README, please make use of absolute file paths ins
|
||||
{{% /note %}}
|
||||
|
||||
[artistexample]: https://github.com/digitalcraftsman/hugo-artists-theme/tree/master/exampleSite
|
||||
[themeissuenew]: https://github.com/gohugoio/hugoThemes/issues/new
|
||||
[themeissuenew]: https://github.com/gohugoio/hugoThemes/issues/new
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [sections,lists,indexes]
|
||||
keywords: [sections,lists,indexes]
|
||||
signature: [".GetPage TYPE PATH"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -7,7 +7,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-08-21
|
||||
categories: [functions]
|
||||
#tags: [numbers]
|
||||
keywords: [numbers]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
|
||||
@@ -6,7 +6,7 @@ godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
#tags: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [multilingual,i18n,urls]
|
||||
keywords: [multilingual,i18n,urls]
|
||||
signature: ["absLangURL INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [urls]
|
||||
keywords: [urls]
|
||||
signature: ["absURL INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [dates,time]
|
||||
keywords: [dates,time]
|
||||
signature: [".AddDate YEARS MONTHS DAYS"]
|
||||
workson: [times]
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [iteration]
|
||||
keywords: [iteration]
|
||||
signature: ["after INDEX COLLECTION"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [advanced]
|
||||
keywords: [advanced]
|
||||
signature: ["apply COLLETION FUNCTION [PARAM...]"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: []
|
||||
keywords: []
|
||||
relatedfuncs: []
|
||||
signature: ["base64Decode INPUT", "base64Encode INPUT"]
|
||||
workson: []
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [trim]
|
||||
keywords: [trim]
|
||||
signature: ["chomp INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [counting, word count]
|
||||
keywords: [counting, word count]
|
||||
signature: ["countrunes INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [counting, word count]
|
||||
keywords: [counting, word count]
|
||||
signature: ["countwords INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [dates,time,strings]
|
||||
keywords: [dates,time,strings]
|
||||
signature: ["dateFormat LAYOUT INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -6,7 +6,7 @@ godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
#tags: [defaults]
|
||||
keywords: [defaults]
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
|
||||
@@ -10,7 +10,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [iteration]
|
||||
keywords: [iteration]
|
||||
toc: false
|
||||
signature: ["delimit COLLECTION DELIMIT LAST"]
|
||||
workson: [lists,taxonomies,terms]
|
||||
@@ -36,7 +36,7 @@ The examples of `delimit` that follow all use the same front matter:
|
||||
{{< code file="delimit-example-front-matter.toml" nocopy="true" >}}
|
||||
+++
|
||||
title: I love Delimit
|
||||
#tags: [ "tag1", "tag2", "tag3" ]
|
||||
keywords: [ "tag1", "tag2", "tag3" ]
|
||||
+++
|
||||
{{< /code >}}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [dictionary]
|
||||
keywords: [dictionary]
|
||||
signature: ["dict KEY VALUE [KEY VALUE]..."]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: []
|
||||
keywords: []
|
||||
signature: ["echoParam DICTIONARY KEY"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -9,7 +9,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [strings,emojis]
|
||||
keywords: [strings,emojis]
|
||||
signature: ["emojify INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
@@ -10,7 +10,7 @@ categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [operators,logic]
|
||||
keywords: [operators,logic]
|
||||
signature: ["eq ARG1 ARG2"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user