Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 157669a0e6 | |||
| 8f49df946a | |||
| 1a68ad4e31 | |||
| 523d51948f | |||
| 971b28904b | |||
| 63bbb40dfb | |||
| 73ae6d581d | |||
| e18a2ad3f4 | |||
| cfa73050a4 | |||
| 244e49c0ea | |||
| 98dc46e1a9 | |||
| 87dd5725de | |||
| 8c6a03a92b | |||
| 1ce3e7d521 | |||
| c9dc316ad1 | |||
| 1664a0e893 | |||
| 1e67854b1a | |||
| e1b609af9b | |||
| 8e5566af6e | |||
| 1005f754e0 | |||
| efde7078ed | |||
| 2ebb9f5484 | |||
| 7204b354a9 | |||
| 574c2959b8 | |||
| 99958f90fe | |||
| 1d91d8e14b | |||
| 95f492114e | |||
| c947351d7c | |||
| aa54803a84 | |||
| cc2a5d52a4 | |||
| 52c159c452 | |||
| c7b6d74e89 | |||
| 1a8af7d4f0 | |||
| 03b93bb988 | |||
| 94fb4dc3dd | |||
| 4f44227bd8 | |||
| 99d36237c0 | |||
| e371162c3f | |||
| 5eadc4c0a8 | |||
| 18cb21ff2e | |||
| df298558a5 | |||
| b1106f8715 | |||
| c0177fe2b2 | |||
| 5914f91b6c | |||
| 5b4659fa0b | |||
| 7f1da3efcd | |||
| f7d4b01c6d | |||
| b809b9680d | |||
| a9c91361c2 | |||
| 63393230c9 | |||
| 6b61f2a5bb | |||
| 14e369b961 | |||
| 6cceef65c2 | |||
| ffcb4aeb8e | |||
| 8279d2e227 | |||
| c4fa2f0799 | |||
| 108314444b | |||
| 51e178a6a2 | |||
| cb12f41a96 | |||
| 78c3c78fca | |||
| 713132cd4b | |||
| bbaefd7e3e | |||
| cc1a718860 | |||
| 6a34f88dcc | |||
| ae383f04c8 | |||
| ee31e61fb0 | |||
| 760a87a45a | |||
| 3d3fa5c3fe | |||
| ee3d02134d | |||
| 8947c3fa0b | |||
| d7798906d8 | |||
| 305ce1c9ec | |||
| 3e9db2ad95 | |||
| 449deb7f9c | |||
| 1746e8a9b2 | |||
| 6f48146e75 | |||
| b0d850321e | |||
| b66d38c419 | |||
| 05a74eaec0 | |||
| 33ae621083 | |||
| 1352bc880d | |||
| d184e5059c | |||
| 322c285ba2 |
@@ -1,6 +1,6 @@
|
||||
defaults: &defaults
|
||||
docker:
|
||||
- image: bepsays/ci-goreleaser:1.13.7-1
|
||||
- image: bepsays/ci-goreleaser:1.14.1-t
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
|
||||
|
||||
@@ -11,10 +11,9 @@ env:
|
||||
|
||||
git:
|
||||
depth: false
|
||||
|
||||
go:
|
||||
- "1.12.16"
|
||||
- "1.13.7"
|
||||
- "1.13.9"
|
||||
- "1.14.1"
|
||||
- master
|
||||
|
||||
arch:
|
||||
|
||||
@@ -124,64 +124,67 @@ Hugo stands on the shoulder of many great open source libraries, in lexical orde
|
||||
|
||||
| Dependency | License |
|
||||
| :------------- | :------------- |
|
||||
| [github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) | MIT License |
|
||||
| [github.com/armon/go-radix](https://github.com/armon/go-radix) | MIT License |
|
||||
| [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | Apache License 2.0 |
|
||||
| [github.com/bep/debounce](https://github.com/bep/debounce) | MIT License |
|
||||
| [github.com/bep/gitmap](https://github.com/bep/gitmap) | MIT License |
|
||||
| [github.com/bep/golibsass](https://github.com/bep/golibsass) | MIT License |
|
||||
| [github.com/bep/tmc](https://github.com/bep/tmc) | MIT License |
|
||||
| [github.com/BurntSushi/locker](https://github.com/BurntSushi/locker) | The Unlicense |
|
||||
| [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) | MIT License |
|
||||
| [github.com/PuerkitoBio/purell](https://github.com/PuerkitoBio/purell) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/PuerkitoBio/urlesc](https://github.com/PuerkitoBio/urlesc) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) | MIT License |
|
||||
| [github.com/bep/debounce](https://github.com/bep/debounce) | MIT License |
|
||||
| [github.com/bep/gitmap](https://github.com/bep/gitmap) | MIT License |
|
||||
| [github.com/bep/go-tocss](https://github.com/bep/go-tocss) | MIT License |
|
||||
| [github.com/niklasfasching/go-org](https://github.com/niklasfasching/go-org) | MIT License |
|
||||
| [github.com/cpuguy83/go-md2man](https://github.com/cpuguy83/go-md2man) | MIT License |
|
||||
| [github.com/danwakefield/fnmatch](https://github.com/danwakefield/fnmatch) | BSD 2-Clause "Simplified" License |
|
||||
| [github.com/disintegration/imaging](https://github.com/disintegration/imaging) | MIT License |
|
||||
| [github.com/dlclark/regexp2](https://github.com/dlclark/regexp2) | MIT License |
|
||||
| [github.com/eknkc/amber](https://github.com/eknkc/amber) | MIT License |
|
||||
| [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/disintegration/gift](https://github.com/disintegration/gift) | MIT License |
|
||||
| [github.com/dustin/go-humanize](https://github.com/dustin/go-humanize) | MIT License |
|
||||
| [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/gobwas/glob](https://github.com/gobwas/glob) | MIT License |
|
||||
| [github.com/gorilla/websocket](https://github.com/gorilla/websocket) | BSD 2-Clause "Simplified" License |
|
||||
| [github.com/hashicorp/go-immutable-radix](https://github.com/hashicorp/go-immutable-radix) | Mozilla Public License 2.0 |
|
||||
| [github.com/gorilla/websocket](https://github.com/gorilla/websocket) | BSD 2-Clause "Simplified" License |
|
||||
| [github.com/hashicorp/golang-lru](https://github.com/hashicorp/golang-lru) | Mozilla Public License 2.0 |
|
||||
| [github.com/hashicorp/hcl](https://github.com/hashicorp/hcl) | Mozilla Public License 2.0 |
|
||||
| [github.com/jdkato/prose](https://github.com/jdkato/prose) | MIT License |
|
||||
| [github.com/kyokomi/emoji](https://github.com/kyokomi/emoji) | MIT License |
|
||||
| [github.com/hashicorp/hcl](https://github.com/hashicorp/hcl) | Mozilla Public License 2.0 |
|
||||
| [github.com/jdkato/prose](https://github.com/jdkato/prose) | MIT License |
|
||||
| [github.com/kr/pretty](https://github.com/kr/pretty) | MIT License |
|
||||
| [github.com/kyokomi/emoji](https://github.com/kyokomi/emoji) | MIT License |
|
||||
| [github.com/magiconair/properties](https://github.com/magiconair/properties) | BSD 2-Clause "Simplified" License |
|
||||
| [github.com/markbates/inflect](https://github.com/markbates/inflect) | MIT License |
|
||||
| [github.com/markbates/inflect](https://github.com/markbates/inflect) | MIT License |
|
||||
| [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) | MIT License |
|
||||
| [github.com/mattn/go-runewidth](https://github.com/mattn/go-runewidth) | MIT License |
|
||||
| [github.com/miekg/mmark](https://github.com/miekg/mmark) | Simplified BSD License |
|
||||
| [github.com/mitchellh/hashstructure](https://github.com/mitchellh/hashstructure) | MIT License |
|
||||
| [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) | MIT License |
|
||||
| [github.com/muesli/smartcrop](https://github.com/muesli/smartcrop) | MIT License |
|
||||
| [github.com/muesli/smartcrop](https://github.com/muesli/smartcrop) | MIT License |
|
||||
| [github.com/nicksnyder/go-i18n](https://github.com/nicksnyder/go-i18n) | MIT License |
|
||||
| [github.com/niklasfasching/go-org](https://github.com/niklasfasching/go-org) | MIT License |
|
||||
| [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) | MIT License |
|
||||
| [github.com/pelletier/go-toml](https://github.com/pelletier/go-toml) | MIT License |
|
||||
| [github.com/pkg/errors](https://github.com/pkg/errors) | BSD 2-Clause "Simplified" License |
|
||||
| [github.com/pelletier/go-toml](https://github.com/pelletier/go-toml) | MIT License |
|
||||
| [github.com/pkg/errors](https://github.com/pkg/errors) | BSD 2-Clause "Simplified" License |
|
||||
| [github.com/PuerkitoBio/purell](https://github.com/PuerkitoBio/purell) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/PuerkitoBio/urlesc](https://github.com/PuerkitoBio/urlesc) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/rogpeppe/go-internal](https://github.com/rogpeppe/go-internal) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/russross/blackfriday](https://github.com/russross/blackfriday) | Simplified BSD License |
|
||||
| [github.com/shurcooL/sanitized_anchor_name](https://github.com/shurcooL/sanitized_anchor_name) | MIT License |
|
||||
| [github.com/rwcarlsen/goexif](https://github.com/rwcarlsen/goexif) | BSD 2-Clause "Simplified" License |
|
||||
| [github.com/spf13/afero](https://github.com/spf13/afero) | Apache License 2.0 |
|
||||
| [github.com/spf13/cast](https://github.com/spf13/cast) | MIT License |
|
||||
| [github.com/spf13/cast](https://github.com/spf13/cast) | MIT License |
|
||||
| [github.com/spf13/cobra](https://github.com/spf13/cobra) | Apache License 2.0 |
|
||||
| [github.com/spf13/fsync](https://github.com/spf13/fsync) | MIT License |
|
||||
| [github.com/spf13/jwalterweatherman](https://github.com/spf13/jwalterweatherman) | MIT License |
|
||||
| [github.com/spf13/nitro](https://github.com/spf13/nitro) | Apache License 2.0 |
|
||||
| [github.com/spf13/pflag](https://github.com/spf13/pflag) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [github.com/spf13/viper](https://github.com/spf13/viper) | MIT License |
|
||||
| [github.com/tdewolff/minify](https://github.com/tdewolff/minify) | MIT License |
|
||||
| [github.com/tdewolff/parse](https://github.com/tdewolff/parse) | MIT License |
|
||||
| [github.com/wellington/go-libsass](https://github.com/wellington/go-libsass) | Apache License 2.0 |
|
||||
| [github.com/yosssi/ace](https://github.com/yosssi/ace) | MIT License |
|
||||
| [github.com/yuin/goldmark](https://github.com/yuin/goldmark) | MIT License |
|
||||
| [github.com/yuin/goldmark-highlighting](https://github.com/yuin/goldmark-highlighting) | MIT License |
|
||||
| [go.opencensus.io](https://go.opencensus.io) | Apache License 2.0 |
|
||||
| [go.uber.org/atomic](https://go.uber.org/atomic) | MIT License |
|
||||
| [gocloud.dev](https://gocloud.dev) | Apache License 2.0 |
|
||||
| [golang.org/x/image](https://golang.org/x/image) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [golang.org/x/net](https://golang.org/x/net) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [golang.org/x/oauth2](https://golang.org/x/oauth2) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [golang.org/x/sync](https://golang.org/x/sync) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [golang.org/x/sys](https://golang.org/x/sys) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [golang.org/x/text](https://golang.org/x/text) | BSD 3-Clause "New" or "Revised" License
|
||||
| [gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) | Apache License 2.0 |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| [golang.org/x/text](https://golang.org/x/text) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [golang.org/x/xerrors](https://golang.org/x/xerrors) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [google.golang.org/api](https://google.golang.org/api) | BSD 3-Clause "New" or "Revised" License |
|
||||
| [google.golang.org/genproto](https://google.golang.org/genproto) | Apache License 2.0 |
|
||||
| [gopkg.in/ini.v1](https://gopkg.in/ini.v1) | Apache License 2.0 |
|
||||
| [gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) | Apache License 2.0 |
|
||||
|
||||
@@ -18,6 +18,8 @@ import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
hconfig "github.com/gohugoio/hugo/config"
|
||||
|
||||
"golang.org/x/sync/semaphore"
|
||||
|
||||
"io/ioutil"
|
||||
@@ -58,7 +60,8 @@ type commandeerHugoState struct {
|
||||
type commandeer struct {
|
||||
*commandeerHugoState
|
||||
|
||||
logger *loggers.Logger
|
||||
logger *loggers.Logger
|
||||
serverConfig *config.Server
|
||||
|
||||
// Currently only set when in "fast render mode". But it seems to
|
||||
// be fast enough that we could maybe just add it for all server modes.
|
||||
@@ -343,6 +346,7 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
|
||||
|
||||
cfg.Logger = logger
|
||||
c.logger = logger
|
||||
c.serverConfig = hconfig.DecodeServer(cfg.Cfg)
|
||||
|
||||
createMemFs := config.GetBool("renderToMemory")
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ func (g *genDocsHelper) generate() error {
|
||||
enc := json.NewEncoder(f)
|
||||
enc.SetIndent("", " ")
|
||||
|
||||
if err := enc.Encode(docshelper.DocProviders); err != nil {
|
||||
if err := enc.Encode(docshelper.GetDocProvider()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -231,11 +231,6 @@ func initializeFlags(cmd *cobra.Command, cfg config.Provider) {
|
||||
"duplicateTargetPaths",
|
||||
}
|
||||
|
||||
// Will set a value even if it is the default.
|
||||
flagKeysForced := []string{
|
||||
"minify",
|
||||
}
|
||||
|
||||
for _, key := range persFlagKeys {
|
||||
setValueFromFlag(cmd.PersistentFlags(), key, cfg, "", false)
|
||||
}
|
||||
@@ -243,9 +238,7 @@ func initializeFlags(cmd *cobra.Command, cfg config.Provider) {
|
||||
setValueFromFlag(cmd.Flags(), key, cfg, "", false)
|
||||
}
|
||||
|
||||
for _, key := range flagKeysForced {
|
||||
setValueFromFlag(cmd.Flags(), key, cfg, "", true)
|
||||
}
|
||||
setValueFromFlag(cmd.Flags(), "minify", cfg, "minifyOutput", true)
|
||||
|
||||
// Set some "config aliases"
|
||||
setValueFromFlag(cmd.Flags(), "destination", cfg, "publishDir", false)
|
||||
@@ -722,9 +715,6 @@ func (c *commandeer) handleBuildErr(err error, msg string) {
|
||||
|
||||
func (c *commandeer) rebuildSites(events []fsnotify.Event) error {
|
||||
defer c.timeTrack(time.Now(), "Total")
|
||||
defer func() {
|
||||
c.wasError = false
|
||||
}()
|
||||
|
||||
c.buildErr = nil
|
||||
visited := c.visitedURLs.PeekAllSet()
|
||||
@@ -886,6 +876,10 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
|
||||
evs []fsnotify.Event,
|
||||
configSet map[string]bool) {
|
||||
|
||||
defer func() {
|
||||
c.wasError = false
|
||||
}()
|
||||
|
||||
var isHandled bool
|
||||
|
||||
for _, ev := range evs {
|
||||
@@ -1080,10 +1074,11 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
|
||||
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
|
||||
|
||||
// force refresh when more than one file
|
||||
if len(staticEvents) == 1 {
|
||||
if !c.wasError && len(staticEvents) == 1 {
|
||||
ev := staticEvents[0]
|
||||
path := c.hugo().BaseFs.SourceFilesystems.MakeStaticPathRelative(ev.Name)
|
||||
path = c.firstPathSpec().RelURL(helpers.ToSlashTrimLeading(path), false)
|
||||
|
||||
livereload.RefreshPath(path)
|
||||
} else {
|
||||
livereload.ForceRefresh()
|
||||
@@ -1107,6 +1102,10 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
|
||||
|
||||
if doLiveReload {
|
||||
if len(partitionedEvents.ContentEvents) == 0 && len(partitionedEvents.AssetEvents) > 0 {
|
||||
if c.wasError {
|
||||
livereload.ForceRefresh()
|
||||
return
|
||||
}
|
||||
changed := c.changeDetector.changed()
|
||||
if c.changeDetector != nil && len(changed) == 0 {
|
||||
// Nothing has changed.
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"github.com/gohugoio/hugo/modules"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -49,8 +50,11 @@ func (c *modCmd) newVerifyCmd() *cobra.Command {
|
||||
return verifyCmd
|
||||
}
|
||||
|
||||
var moduleNotFoundRe = regexp.MustCompile("module.*not found")
|
||||
|
||||
func (c *modCmd) newCleanCmd() *cobra.Command {
|
||||
var pattern string
|
||||
var all bool
|
||||
cmd := &cobra.Command{
|
||||
Use: "clean",
|
||||
Short: "Delete the Hugo Module cache for the current project.",
|
||||
@@ -62,6 +66,16 @@ Also note that if you configure a positive maxAge for the "modules" file cache,
|
||||
|
||||
`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if all {
|
||||
com, err := c.initConfig(false)
|
||||
|
||||
if err != nil && !moduleNotFoundRe.MatchString(err.Error()) {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = com.hugo().FileCaches.ModulesCache().Prune(true)
|
||||
return err
|
||||
}
|
||||
return c.withModsClient(true, func(c *modules.Client) error {
|
||||
return c.Clean(pattern)
|
||||
})
|
||||
@@ -69,6 +83,7 @@ Also note that if you configure a positive maxAge for the "modules" file cache,
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&pattern, "pattern", "", "", `pattern matching module paths to clean (all if not set), e.g. "**hugo*"`)
|
||||
cmd.Flags().BoolVarP(&all, "all", "", false, "clean entire module cache")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -340,6 +340,7 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
|
||||
if err != nil {
|
||||
f.c.logger.ERROR.Println(err)
|
||||
}
|
||||
|
||||
port = 1313
|
||||
if !f.c.paused {
|
||||
port = f.c.Cfg.GetInt("liveReloadPort")
|
||||
@@ -355,6 +356,10 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
|
||||
w.Header().Set("Pragma", "no-cache")
|
||||
}
|
||||
|
||||
for _, header := range f.c.serverConfig.Match(r.RequestURI) {
|
||||
w.Header().Set(header.Key, header.Value)
|
||||
}
|
||||
|
||||
if f.c.fastRenderMode && f.c.buildErr == nil {
|
||||
p := r.RequestURI
|
||||
if strings.HasSuffix(p, "/") || strings.HasSuffix(p, "html") || strings.HasSuffix(p, "htm") {
|
||||
|
||||
@@ -30,8 +30,7 @@ var buildErrorTemplate = `<!doctype html>
|
||||
body {
|
||||
font-family: "Muli",avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-size: 16px;
|
||||
background-color: black;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
background-color: #2f1e2e;
|
||||
}
|
||||
main {
|
||||
margin: auto;
|
||||
@@ -43,7 +42,7 @@ var buildErrorTemplate = `<!doctype html>
|
||||
padding: 1rem 0;
|
||||
}
|
||||
.stack {
|
||||
margin-top: 6rem;
|
||||
margin-top: 4rem;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
@@ -54,10 +53,7 @@ var buildErrorTemplate = `<!doctype html>
|
||||
}
|
||||
.highlight {
|
||||
overflow-x: auto;
|
||||
padding: 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
background-color: #272822;
|
||||
border: 1px solid black;
|
||||
}
|
||||
a {
|
||||
color: #0594cb;
|
||||
@@ -70,14 +66,14 @@ var buildErrorTemplate = `<!doctype html>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
{{ highlight .Error "apl" "noclasses=true,style=monokai" }}
|
||||
{{ highlight .Error "apl" "linenos=false,noclasses=true,style=paraiso-dark" }}
|
||||
{{ with .File }}
|
||||
{{ $params := printf "noclasses=true,style=monokai,linenos=table,hl_lines=%d,linenostart=%d" (add .LinesPos 1) (sub .Position.LineNumber .LinesPos) }}
|
||||
{{ $params := printf "noclasses=true,style=paraiso-dark,linenos=table,hl_lines=%d,linenostart=%d" (add .LinesPos 1) (sub .Position.LineNumber .LinesPos) }}
|
||||
{{ $lexer := .ChromaLexer | default "go-html-template" }}
|
||||
{{ highlight (delimit .Lines "\n") $lexer $params }}
|
||||
{{ end }}
|
||||
{{ with .StackTrace }}
|
||||
{{ highlight . "apl" "noclasses=true,style=monokai" }}
|
||||
{{ highlight . "apl" "noclasses=true,style=paraiso-dark" }}
|
||||
{{ end }}
|
||||
<p class="version">{{ .Version }}</p>
|
||||
<a href="">Reload Page</a>
|
||||
|
||||
@@ -54,6 +54,10 @@ func (i Info) Generator() template.HTML {
|
||||
return template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, CurrentVersion.String()))
|
||||
}
|
||||
|
||||
func (i Info) IsProduction() bool {
|
||||
return i.Environment == EnvironmentProduction
|
||||
}
|
||||
|
||||
// NewInfo creates a new Hugo Info object.
|
||||
func NewInfo(environment string) Info {
|
||||
if environment == "" {
|
||||
|
||||
@@ -31,5 +31,9 @@ func TestHugoInfo(t *testing.T) {
|
||||
c.Assert(hugoInfo.BuildDate, qt.Equals, buildDate)
|
||||
c.Assert(hugoInfo.Environment, qt.Equals, "production")
|
||||
c.Assert(string(hugoInfo.Generator()), qt.Contains, fmt.Sprintf("Hugo %s", hugoInfo.Version()))
|
||||
c.Assert(hugoInfo.IsProduction(), qt.Equals, true)
|
||||
|
||||
devHugoInfo := NewInfo("development")
|
||||
c.Assert(devHugoInfo.IsProduction(), qt.Equals, false)
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ package hugo
|
||||
// CurrentVersion represents the current build version.
|
||||
// This should be the only one.
|
||||
var CurrentVersion = Version{
|
||||
Number: 0.65,
|
||||
Number: 0.68,
|
||||
PatchLevel: 3,
|
||||
Suffix: "",
|
||||
}
|
||||
|
||||
@@ -13,7 +13,11 @@
|
||||
|
||||
package types
|
||||
|
||||
import "github.com/spf13/cast"
|
||||
import (
|
||||
"html/template"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
// ToStringSlicePreserveString converts v to a string slice.
|
||||
// If v is a string, it will be wrapped in a string slice.
|
||||
@@ -26,3 +30,39 @@ func ToStringSlicePreserveString(v interface{}) []string {
|
||||
}
|
||||
return cast.ToStringSlice(v)
|
||||
}
|
||||
|
||||
// TypeToString converts v to a string if it's a valid string type.
|
||||
// Note that this will not try to convert numeric values etc.,
|
||||
// use ToString for that.
|
||||
func TypeToString(v interface{}) (string, bool) {
|
||||
switch s := v.(type) {
|
||||
case string:
|
||||
return s, true
|
||||
case template.HTML:
|
||||
return string(s), true
|
||||
case template.CSS:
|
||||
return string(s), true
|
||||
case template.HTMLAttr:
|
||||
return string(s), true
|
||||
case template.JS:
|
||||
return string(s), true
|
||||
case template.JSStr:
|
||||
return string(s), true
|
||||
case template.URL:
|
||||
return string(s), true
|
||||
case template.Srcset:
|
||||
return string(s), true
|
||||
}
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
||||
// ToString converts v to a string.
|
||||
func ToString(v interface{}) string {
|
||||
if s, ok := TypeToString(v); ok {
|
||||
return s
|
||||
}
|
||||
|
||||
return cast.ToString(v)
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
// Copyright 2019 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 config
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/gohugoio/hugo/common/types"
|
||||
|
||||
"github.com/gobwas/glob"
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/spf13/cast"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
var DefaultBuild = Build{
|
||||
UseResourceCacheWhen: "fallback",
|
||||
}
|
||||
|
||||
// Build holds some build related condfiguration.
|
||||
type Build struct {
|
||||
UseResourceCacheWhen string // never, fallback, always. Default is fallback
|
||||
}
|
||||
|
||||
func (b Build) UseResourceCache(err error) bool {
|
||||
if b.UseResourceCacheWhen == "never" {
|
||||
return false
|
||||
}
|
||||
|
||||
if b.UseResourceCacheWhen == "fallback" {
|
||||
return err == herrors.ErrFeatureNotAvailable
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func DecodeBuild(cfg Provider) Build {
|
||||
m := cfg.GetStringMap("build")
|
||||
b := DefaultBuild
|
||||
if m == nil {
|
||||
return b
|
||||
}
|
||||
|
||||
err := mapstructure.WeakDecode(m, &b)
|
||||
if err != nil {
|
||||
return DefaultBuild
|
||||
}
|
||||
|
||||
b.UseResourceCacheWhen = strings.ToLower(b.UseResourceCacheWhen)
|
||||
when := b.UseResourceCacheWhen
|
||||
if when != "never" && when != "always" && when != "fallback" {
|
||||
b.UseResourceCacheWhen = "fallback"
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
// Sitemap configures the sitemap to be generated.
|
||||
type Sitemap struct {
|
||||
ChangeFreq string
|
||||
Priority float64
|
||||
Filename string
|
||||
}
|
||||
|
||||
func DecodeSitemap(prototype Sitemap, input map[string]interface{}) Sitemap {
|
||||
|
||||
for key, value := range input {
|
||||
switch key {
|
||||
case "changefreq":
|
||||
prototype.ChangeFreq = cast.ToString(value)
|
||||
case "priority":
|
||||
prototype.Priority = cast.ToFloat64(value)
|
||||
case "filename":
|
||||
prototype.Filename = cast.ToString(value)
|
||||
default:
|
||||
jww.WARN.Printf("Unknown Sitemap field: %s\n", key)
|
||||
}
|
||||
}
|
||||
|
||||
return prototype
|
||||
}
|
||||
|
||||
// Config for the dev server.
|
||||
type Server struct {
|
||||
Headers []Headers
|
||||
|
||||
compiledInit sync.Once
|
||||
compiled []glob.Glob
|
||||
}
|
||||
|
||||
func (s *Server) Match(pattern string) []types.KeyValueStr {
|
||||
s.compiledInit.Do(func() {
|
||||
for _, h := range s.Headers {
|
||||
s.compiled = append(s.compiled, glob.MustCompile(h.For))
|
||||
}
|
||||
})
|
||||
|
||||
if s.compiled == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var matches []types.KeyValueStr
|
||||
|
||||
for i, g := range s.compiled {
|
||||
if g.Match(pattern) {
|
||||
h := s.Headers[i]
|
||||
for k, v := range h.Values {
|
||||
matches = append(matches, types.KeyValueStr{Key: k, Value: cast.ToString(v)})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sort.Slice(matches, func(i, j int) bool {
|
||||
return matches[i].Key < matches[j].Key
|
||||
})
|
||||
|
||||
return matches
|
||||
|
||||
}
|
||||
|
||||
type Headers struct {
|
||||
For string
|
||||
Values map[string]interface{}
|
||||
}
|
||||
|
||||
func DecodeServer(cfg Provider) *Server {
|
||||
m := cfg.GetStringMap("server")
|
||||
s := &Server{}
|
||||
if m == nil {
|
||||
return s
|
||||
}
|
||||
|
||||
_ = mapstructure.WeakDecode(m, s)
|
||||
return s
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// Copyright 2020 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 config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/common/types"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func TestBuild(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
v := viper.New()
|
||||
v.Set("build", map[string]interface{}{
|
||||
"useResourceCacheWhen": "always",
|
||||
})
|
||||
|
||||
b := DecodeBuild(v)
|
||||
|
||||
c.Assert(b.UseResourceCacheWhen, qt.Equals, "always")
|
||||
|
||||
v.Set("build", map[string]interface{}{
|
||||
"useResourceCacheWhen": "foo",
|
||||
})
|
||||
|
||||
b = DecodeBuild(v)
|
||||
|
||||
c.Assert(b.UseResourceCacheWhen, qt.Equals, "fallback")
|
||||
|
||||
c.Assert(b.UseResourceCache(herrors.ErrFeatureNotAvailable), qt.Equals, true)
|
||||
c.Assert(b.UseResourceCache(errors.New("err")), qt.Equals, false)
|
||||
|
||||
b.UseResourceCacheWhen = "always"
|
||||
c.Assert(b.UseResourceCache(herrors.ErrFeatureNotAvailable), qt.Equals, true)
|
||||
c.Assert(b.UseResourceCache(errors.New("err")), qt.Equals, true)
|
||||
c.Assert(b.UseResourceCache(nil), qt.Equals, true)
|
||||
|
||||
b.UseResourceCacheWhen = "never"
|
||||
c.Assert(b.UseResourceCache(herrors.ErrFeatureNotAvailable), qt.Equals, false)
|
||||
c.Assert(b.UseResourceCache(errors.New("err")), qt.Equals, false)
|
||||
c.Assert(b.UseResourceCache(nil), qt.Equals, false)
|
||||
|
||||
}
|
||||
|
||||
func TestServer(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
cfg, err := FromConfigString(`[[server.headers]]
|
||||
for = "/*.jpg"
|
||||
|
||||
[server.headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
X-XSS-Protection = "1; mode=block"
|
||||
X-Content-Type-Options = "nosniff"
|
||||
`, "toml")
|
||||
|
||||
c.Assert(err, qt.IsNil)
|
||||
|
||||
s := DecodeServer(cfg)
|
||||
|
||||
c.Assert(s.Match("/foo.jpg"), qt.DeepEquals, []types.KeyValueStr{
|
||||
{Key: "X-Content-Type-Options", Value: "nosniff"},
|
||||
{Key: "X-Frame-Options", Value: "DENY"},
|
||||
{Key: "X-XSS-Protection", Value: "1; mode=block"}})
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// Copyright 2019 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 config
|
||||
|
||||
import (
|
||||
"github.com/spf13/cast"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
// Sitemap configures the sitemap to be generated.
|
||||
type Sitemap struct {
|
||||
ChangeFreq string
|
||||
Priority float64
|
||||
Filename string
|
||||
}
|
||||
|
||||
func DecodeSitemap(prototype Sitemap, input map[string]interface{}) Sitemap {
|
||||
|
||||
for key, value := range input {
|
||||
switch key {
|
||||
case "changefreq":
|
||||
prototype.ChangeFreq = cast.ToString(value)
|
||||
case "priority":
|
||||
prototype.Priority = cast.ToFloat64(value)
|
||||
case "filename":
|
||||
prototype.Filename = cast.ToString(value)
|
||||
default:
|
||||
jww.WARN.Printf("Unknown Sitemap field: %s\n", key)
|
||||
}
|
||||
}
|
||||
|
||||
return prototype
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/gobwas/glob"
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/afero"
|
||||
@@ -125,7 +126,11 @@ func (d *Deployer) Deploy(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// Load local files from the source directory.
|
||||
local, err := walkLocal(d.localFs, d.matchers)
|
||||
var include, exclude glob.Glob
|
||||
if d.target != nil {
|
||||
include, exclude = d.target.includeGlob, d.target.excludeGlob
|
||||
}
|
||||
local, err := walkLocal(d.localFs, d.matchers, include, exclude)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -133,7 +138,7 @@ func (d *Deployer) Deploy(ctx context.Context) error {
|
||||
d.summary.NumLocal = len(local)
|
||||
|
||||
// Load remote files from the target.
|
||||
remote, err := walkRemote(ctx, bucket)
|
||||
remote, err := walkRemote(ctx, bucket, include, exclude)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -437,7 +442,7 @@ func (lf *localFile) MD5() []byte {
|
||||
|
||||
// walkLocal walks the source directory and returns a flat list of files,
|
||||
// using localFile.SlashPath as the map keys.
|
||||
func walkLocal(fs afero.Fs, matchers []*matcher) (map[string]*localFile, error) {
|
||||
func walkLocal(fs afero.Fs, matchers []*matcher, include, exclude glob.Glob) (map[string]*localFile, error) {
|
||||
retval := map[string]*localFile{}
|
||||
err := afero.Walk(fs, "", func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
@@ -461,8 +466,18 @@ func walkLocal(fs afero.Fs, matchers []*matcher) (map[string]*localFile, error)
|
||||
path = norm.NFC.String(path)
|
||||
}
|
||||
|
||||
// Find the first matching matcher (if any).
|
||||
// Check include/exclude matchers.
|
||||
slashpath := filepath.ToSlash(path)
|
||||
if include != nil && !include.Match(slashpath) {
|
||||
jww.INFO.Printf(" dropping %q due to include\n", slashpath)
|
||||
return nil
|
||||
}
|
||||
if exclude != nil && exclude.Match(slashpath) {
|
||||
jww.INFO.Printf(" dropping %q due to exclude\n", slashpath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Find the first matching matcher (if any).
|
||||
var m *matcher
|
||||
for _, cur := range matchers {
|
||||
if cur.Matches(slashpath) {
|
||||
@@ -484,7 +499,7 @@ func walkLocal(fs afero.Fs, matchers []*matcher) (map[string]*localFile, error)
|
||||
}
|
||||
|
||||
// walkRemote walks the target bucket and returns a flat list.
|
||||
func walkRemote(ctx context.Context, bucket *blob.Bucket) (map[string]*blob.ListObject, error) {
|
||||
func walkRemote(ctx context.Context, bucket *blob.Bucket, include, exclude glob.Glob) (map[string]*blob.ListObject, error) {
|
||||
retval := map[string]*blob.ListObject{}
|
||||
iter := bucket.List(nil)
|
||||
for {
|
||||
@@ -495,6 +510,15 @@ func walkRemote(ctx context.Context, bucket *blob.Bucket) (map[string]*blob.List
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Check include/exclude matchers.
|
||||
if include != nil && !include.Match(obj.Key) {
|
||||
jww.INFO.Printf(" remote dropping %q due to include\n", obj.Key)
|
||||
continue
|
||||
}
|
||||
if exclude != nil && exclude.Match(obj.Key) {
|
||||
jww.INFO.Printf(" remote dropping %q due to exclude\n", obj.Key)
|
||||
continue
|
||||
}
|
||||
// If the remote didn't give us an MD5, compute one.
|
||||
// This can happen for some providers (e.g., fileblob, which uses the
|
||||
// local filesystem), but not for the most common Cloud providers
|
||||
|
||||
@@ -17,7 +17,9 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/gobwas/glob"
|
||||
"github.com/gohugoio/hugo/config"
|
||||
hglob "github.com/gohugoio/hugo/hugofs/glob"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
@@ -41,6 +43,32 @@ type target struct {
|
||||
// GoogleCloudCDNOrigin specifies the Google Cloud project and CDN origin to
|
||||
// invalidate when deploying this target. It is specified as <project>/<origin>.
|
||||
GoogleCloudCDNOrigin string
|
||||
|
||||
// Optional patterns of files to include/exclude for this target.
|
||||
// Parsed using github.com/gobwas/glob.
|
||||
Include string
|
||||
Exclude string
|
||||
|
||||
// Parsed versions of Include/Exclude.
|
||||
includeGlob glob.Glob
|
||||
excludeGlob glob.Glob
|
||||
}
|
||||
|
||||
func (tgt *target) parseIncludeExclude() error {
|
||||
var err error
|
||||
if tgt.Include != "" {
|
||||
tgt.includeGlob, err = hglob.GetGlob(tgt.Include)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid deployment.target.include %q: %v", tgt.Include, err)
|
||||
}
|
||||
}
|
||||
if tgt.Exclude != "" {
|
||||
tgt.excludeGlob, err = hglob.GetGlob(tgt.Exclude)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid deployment.target.exclude %q: %v", tgt.Exclude, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// matcher represents configuration to be applied to files whose paths match
|
||||
@@ -87,6 +115,11 @@ func decodeConfig(cfg config.Provider) (deployConfig, error) {
|
||||
if err := mapstructure.WeakDecode(cfg.GetStringMap(deploymentConfigKey), &dcfg); err != nil {
|
||||
return dcfg, err
|
||||
}
|
||||
for _, tgt := range dcfg.Targets {
|
||||
if err := tgt.parseIncludeExclude(); err != nil {
|
||||
return dcfg, err
|
||||
}
|
||||
}
|
||||
var err error
|
||||
for _, m := range dcfg.Matchers {
|
||||
m.re, err = regexp.Compile(m.Pattern)
|
||||
|
||||
@@ -38,18 +38,21 @@ order = ["o1", "o2"]
|
||||
name = "name0"
|
||||
url = "url0"
|
||||
cloudfrontdistributionid = "cdn0"
|
||||
include = "*.html"
|
||||
|
||||
# All uppercase.
|
||||
[[deployment.targets]]
|
||||
NAME = "name1"
|
||||
URL = "url1"
|
||||
CLOUDFRONTDISTRIBUTIONID = "cdn1"
|
||||
INCLUDE = "*.jpg"
|
||||
|
||||
# Camelcase.
|
||||
[[deployment.targets]]
|
||||
name = "name2"
|
||||
url = "url2"
|
||||
cloudFrontDistributionID = "cdn2"
|
||||
exclude = "*.png"
|
||||
|
||||
# All lowercase.
|
||||
[[deployment.matchers]]
|
||||
@@ -90,11 +93,21 @@ force = true
|
||||
|
||||
// Targets.
|
||||
c.Assert(len(dcfg.Targets), qt.Equals, 3)
|
||||
wantInclude := []string{"*.html", "*.jpg", ""}
|
||||
wantExclude := []string{"", "", "*.png"}
|
||||
for i := 0; i < 3; i++ {
|
||||
tgt := dcfg.Targets[i]
|
||||
c.Assert(tgt.Name, qt.Equals, fmt.Sprintf("name%d", i))
|
||||
c.Assert(tgt.URL, qt.Equals, fmt.Sprintf("url%d", i))
|
||||
c.Assert(tgt.CloudFrontDistributionID, qt.Equals, fmt.Sprintf("cdn%d", i))
|
||||
c.Assert(tgt.Include, qt.Equals, wantInclude[i])
|
||||
if wantInclude[i] != "" {
|
||||
c.Assert(tgt.includeGlob, qt.Not(qt.IsNil))
|
||||
}
|
||||
c.Assert(tgt.Exclude, qt.Equals, wantExclude[i])
|
||||
if wantExclude[i] != "" {
|
||||
c.Assert(tgt.excludeGlob, qt.Not(qt.IsNil))
|
||||
}
|
||||
}
|
||||
|
||||
// Matchers.
|
||||
|
||||
@@ -640,6 +640,168 @@ func TestMaxDeletes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestIncludeExclude verifies that the include/exclude options for targets work.
|
||||
func TestIncludeExclude(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
tests := []struct {
|
||||
Include string
|
||||
Exclude string
|
||||
Want deploySummary
|
||||
}{
|
||||
{
|
||||
Want: deploySummary{NumLocal: 5, NumUploads: 5},
|
||||
},
|
||||
{
|
||||
Include: "**aaa",
|
||||
Want: deploySummary{NumLocal: 3, NumUploads: 3},
|
||||
},
|
||||
{
|
||||
Include: "**bbb",
|
||||
Want: deploySummary{NumLocal: 2, NumUploads: 2},
|
||||
},
|
||||
{
|
||||
Include: "aaa",
|
||||
Want: deploySummary{NumLocal: 1, NumUploads: 1},
|
||||
},
|
||||
{
|
||||
Exclude: "**aaa",
|
||||
Want: deploySummary{NumLocal: 2, NumUploads: 2},
|
||||
},
|
||||
{
|
||||
Exclude: "**bbb",
|
||||
Want: deploySummary{NumLocal: 3, NumUploads: 3},
|
||||
},
|
||||
{
|
||||
Exclude: "aaa",
|
||||
Want: deploySummary{NumLocal: 4, NumUploads: 4},
|
||||
},
|
||||
{
|
||||
Include: "**aaa",
|
||||
Exclude: "**nested**",
|
||||
Want: deploySummary{NumLocal: 2, NumUploads: 2},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(fmt.Sprintf("include %q exclude %q", test.Include, test.Exclude), func(t *testing.T) {
|
||||
fsTests, cleanup, err := initFsTests()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer cleanup()
|
||||
fsTest := fsTests[1] // just do file-based test
|
||||
|
||||
_, err = initLocalFs(ctx, fsTest.fs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tgt := &target{
|
||||
Include: test.Include,
|
||||
Exclude: test.Exclude,
|
||||
}
|
||||
if err := tgt.parseIncludeExclude(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
deployer := &Deployer{
|
||||
localFs: fsTest.fs,
|
||||
maxDeletes: -1,
|
||||
bucket: fsTest.bucket,
|
||||
target: tgt,
|
||||
}
|
||||
|
||||
// Sync remote with local.
|
||||
if err := deployer.Deploy(ctx); err != nil {
|
||||
t.Errorf("deploy: failed: %v", err)
|
||||
}
|
||||
if !cmp.Equal(deployer.summary, test.Want) {
|
||||
t.Errorf("deploy: got %v, want %v", deployer.summary, test.Want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestIncludeExcludeRemoteDelete verifies deleted local files that don't match include/exclude patterns
|
||||
// are not deleted on the remote.
|
||||
func TestIncludeExcludeRemoteDelete(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
tests := []struct {
|
||||
Include string
|
||||
Exclude string
|
||||
Want deploySummary
|
||||
}{
|
||||
{
|
||||
Want: deploySummary{NumLocal: 3, NumRemote: 5, NumUploads: 0, NumDeletes: 2},
|
||||
},
|
||||
{
|
||||
Include: "**aaa",
|
||||
Want: deploySummary{NumLocal: 2, NumRemote: 3, NumUploads: 0, NumDeletes: 1},
|
||||
},
|
||||
{
|
||||
Include: "subdir/**",
|
||||
Want: deploySummary{NumLocal: 1, NumRemote: 2, NumUploads: 0, NumDeletes: 1},
|
||||
},
|
||||
{
|
||||
Exclude: "**bbb",
|
||||
Want: deploySummary{NumLocal: 2, NumRemote: 3, NumUploads: 0, NumDeletes: 1},
|
||||
},
|
||||
{
|
||||
Exclude: "bbb",
|
||||
Want: deploySummary{NumLocal: 3, NumRemote: 4, NumUploads: 0, NumDeletes: 1},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(fmt.Sprintf("include %q exclude %q", test.Include, test.Exclude), func(t *testing.T) {
|
||||
fsTests, cleanup, err := initFsTests()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer cleanup()
|
||||
fsTest := fsTests[1] // just do file-based test
|
||||
|
||||
local, err := initLocalFs(ctx, fsTest.fs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
deployer := &Deployer{
|
||||
localFs: fsTest.fs,
|
||||
maxDeletes: -1,
|
||||
bucket: fsTest.bucket,
|
||||
}
|
||||
|
||||
// Initial sync to get the files on the remote
|
||||
if err := deployer.Deploy(ctx); err != nil {
|
||||
t.Errorf("deploy: failed: %v", err)
|
||||
}
|
||||
|
||||
// Delete two files, [1] and [2].
|
||||
if err := fsTest.fs.Remove(local[1].Name); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := fsTest.fs.Remove(local[2].Name); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Second sync
|
||||
tgt := &target{
|
||||
Include: test.Include,
|
||||
Exclude: test.Exclude,
|
||||
}
|
||||
if err := tgt.parseIncludeExclude(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
deployer.target = tgt
|
||||
if err := deployer.Deploy(ctx); err != nil {
|
||||
t.Errorf("deploy: failed: %v", err)
|
||||
}
|
||||
|
||||
if !cmp.Equal(deployer.summary, test.Want) {
|
||||
t.Errorf("deploy: got %v, want %v", deployer.summary, test.Want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestCompression verifies that gzip compression works correctly.
|
||||
// In particular, MD5 hashes must be of the compressed content.
|
||||
func TestCompression(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/atomic"
|
||||
|
||||
"github.com/gohugoio/hugo/cache/filecache"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
@@ -236,7 +235,9 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
return nil, errors.WithMessage(err, "failed to create file caches from configuration")
|
||||
}
|
||||
|
||||
resourceSpec, err := resources.NewSpec(ps, fileCaches, logger, cfg.OutputFormats, cfg.MediaTypes)
|
||||
errorHandler := &globalErrHandler{}
|
||||
|
||||
resourceSpec, err := resources.NewSpec(ps, fileCaches, logger, errorHandler, cfg.OutputFormats, cfg.MediaTypes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -276,7 +277,7 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
BuildStartListeners: &Listeners{},
|
||||
BuildFlags: &BuildFlags{},
|
||||
Timeout: time.Duration(timeoutms) * time.Millisecond,
|
||||
globalErrHandler: &globalErrHandler{},
|
||||
globalErrHandler: errorHandler,
|
||||
}
|
||||
|
||||
if cfg.Cfg.GetBool("templateMetrics") {
|
||||
@@ -307,7 +308,7 @@ func (d Deps) ForLanguage(cfg DepsCfg, onCreated func(d *Deps) error) (*Deps, er
|
||||
// The resource cache is global so reuse.
|
||||
// TODO(bep) clean up these inits.
|
||||
resourceCache := d.ResourceSpec.ResourceCache
|
||||
d.ResourceSpec, err = resources.NewSpec(d.PathSpec, d.ResourceSpec.FileCaches, d.Log, cfg.OutputFormats, cfg.MediaTypes)
|
||||
d.ResourceSpec, err = resources.NewSpec(d.PathSpec, d.ResourceSpec.FileCaches, d.Log, d.globalErrHandler, cfg.OutputFormats, cfg.MediaTypes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -377,11 +378,8 @@ type DepsCfg struct {
|
||||
|
||||
// BuildFlags are flags that may be turned on during a build.
|
||||
type BuildFlags struct {
|
||||
HasLateTemplate atomic.Bool
|
||||
}
|
||||
|
||||
func NewBuildFlags() BuildFlags {
|
||||
return BuildFlags{
|
||||
//HasLateTemplate: atomic.NewBool(false),
|
||||
}
|
||||
return BuildFlags{}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,8 @@ package deps
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
)
|
||||
|
||||
func TestBuildFlags(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
var bf BuildFlags
|
||||
c.Assert(bf.HasLateTemplate.Load(), qt.Equals, false)
|
||||
bf.HasLateTemplate.Store(true)
|
||||
c.Assert(bf.HasLateTemplate.Load(), qt.Equals, true)
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo"
|
||||
slug: hugo
|
||||
url: /commands/hugo/
|
||||
@@ -79,4 +79,4 @@ hugo [flags]
|
||||
* [hugo server](/commands/hugo_server/) - A high performance webserver
|
||||
* [hugo version](/commands/hugo_version/) - Print the version number of Hugo
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo check"
|
||||
slug: hugo_check
|
||||
url: /commands/hugo_check/
|
||||
@@ -40,4 +40,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 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo check ulimit"
|
||||
slug: hugo_check_ulimit
|
||||
url: /commands/hugo_check_ulimit/
|
||||
@@ -44,4 +44,4 @@ hugo check ulimit [flags]
|
||||
|
||||
* [hugo check](/commands/hugo_check/) - Contains some verification checks
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo config"
|
||||
slug: hugo_config
|
||||
url: /commands/hugo_config/
|
||||
@@ -44,4 +44,4 @@ hugo config [flags]
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo config mounts](/commands/hugo_config_mounts/) - Print the configured file mounts
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo config mounts"
|
||||
slug: hugo_config_mounts
|
||||
url: /commands/hugo_config_mounts/
|
||||
@@ -43,4 +43,4 @@ hugo config mounts [flags]
|
||||
|
||||
* [hugo config](/commands/hugo_config/) - Print the site configuration
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo convert"
|
||||
slug: hugo_convert
|
||||
url: /commands/hugo_convert/
|
||||
@@ -46,4 +46,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 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo convert toJSON"
|
||||
slug: hugo_convert_toJSON
|
||||
url: /commands/hugo_convert_tojson/
|
||||
@@ -46,4 +46,4 @@ hugo convert toJSON [flags]
|
||||
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo convert toTOML"
|
||||
slug: hugo_convert_toTOML
|
||||
url: /commands/hugo_convert_totoml/
|
||||
@@ -46,4 +46,4 @@ hugo convert toTOML [flags]
|
||||
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo convert toYAML"
|
||||
slug: hugo_convert_toYAML
|
||||
url: /commands/hugo_convert_toyaml/
|
||||
@@ -46,4 +46,4 @@ hugo convert toYAML [flags]
|
||||
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo deploy"
|
||||
slug: hugo_deploy
|
||||
url: /commands/hugo_deploy/
|
||||
@@ -53,4 +53,4 @@ hugo deploy [flags]
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo env"
|
||||
slug: hugo_env
|
||||
url: /commands/hugo_env/
|
||||
@@ -43,4 +43,4 @@ hugo env [flags]
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo gen"
|
||||
slug: hugo_gen
|
||||
url: /commands/hugo_gen/
|
||||
@@ -43,4 +43,4 @@ A collection of several useful generators.
|
||||
* [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 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo gen autocomplete"
|
||||
slug: hugo_gen_autocomplete
|
||||
url: /commands/hugo_gen_autocomplete/
|
||||
@@ -61,4 +61,4 @@ hugo gen autocomplete [flags]
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo gen chromastyles"
|
||||
slug: hugo_gen_chromastyles
|
||||
url: /commands/hugo_gen_chromastyles/
|
||||
@@ -48,4 +48,4 @@ hugo gen chromastyles [flags]
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo gen doc"
|
||||
slug: hugo_gen_doc
|
||||
url: /commands/hugo_gen_doc/
|
||||
@@ -50,4 +50,4 @@ hugo gen doc [flags]
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo gen man"
|
||||
slug: hugo_gen_man
|
||||
url: /commands/hugo_gen_man/
|
||||
@@ -46,4 +46,4 @@ hugo gen man [flags]
|
||||
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo import"
|
||||
slug: hugo_import
|
||||
url: /commands/hugo_import/
|
||||
@@ -42,4 +42,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 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo import jekyll"
|
||||
slug: hugo_import_jekyll
|
||||
url: /commands/hugo_import_jekyll/
|
||||
@@ -46,4 +46,4 @@ hugo import jekyll [flags]
|
||||
|
||||
* [hugo import](/commands/hugo_import/) - Import your site from others.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo list"
|
||||
slug: hugo_list
|
||||
url: /commands/hugo_list/
|
||||
@@ -45,4 +45,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 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo list all"
|
||||
slug: hugo_list_all
|
||||
url: /commands/hugo_list_all/
|
||||
@@ -43,4 +43,4 @@ hugo list all [flags]
|
||||
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo list drafts"
|
||||
slug: hugo_list_drafts
|
||||
url: /commands/hugo_list_drafts/
|
||||
@@ -43,4 +43,4 @@ hugo list drafts [flags]
|
||||
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo list expired"
|
||||
slug: hugo_list_expired
|
||||
url: /commands/hugo_list_expired/
|
||||
@@ -43,4 +43,4 @@ hugo list expired [flags]
|
||||
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo list future"
|
||||
slug: hugo_list_future
|
||||
url: /commands/hugo_list_future/
|
||||
@@ -43,4 +43,4 @@ hugo list future [flags]
|
||||
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod"
|
||||
slug: hugo_mod
|
||||
url: /commands/hugo_mod/
|
||||
@@ -81,4 +81,4 @@ See https://gohugo.io/hugo-modules/ for more information.
|
||||
* [hugo mod vendor](/commands/hugo_mod_vendor/) - Vendor all module dependencies into the _vendor directory.
|
||||
* [hugo mod verify](/commands/hugo_mod_verify/) - Verify dependencies.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod clean"
|
||||
slug: hugo_mod_clean
|
||||
url: /commands/hugo_mod_clean/
|
||||
@@ -25,6 +25,7 @@ hugo mod clean [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
--all clean entire module cache
|
||||
-h, --help help for clean
|
||||
--pattern string pattern matching module paths to clean (all if not set), e.g. "**hugo*"
|
||||
```
|
||||
@@ -50,4 +51,4 @@ hugo mod clean [flags]
|
||||
|
||||
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod get"
|
||||
slug: hugo_mod_get
|
||||
url: /commands/hugo_mod_get/
|
||||
@@ -69,4 +69,4 @@ hugo mod get [flags]
|
||||
|
||||
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod graph"
|
||||
slug: hugo_mod_graph
|
||||
url: /commands/hugo_mod_graph/
|
||||
@@ -45,4 +45,4 @@ hugo mod graph [flags]
|
||||
|
||||
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod init"
|
||||
slug: hugo_mod_init
|
||||
url: /commands/hugo_mod_init/
|
||||
@@ -50,4 +50,4 @@ hugo mod init [flags]
|
||||
|
||||
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod tidy"
|
||||
slug: hugo_mod_tidy
|
||||
url: /commands/hugo_mod_tidy/
|
||||
@@ -43,4 +43,4 @@ hugo mod tidy [flags]
|
||||
|
||||
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod vendor"
|
||||
slug: hugo_mod_vendor
|
||||
url: /commands/hugo_mod_vendor/
|
||||
@@ -46,4 +46,4 @@ hugo mod vendor [flags]
|
||||
|
||||
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo mod verify"
|
||||
slug: hugo_mod_verify
|
||||
url: /commands/hugo_mod_verify/
|
||||
@@ -45,4 +45,4 @@ hugo mod verify [flags]
|
||||
|
||||
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo new"
|
||||
slug: hugo_new
|
||||
url: /commands/hugo_new/
|
||||
@@ -77,4 +77,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 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo new site"
|
||||
slug: hugo_new_site
|
||||
url: /commands/hugo_new_site/
|
||||
@@ -47,4 +47,4 @@ hugo new site [path] [flags]
|
||||
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo new theme"
|
||||
slug: hugo_new_theme
|
||||
url: /commands/hugo_new_theme/
|
||||
@@ -46,4 +46,4 @@ hugo new theme [name] [flags]
|
||||
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo server"
|
||||
slug: hugo_server
|
||||
url: /commands/hugo_server/
|
||||
@@ -90,4 +90,4 @@ hugo server [flags]
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2020-02-19
|
||||
date: 2020-03-03
|
||||
title: "hugo version"
|
||||
slug: hugo_version
|
||||
url: /commands/hugo_version/
|
||||
@@ -43,4 +43,4 @@ hugo version [flags]
|
||||
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 19-Feb-2020
|
||||
###### Auto generated by spf13/cobra on 3-Mar-2020
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
---
|
||||
title: Build Options
|
||||
linktitle: Build Options
|
||||
description: Build options help define how Hugo must treat a given page when building the site.
|
||||
date: 2020-03-02
|
||||
publishdate: 2020-03-02
|
||||
keywords: [build,content,front matter, page resources]
|
||||
categories: ["content management"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 31
|
||||
weight: 31 #rem
|
||||
draft: false
|
||||
aliases: [/content/build-options/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
They are stored in a reserved Front Matter object named `_build` with the following defaults:
|
||||
|
||||
```yaml
|
||||
_build:
|
||||
render: true
|
||||
list: always
|
||||
publishResources: true
|
||||
```
|
||||
|
||||
#### render
|
||||
If true, the page will be treated as a published page, holding its dedicated output files (`index.html`, etc...) and permalink.
|
||||
|
||||
#### list
|
||||
|
||||
Note that we extended this property from a boolean to an enum in Hugo 0.58.0.
|
||||
|
||||
Valid values are:
|
||||
|
||||
never
|
||||
: The page will not be incldued in any page collection.
|
||||
|
||||
always (default)
|
||||
: The page will be included in all page collections, e.g. `site.RegularPages`, `$page.Pages`.
|
||||
|
||||
local
|
||||
: The page will be included in any _local_ page collection, e.g. `$page.RegularPages`, `$page.Pages`. One use case for this would be to create fully navigable, but headless content sections. {{< new-in "0.58.0" >}}
|
||||
|
||||
If true, the page will be treated as part of the project's collections and, when appropriate, returned by Hugo's listing methods (`.Pages`, `.RegularPages` etc...).
|
||||
|
||||
#### publishResources
|
||||
|
||||
If set to true the [Bundle's Resources]({{< relref "content-management/page-bundles" >}}) will be published.
|
||||
Setting this to false will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others.
|
||||
|
||||
{{% note %}}
|
||||
Any page, regardless of their build options, will always be available using the [`.GetPage`]({{< relref "functions/GetPage" >}}) methods.
|
||||
{{% /note %}}
|
||||
|
||||
------
|
||||
|
||||
### Illustrative use cases
|
||||
|
||||
#### Not publishing a page
|
||||
Project needs a "Who We Are" content file for Front Matter and body to be used by the homepage but nowhere else.
|
||||
|
||||
```yaml
|
||||
# content/who-we-are.md`
|
||||
title: Who we are
|
||||
_build:
|
||||
list: false
|
||||
render: false
|
||||
```
|
||||
|
||||
```go-html-template
|
||||
{{/* layouts/index.html */}}
|
||||
<section id="who-we-are">
|
||||
{{ with site.GetPage "who-we-are" }}
|
||||
{{ .Content }}
|
||||
{{ end }}
|
||||
</section>
|
||||
```
|
||||
|
||||
#### Listing pages without publishing them
|
||||
|
||||
Website needs to showcase a few of the hundred "testimonials" available as content files without publishing any of them.
|
||||
|
||||
To avoid setting the build options on every testimonials, one can use [`cascade`]({{< relref "/content-management/front-matter#front-matter-cascade" >}}) on the testimonial section's content file.
|
||||
|
||||
```yaml
|
||||
#content/testimonials/_index.md
|
||||
title: Testimonials
|
||||
# section build options:
|
||||
_build:
|
||||
render: true
|
||||
# children build options with cascade
|
||||
cascade:
|
||||
_build:
|
||||
render: false
|
||||
list: true # default
|
||||
```
|
||||
|
||||
```go-html-template
|
||||
{{/* layouts/_defaults/testimonials.html */}}
|
||||
<section id="testimonials">
|
||||
{{ range first 5 .Pages }}
|
||||
<blockquote cite="{{ .Params.cite }}">
|
||||
{{ .Content }}
|
||||
</blockquote>
|
||||
{{ end }}
|
||||
</section>
|
||||
@@ -160,12 +160,14 @@ show_comments: false
|
||||
Any node or section can pass down to descendents a set of Front Matter values as long as defined underneath the reserved `cascade` Front Matter key.
|
||||
|
||||
### Example
|
||||
```yaml
|
||||
# content/blog/_index.md
|
||||
|
||||
In `content/blog/_index.md`
|
||||
|
||||
{{< code-toggle copy="false" >}}
|
||||
title: Blog
|
||||
cascade:
|
||||
banner: images/typewriter.jpg
|
||||
```
|
||||
{{</ code-toggle >}}
|
||||
|
||||
With the above example the Blog section page and its descendents will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
|
||||
|
||||
|
||||
@@ -101,6 +101,17 @@ TAG: {{ $k }}: {{ $v }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Or individually access EXIF data with dot access, e.g.:
|
||||
|
||||
```go-html-template
|
||||
{{ with $img.Exif }}
|
||||
Date: {{ .Date }}
|
||||
Lat/Long: {{ .Lat }}/{{ .Long }}
|
||||
Aperture: {{ .Tags.ApertureValue }}
|
||||
Focal Length: {{ .Tags.FocalLength }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
#### Exif fields
|
||||
|
||||
Date
|
||||
|
||||
@@ -47,6 +47,11 @@ weight = 2
|
||||
linkedin = "https://linkedin.com/fr/whoever"
|
||||
[languages.fr.params.navigation]
|
||||
help = "Aide"
|
||||
|
||||
[languages.ar]
|
||||
title = "مدونتي"
|
||||
weight = 2
|
||||
languagedirection = "rtl"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Anything not defined in a `languages` block will fall back to the global value for that key (e.g., `copyright` for the English `en` language). This also works for `params`, as demonstrated with `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set.
|
||||
|
||||
@@ -59,7 +59,7 @@ You can pass multiple lines as parameters to a shortcode by using raw string lit
|
||||
|
||||
```
|
||||
{{</* myshortcode `This is some <b>HTML</b>,
|
||||
and a new line with a "quouted string".` */>}}
|
||||
and a new line with a "quoted string".` */>}}
|
||||
```
|
||||
|
||||
### Shortcodes with Markdown
|
||||
@@ -333,7 +333,7 @@ Using the preceding `tweet` example, the following simulates the displayed exper
|
||||
|
||||
### `vimeo`
|
||||
|
||||
Adding a video from [Vimeo][] is equivalent to the YouTube shortcode above.
|
||||
Adding a video from [Vimeo][] is equivalent to the [YouTube Input shortcode][].
|
||||
|
||||
```
|
||||
https://vimeo.com/channels/staffpicks/146022717
|
||||
@@ -431,3 +431,4 @@ To learn more about creating custom shortcodes, see the [shortcode template docu
|
||||
[templatessection]: /templates/
|
||||
[Vimeo]: https://vimeo.com/
|
||||
[YouTube Videos]: https://www.youtube.com/
|
||||
[YouTube Input shortcode]: #youtube
|
||||
|
||||
@@ -151,7 +151,7 @@ go install
|
||||
```
|
||||
|
||||
|
||||
Hugo relies on [mage](github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
|
||||
Hugo relies on [mage](https://github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
|
||||
|
||||
```
|
||||
go get github.com/magefile/mage
|
||||
|
||||
@@ -33,7 +33,7 @@ hugo.Version
|
||||
`hugo` returns an instance that contains the following functions:
|
||||
|
||||
hugo.Environment
|
||||
: the current running environment as defined through the `--environment` cli tag.
|
||||
: the current running environment as defined through the `--environment` cli tag
|
||||
|
||||
hugo.CommitHash
|
||||
: the git commit hash of the current Hugo binary e.g. `0e8bed9ccffba0df554728b46c5bbf6d78ae5247`
|
||||
@@ -41,7 +41,8 @@ hugo.CommitHash
|
||||
hugo.BuildDate
|
||||
: the compile date of the current Hugo binary formatted with RFC 3339 e.g. `2002-10-02T10:00:00-05:00`
|
||||
|
||||
|
||||
hugo.IsProduction
|
||||
: returns true if `hugo.Environment` is set to the production environment
|
||||
|
||||
{{% note "Use the Hugo Generator Tag" %}}
|
||||
We highly recommend using `hugo.Generator` in your website's `<head>`. `hugo.Generator` is included by default in all themes hosted on [themes.gohugo.io](https://themes.gohugo.io). The generator tag allows the Hugo team to track the usage and popularity of Hugo.
|
||||
|
||||
@@ -4,7 +4,7 @@ description: Hugo provides nine mathematical operators in templates.
|
||||
godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
lastmod: 2020-02-23
|
||||
keywords: [math, operators]
|
||||
categories: [functions]
|
||||
menu:
|
||||
@@ -36,3 +36,6 @@ aliases: []
|
||||
| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{math.Ceil 2.1}}` → `3` |
|
||||
| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{math.Floor 1.9}}` → `1` |
|
||||
| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{math.Round 1.5}}` → `2` |
|
||||
| `math.Log` | Returns the natural logarithm of the given number. | `{{math.Log 42}}` → `3.737` |
|
||||
| `math.Sqrt` | Returns the square root of the given number. | `{{math.Sqrt 81}}` → `9` |
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ PlainText
|
||||
Here is a code example for how the render-link.html template could look:
|
||||
|
||||
{{< code file="layouts/_default/_markup/render-link.html" >}}
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text }}</a>
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
{{< /code >}}
|
||||
|
||||
#### Image Markdown example:
|
||||
|
||||
@@ -87,6 +87,9 @@ baseURL
|
||||
blackfriday
|
||||
: See [Configure Blackfriday](/getting-started/configuration-markup#blackfriday)
|
||||
|
||||
build
|
||||
: See [Configure Build](#configure-build)
|
||||
|
||||
buildDrafts (false)
|
||||
: Include drafts when building.
|
||||
|
||||
@@ -135,7 +138,7 @@ enableEmoji (false)
|
||||
enableGitInfo (false)
|
||||
: Enable `.GitInfo` object for each page (if the Hugo site is versioned by Git). This will then update the `Lastmod` parameter for each page using the last git commit date for that content file.
|
||||
|
||||
enableInlineShortcodes
|
||||
enableInlineShortcodes (false)
|
||||
: Enable inline shortcode support. See [Inline Shortcodes](/templates/shortcode-templates/#inline-shortcodes).
|
||||
|
||||
enableMissingTranslationPlaceholders (false)
|
||||
@@ -190,6 +193,9 @@ markup
|
||||
menu
|
||||
: See [Add Non-content Entries to a Menu](/content-management/menus/#add-non-content-entries-to-a-menu).
|
||||
|
||||
minify
|
||||
: See [Configure Minify](#configure-minify)
|
||||
|
||||
module
|
||||
: Module config see [Module Config](/hugo-modules/configuration/).{{< new-in "0.56.0" >}}
|
||||
|
||||
@@ -288,6 +294,59 @@ enableemoji: true
|
||||
```
|
||||
{{% /note %}}
|
||||
|
||||
## Configure Build
|
||||
|
||||
{{< new-in "0.66.0" >}}
|
||||
|
||||
The `build` configuration section contains global build-realated configuration options.
|
||||
|
||||
{{< code-toggle file="config">}}
|
||||
[build]
|
||||
useResourceCacheWhen="fallback"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
useResourceCacheWhen
|
||||
: When to use the cached resources in `/resources/_gen` for PostCSS and ToCSS. Valid values are `never`, `always` and `fallback`. The last value means that the cache will be tried if PostCSS/extended version is not available.
|
||||
|
||||
## Configure Server
|
||||
|
||||
{{< new-in "0.67.0" >}}
|
||||
|
||||
This is only relevant when running `hugo server`, and it allows to set HTTP headers during development, wihch allows you to test out your Content Security Policy and similar. The configuration format matches [Netlify's](https://docs.netlify.com/routing/headers/#syntax-for-the-netlify-configuration-file) with slighly more powerful [Glob matching](https://github.com/gobwas/glob):
|
||||
|
||||
|
||||
{{< code-toggle file="config">}}
|
||||
[server]
|
||||
[[server.headers]]
|
||||
for = "/**.html"
|
||||
|
||||
[server.headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
X-XSS-Protection = "1; mode=block"
|
||||
X-Content-Type-Options = "nosniff"
|
||||
Referrer-Policy = "strict-origin-when-cross-origin"
|
||||
Content-Security-Policy = "script-src localhost:1313"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Since this is is "devlopment only", it may make sense to put it below the `development` environment:
|
||||
|
||||
|
||||
{{< code-toggle file="config/development/server">}}
|
||||
[[headers]]
|
||||
for = "/**.html"
|
||||
|
||||
[headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
X-XSS-Protection = "1; mode=block"
|
||||
X-Content-Type-Options = "nosniff"
|
||||
Referrer-Policy = "strict-origin-when-cross-origin"
|
||||
Content-Security-Policy = "script-src localhost:1313"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
|
||||
|
||||
## Configure Title Case
|
||||
|
||||
Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo. It defaults to [AP Stylebook](https://www.apstylebook.com/) for title casing, but you can also set it to `Chicago` or `Go` (every word starts with a capital letter).
|
||||
@@ -425,6 +484,14 @@ The above will try first to extract the value for `.Date` from the filename, the
|
||||
|
||||
Hugo v0.20 introduced the ability to render your content to multiple output formats (e.g., to JSON, AMP html, or CSV). See [Output Formats][] for information on how to add these values to your Hugo project's configuration file.
|
||||
|
||||
## Configure Minify
|
||||
|
||||
{{< new-in "0.68.0" >}}
|
||||
|
||||
Default configuration:
|
||||
|
||||
{{< code-toggle config="minify" />}}
|
||||
|
||||
## Configure File Caches
|
||||
|
||||
Since Hugo 0.52 you can configure more than just the `cacheDir`. This is the default configuration:
|
||||
|
||||
@@ -305,9 +305,6 @@ Make the directory containing the source your working directory and then fetch H
|
||||
mkdir -p src/github.com/gohugoio
|
||||
ln -sf $(pwd) src/github.com/gohugoio/hugo
|
||||
|
||||
# set the build path for Go
|
||||
export GOPATH=$(pwd)
|
||||
|
||||
go get
|
||||
```
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ In the configuration file for your site, add a `[deployment]` section with one
|
||||
or more `[[deployment.targets]]` section, one for each deployment target. Here's
|
||||
a detailed example:
|
||||
|
||||
```
|
||||
```toml
|
||||
[deployment]
|
||||
# By default, files are uploaded in an arbitrary order.
|
||||
# Files that match the regular expressions in the "Order" list
|
||||
@@ -82,8 +82,16 @@ name = "mydeployment"
|
||||
# If you are using a CloudFront CDN, deploy will invalidate the cache as needed.
|
||||
cloudFrontDistributionID = <ID>
|
||||
|
||||
|
||||
# ... add more [[deployment.targets]] sections ...
|
||||
# Optionally, you can include or exclude specific files.
|
||||
# See https://godoc.org/github.com/gobwas/glob#Glob for the glob pattern syntax.
|
||||
# If non-empty, the pattern is matched against the local path.
|
||||
# All paths are matched against in their filepath.ToSlash form.
|
||||
# If exclude is non-empty, and a local or remote file's path matches it, that file is not synced.
|
||||
# If include is non-empty, and a local or remote file's path does not match it, that file is not synced.
|
||||
# As a result, local files that don't pass the include/exclude filters are not uploaded to remote,
|
||||
# and remote files that don't pass the include/exclude filters are not deleted.
|
||||
# include = "**.html" # would only include files with ".html" suffix
|
||||
# exclude = "**.{jpg, png}" # would exclude files with ".jpg" or ".png" suffix
|
||||
|
||||
|
||||
# [[deployment.matchers]] configure behavior for files that match the Pattern.
|
||||
@@ -108,7 +116,8 @@ gzip = true
|
||||
## Deploy
|
||||
|
||||
To deploy to a target:
|
||||
```
|
||||
|
||||
```bash
|
||||
hugo deploy [--target=<target name>, defaults to first target]
|
||||
```
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ Also see the [CLI Doc](/commands/hugo_mod_clean/).
|
||||
|
||||
Run `hugo mod clean` to delete the entire modules cache.
|
||||
|
||||
Note that you can also configure the `modules` cache with a `maxAge`, see [File Caches](/configuration/#configure-file-caches).
|
||||
Note that you can also configure the `modules` cache with a `maxAge`, see [File Caches](/hugo-modules/configuration/#configure-file-caches).
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,4 +22,6 @@ Any resource of the aforementioned types can be minifed using `resources.Minify`
|
||||
```go-html-template
|
||||
{{ $css := resources.Get "css/main.css" }}
|
||||
{{ $style := $css | resources.Minify }}
|
||||
```
|
||||
```
|
||||
|
||||
Note that you can also minify the final HTML output to `/public` by running `hugo --minify`.
|
||||
|
||||
@@ -39,6 +39,12 @@ config [string]
|
||||
noMap [bool]
|
||||
: Default is `true`. Disable the default inline sourcemaps
|
||||
|
||||
inlineImports [bool] {{< new-in "0.66.0" >}}
|
||||
: Default is `false`. Enable inlining of @import statements. It does so recursively, but will only import a file once.
|
||||
URL imports (e.g. `@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');`) and imports with media queries will be ignored.
|
||||
Note that this import routine does not care about the CSS spec, so you can have @import anywhere in the file.
|
||||
Hugo will look for imports relative to the module mount and will respect theme overrides.
|
||||
|
||||
_If no configuration file is used:_
|
||||
|
||||
use [string]
|
||||
@@ -55,4 +61,21 @@ syntax [string]
|
||||
|
||||
```go-html-template
|
||||
{{ $style := resources.Get "css/main.css" | resources.PostCSS (dict "config" "customPostCSS.js" "noMap" true) }}
|
||||
```
|
||||
|
||||
## Check Hugo Environment from postcss.config.js
|
||||
|
||||
{{< new-in "0.66.0" >}}
|
||||
|
||||
The current Hugo environment name (set by `--environment` or in config or OS environment) is available in the Node context, which allows constructs like this:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('autoprefixer'),
|
||||
...process.env.HUGO_ENVIRONMENT === 'production'
|
||||
? [purgecss]
|
||||
: []
|
||||
]
|
||||
}
|
||||
```
|
||||
|
After Width: | Height: | Size: 113 KiB |
@@ -1,12 +1,12 @@
|
||||
|
||||
---
|
||||
date: 2020-02-20
|
||||
title: "0.65.0"
|
||||
description: "0.65.0"
|
||||
title: "0.65.0: Hugo Reloaded!"
|
||||
description: "Draft, expire, resource bundling, and fine grained publishing control for any page. And it's faster."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
**Hugo 0.65** generalizes how a page is packaged and published to be applicable to **any page**. This should solve some of the most common issues we see people ask and talk about on the [issue tracker](https://github.com/gohugoio/hugo/issues) and on the [forum](https://discourse.gohugo.io/).
|
||||
**Hugo 0.65** generalizes how a page is packaged and published to be applicable to **any page**. This should solve some of the most common issues we see people ask and talk about on the [issue tracker](https://github.com/gohugoio/hugo/issues) and on the [forum](https://discourse.gohugo.io/).
|
||||
|
||||
## Release Highlights
|
||||
|
||||
@@ -39,6 +39,16 @@ Note that all front matter keywords can be set in the [cascade](https://gohugo.i
|
||||
|
||||
We have also upgraded to the latest LibSass (v3.6.3). Nothing remarkable functional new here, but it makes Hugo ready for the upcoming [Dart Backport](https://github.com/sass/libsass/pull/2918).
|
||||
|
||||
And finally, we have added a `GetTerms` method on `Page`, making listing the terms defined on this page in the given taxonomy much simpler:
|
||||
|
||||
```go-html-template
|
||||
<ul>
|
||||
{{ range (.GetTerms "tags") }}
|
||||
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
```
|
||||
|
||||
### New in Hugo Modules
|
||||
|
||||
There are several improvements to the tooling used in [Hugo Modules](https://gohugo.io/hugo-modules/). One bug fix, but also some improvements to make it easier to manage:
|
||||
|
||||
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 74 KiB |
@@ -0,0 +1,81 @@
|
||||
|
||||
---
|
||||
date: 2020-03-03
|
||||
title: "Hugo 0.66.0: PostCSS Edition"
|
||||
description: "Native inline, recursive import support in PostCSS/Tailwind, \"dependency-less\" builds, and more …"
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
This release adds [inline `@import`](/hugo-pipes/postcss/#options) support to `resources.PostCSS`, with imports relative to Hugo's virtual, composable file system. Another useful addition is the new `build` [configuration section](/getting-started/configuration/#configure-build). As an example in `config.toml`:
|
||||
|
||||
```toml
|
||||
[build]
|
||||
useResourceCacheWhen = "always"
|
||||
```
|
||||
|
||||
The above will tell Hugo to _always_ use the cached build resources inside `resources/_gen` for the build steps requiring a non-standard dependency (PostCSS and SCSS/SASS). Valid values are `never`, `always` and `fallback` (default).
|
||||
|
||||
|
||||
This release represents **27 contributions by 8 contributors** to the main Hugo code base.[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@anthonyfok](https://github.com/anthonyfok), [@carlmjohnson](https://github.com/carlmjohnson), and [@sams96](https://github.com/sams96) for their ongoing contributions.
|
||||
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their relentless work on keeping the themes site in pristine condition and to [@davidsneighbour](https://github.com/davidsneighbour) and [@kaushalmodi](https://github.com/kaushalmodi) for all the great work on the documentation site.
|
||||
|
||||
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
|
||||
which has received **8 contributions by 5 contributors**. A special thanks to [@bep](https://github.com/bep), [@nantipov](https://github.com/nantipov), [@regisphilibert](https://github.com/regisphilibert), and [@inwardmovement](https://github.com/inwardmovement) for their work on the documentation site.
|
||||
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 41984+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 439+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 299+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
## Enhancements
|
||||
|
||||
### Templates
|
||||
|
||||
* Change error message on missing resource [d7798906](https://github.com/gohugoio/hugo/commit/d7798906d8e152a5d33f76ed0362628da8dd2c35) [@sams96](https://github.com/sams96) [#6942](https://github.com/gohugoio/hugo/issues/6942)
|
||||
* Add math.Sqrt [d184e505](https://github.com/gohugoio/hugo/commit/d184e5059c72c15df055192b01da0fd8c5b0fc5c) [@StarsoftAnalysis](https://github.com/StarsoftAnalysis) [#6941](https://github.com/gohugoio/hugo/issues/6941)
|
||||
|
||||
### Other
|
||||
|
||||
* Skip some tests on CircleCI [6a34f88d](https://github.com/gohugoio/hugo/commit/6a34f88dcc1ac229247decc008471d7449d6d316) [@bep](https://github.com/bep)
|
||||
* {{ in }} should work with html.Template type [ae383f04](https://github.com/gohugoio/hugo/commit/ae383f04c806687cdae184d6138bcf51edbffcb2) [@carlmjohnson](https://github.com/carlmjohnson) [#7002](https://github.com/gohugoio/hugo/issues/7002)
|
||||
* Regen CLI docs [ee31e61f](https://github.com/gohugoio/hugo/commit/ee31e61fb06bb6e26c9d66d78d8763aabd19e11d) [@bep](https://github.com/bep)
|
||||
* Add --all flag to hugo mod clean [760a87a4](https://github.com/gohugoio/hugo/commit/760a87a45a0a3e6a581851e5cf4fe440e9a8c655) [@bep](https://github.com/bep)
|
||||
* Add build.UseResourceCacheWhen [3d3fa5c3](https://github.com/gohugoio/hugo/commit/3d3fa5c3fe5ee0c9df59d682ee0acaba71a06ae1) [@bep](https://github.com/bep) [#6993](https://github.com/gohugoio/hugo/issues/6993)
|
||||
* Update dependency list in README.md [ee3d0213](https://github.com/gohugoio/hugo/commit/ee3d02134d9b46b10e5a0403c9986ee1833ae6c1) [@anthonyfok](https://github.com/anthonyfok)
|
||||
* Add full filename to image when processing fails [305ce1c9](https://github.com/gohugoio/hugo/commit/305ce1c9ec746d3b8f6c9306b7014bfd621478a5) [@bep](https://github.com/bep) [#7000](https://github.com/gohugoio/hugo/issues/7000)
|
||||
* Update dependency list in README [449deb7f](https://github.com/gohugoio/hugo/commit/449deb7f9ce089236f8328dd4fa585bea6e9bfde) [@anthonyfok](https://github.com/anthonyfok)
|
||||
* Add basic @import support to resources.PostCSS [b66d38c4](https://github.com/gohugoio/hugo/commit/b66d38c41939252649365822d9edb10cf5990617) [@bep](https://github.com/bep) [#6957](https://github.com/gohugoio/hugo/issues/6957)[#6961](https://github.com/gohugoio/hugo/issues/6961)
|
||||
* Implement include/exclude filters for deploy [05a74eae](https://github.com/gohugoio/hugo/commit/05a74eaec0d944a4b29445c878a431cd6ae12277) [@vangent](https://github.com/vangent) [#6922](https://github.com/gohugoio/hugo/issues/6922)
|
||||
* Update to Go 1.14 and 1.13.8 [33ae6210](https://github.com/gohugoio/hugo/commit/33ae62108325f703f1eaeabef1e8a80950229415) [@bep](https://github.com/bep) [#6958](https://github.com/gohugoio/hugo/issues/6958)
|
||||
* Add hugo.IsProduction function [1352bc88](https://github.com/gohugoio/hugo/commit/1352bc880df4cd25eff65843973fcc0dd21b6304) [@hcwong](https://github.com/hcwong) [#6873](https://github.com/gohugoio/hugo/issues/6873)
|
||||
* Apply missing go fmt [76b2afe6](https://github.com/gohugoio/hugo/commit/76b2afe642c37aedc7269b41d6fca5b78f467ce4) [@bep](https://github.com/bep)
|
||||
|
||||
## Fixes
|
||||
|
||||
### Output
|
||||
|
||||
* Fix panic on no output formats [f4605303](https://github.com/gohugoio/hugo/commit/f46053034759c4f9790a79e0a146dbc1b426b1ff) [@bep](https://github.com/bep) [#6924](https://github.com/gohugoio/hugo/issues/6924)
|
||||
|
||||
### Core
|
||||
|
||||
* Fix error handling in page collector [3e9db2ad](https://github.com/gohugoio/hugo/commit/3e9db2ad951dbb1000cd0f8f25e4a95445046679) [@bep](https://github.com/bep) [#6988](https://github.com/gohugoio/hugo/issues/6988)
|
||||
* Fix 2 Paginator.Pages taxonomy regressions [7ef5a4c8](https://github.com/gohugoio/hugo/commit/7ef5a4c83e4560bced3eee0ccf0e0db176146f44) [@bep](https://github.com/bep) [#6921](https://github.com/gohugoio/hugo/issues/6921)[#6918](https://github.com/gohugoio/hugo/issues/6918)
|
||||
* Fix deletion of orphaned sections [a70bbd06](https://github.com/gohugoio/hugo/commit/a70bbd0696df3b0a6889650e48a07f8223151da4) [@bep](https://github.com/bep) [#6920](https://github.com/gohugoio/hugo/issues/6920)
|
||||
|
||||
### Other
|
||||
|
||||
* Fix ref/relref short lookup for pages in sub-folder [8947c3fa](https://github.com/gohugoio/hugo/commit/8947c3fa0beec021e14b3f8040857335e1ecd473) [@bep](https://github.com/bep) [#6952](https://github.com/gohugoio/hugo/issues/6952)
|
||||
* Fix ref/relRef regression for relative refs from bundles [1746e8a9](https://github.com/gohugoio/hugo/commit/1746e8a9b2be46dcd6cecbb4bc90983a9c69b333) [@bep](https://github.com/bep) [#6952](https://github.com/gohugoio/hugo/issues/6952)
|
||||
* Fix potential infinite recursion in server change detection [6f48146e](https://github.com/gohugoio/hugo/commit/6f48146e75e9877c4271ec239b763e6f3bc3babb) [@bep](https://github.com/bep) [#6986](https://github.com/gohugoio/hugo/issues/6986)
|
||||
* Fix rebuild logic when editing template using a base template [b0d85032](https://github.com/gohugoio/hugo/commit/b0d850321e58a052ead25f7014b7851f63497601) [@bep](https://github.com/bep) [#6968](https://github.com/gohugoio/hugo/issues/6968)
|
||||
* Fix panic when home page is drafted [0bd6356c](https://github.com/gohugoio/hugo/commit/0bd6356c6d2a2bac06d0c3705bf13a90cb7a2688) [@bep](https://github.com/bep) [#6927](https://github.com/gohugoio/hugo/issues/6927)
|
||||
* Fix goldmark toc rendering [ca68abf0](https://github.com/gohugoio/hugo/commit/ca68abf0bc2fa003c2052143218f7b2ab195a46e) [@satotake](https://github.com/satotake) [#6736](https://github.com/gohugoio/hugo/issues/6736)[#6809](https://github.com/gohugoio/hugo/issues/6809)
|
||||
* Fix crashes for 404 in IsAncestor etc. [a524124b](https://github.com/gohugoio/hugo/commit/a524124beb0e7ca226c207ea48a90cea2cbef76e) [@bep](https://github.com/bep) [#6931](https://github.com/gohugoio/hugo/issues/6931)
|
||||
* Fix panic in 404.Parent [4c2a0de4](https://github.com/gohugoio/hugo/commit/4c2a0de412a850745ad32e580fcd65575192ca53) [@bep](https://github.com/bep) [#6924](https://github.com/gohugoio/hugo/issues/6924)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 78 KiB |
@@ -0,0 +1,64 @@
|
||||
|
||||
---
|
||||
date: 2020-03-09
|
||||
title: "Hugo 0.67.0: Custom HTTP headers"
|
||||
description: "This version brings Custom HTTP headers to the development server and exclude/include filters in Hugo Deploy."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
The two main items in Hugo 0.67.0 is custom HTTP header support in `hugo server` and include/exclude filters for [Hugo Deploy](https://gohugo.io/hosting-and-deployment/hugo-deploy/#readout).
|
||||
|
||||
Being able to [configure HTTP headers](https://gohugo.io/getting-started/configuration/#configure-server) in your development server means that you can now verify how your site behaves with the intended Content Security Policy settings etc., e.g.:
|
||||
|
||||
```toml
|
||||
[server]
|
||||
[[server.headers]]
|
||||
for = "/**.html"
|
||||
|
||||
[server.headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
X-XSS-Protection = "1; mode=block"
|
||||
X-Content-Type-Options = "nosniff"
|
||||
Referrer-Policy = "strict-origin-when-cross-origin"
|
||||
Content-Security-Policy = "script-src localhost:1313"
|
||||
```
|
||||
|
||||
**Note:** This release also changes how raw HTML files inside /content is processed to be in line with the documentation. See [#7030](https://github.com/gohugoio/hugo/issues/7030).
|
||||
|
||||
This release represents **7 contributions by 4 contributors** to the main Hugo code base.[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@satotake](https://github.com/satotake), [@sams96](https://github.com/sams96), and [@davidejones](https://github.com/davidejones) for their ongoing contributions.
|
||||
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their relentless work on keeping the themes site in pristine condition and to [@davidsneighbour](https://github.com/davidsneighbour) and [@kaushalmodi](https://github.com/kaushalmodi) for all the great work on the documentation site.
|
||||
|
||||
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
|
||||
which has received **5 contributions by 5 contributors**. A special thanks to [@bep](https://github.com/bep), [@psliwka](https://github.com/psliwka), [@digitalcraftsman](https://github.com/digitalcraftsman), and [@jasikpark](https://github.com/jasikpark) for their work on the documentation site.
|
||||
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 42176+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 439+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 301+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
## Enhancements
|
||||
|
||||
### Other
|
||||
|
||||
* Doument the server config [63393230](https://github.com/gohugoio/hugo/commit/63393230c9d3ba19ad182064787e3bfd7ecf82d8) [@bep](https://github.com/bep)
|
||||
* Support unComparable args of uniq/complement/in [8279d2e2](https://github.com/gohugoio/hugo/commit/8279d2e2271ee64725133d36a12d1d7e2158bffd) [@satotake](https://github.com/satotake) [#6105](https://github.com/gohugoio/hugo/issues/6105)
|
||||
* Add HTTP header support for the dev server [10831444](https://github.com/gohugoio/hugo/commit/108314444b510bfc330ccac745dce7beccd52c91) [@bep](https://github.com/bep) [#7031](https://github.com/gohugoio/hugo/issues/7031)
|
||||
* Add include and exclude support for remote [51e178a6](https://github.com/gohugoio/hugo/commit/51e178a6a28a3f305d89ebb489675743f80862ee) [@davidejones](https://github.com/davidejones)
|
||||
|
||||
## Fixes
|
||||
|
||||
### Templates
|
||||
|
||||
* Fix error with unicode in file paths [c4fa2f07](https://github.com/gohugoio/hugo/commit/c4fa2f07996c7f1f4e257089a3c3c5b4c1339722) [@sams96](https://github.com/sams96) [#6996](https://github.com/gohugoio/hugo/issues/6996)
|
||||
|
||||
### Other
|
||||
|
||||
* Fix ambigous error on site.GetPage [6cceef65](https://github.com/gohugoio/hugo/commit/6cceef65c2f4b7c262bf67a249867658112b6de4) [@bep](https://github.com/bep) [#7016](https://github.com/gohugoio/hugo/issues/7016)
|
||||
* Fix handling of HTML files without front matter [ffcb4aeb](https://github.com/gohugoio/hugo/commit/ffcb4aeb8e392a80da7cad0f1e03a4102efb24ec) [@bep](https://github.com/bep) [#7030](https://github.com/gohugoio/hugo/issues/7030)[#7028](https://github.com/gohugoio/hugo/issues/7028)[#6789](https://github.com/gohugoio/hugo/issues/6789)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
---
|
||||
date: 2020-03-15
|
||||
title: "Hugo 0.67.1: A couple of Bug Fixes"
|
||||
description: "This version comes with some useful bug fixes."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
Some minor fixes:
|
||||
|
||||
* metrics: Fix --templateMetricsHints [5eadc4c0](https://github.com/gohugoio/hugo/commit/5eadc4c0a8e5c51e72670591c4b7877e79c15e3c) [@bep](https://github.com/bep) [#7048](https://github.com/gohugoio/hugo/issues/7048)
|
||||
* resources: Add data context to the key in ExecuteAsTemplate [18cb21ff](https://github.com/gohugoio/hugo/commit/18cb21ff2e4a60e7094908e4d6113a9d5a086316) [@bep](https://github.com/bep) [#7046](https://github.com/gohugoio/hugo/issues/7046)
|
||||
* Improve Tailwind/PostCSS error messages [df298558](https://github.com/gohugoio/hugo/commit/df298558a5a5b747288d9656402af85e0ac75a43) [@bep](https://github.com/bep) [#7041](https://github.com/gohugoio/hugo/issues/7041)[#7042](https://github.com/gohugoio/hugo/issues/7042)
|
||||
* deps: Update Blackfriday [b1106f87](https://github.com/gohugoio/hugo/commit/b1106f8715cac3544b8ea662b969336fe56fa047) [@bep](https://github.com/bep) [#7039](https://github.com/gohugoio/hugo/issues/7039)
|
||||
* resources: Try to fix a Go 1.15 go vet error [c0177fe2](https://github.com/gohugoio/hugo/commit/c0177fe2b28eb09d1534e62370849c3f1d70b40f) [@bep](https://github.com/bep)
|
||||
* Add languageDirection to language configuration [5914f91b](https://github.com/gohugoio/hugo/commit/5914f91b6c980e42693661d5fd5640e237691df6) [@le0tan](https://github.com/le0tan) [#6550](https://github.com/gohugoio/hugo/issues/6550)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
---
|
||||
date: 2020-03-21
|
||||
title: "0.68.0"
|
||||
description: "0.68.0"
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
|
||||
This release (finally) brings minify configuration, a big thanks to [@satotake](https://github.com/satotake) for that contribution. See [Configure Minify](https://gohugo.io/getting-started/configuration/#configure-minify) for details.
|
||||
|
||||
We have also extended the [Page Build Options](https://gohugo.io/content-management/build-options/) to allow fully navigable headless sections.
|
||||
|
||||
This release represents **17 contributions by 6 contributors** to the main Hugo code base.[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@evankanderson](https://github.com/evankanderson), [@QuLogic](https://github.com/QuLogic), and [@le0tan](https://github.com/le0tan) for their ongoing contributions.
|
||||
|
||||
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their relentless work on keeping the themes site in pristine condition and to [@davidsneighbour](https://github.com/davidsneighbour) and [@kaushalmodi](https://github.com/kaushalmodi) for all the great work on the documentation site.
|
||||
|
||||
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
|
||||
which has received **3 contributions by 3 contributors**.
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 42462+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 439+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 300+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
## Enhancements
|
||||
|
||||
### Other
|
||||
|
||||
* Some minify configuration adjustments [7204b354](https://github.com/gohugoio/hugo/commit/7204b354a9f46778f068a4712447d6d4fefbefd8) [@bep](https://github.com/bep)
|
||||
* Add minify config [574c2959](https://github.com/gohugoio/hugo/commit/574c2959b8d3338764fa1db102a5e0fd6ed322d9) [@satotake](https://github.com/satotake) [#6750](https://github.com/gohugoio/hugo/issues/6750)[#6892](https://github.com/gohugoio/hugo/issues/6892)
|
||||
* Allow headless bundles to list pages via $page.Pages and $page.RegularPages [99958f90](https://github.com/gohugoio/hugo/commit/99958f90fedec11d749a1397300860aa8e8459c2) [@bep](https://github.com/bep) [#7075](https://github.com/gohugoio/hugo/issues/7075)
|
||||
* Update to Go 1.14.1 and 1.13.9 [1d91d8e1](https://github.com/gohugoio/hugo/commit/1d91d8e14b13bd135dc4d4a901fc936c9649b219) [@bep](https://github.com/bep) [#7078](https://github.com/gohugoio/hugo/issues/7078)
|
||||
* Pass directory name to filters in LstatIfPossible in the same way as Readdir [cc2a5d52](https://github.com/gohugoio/hugo/commit/cc2a5d52a4ad188d93aeb2d51d5c19c7661e098d) [@evankanderson](https://github.com/evankanderson)
|
||||
* Update to goldmark 1.1.25. [52c159c4](https://github.com/gohugoio/hugo/commit/52c159c452ab7f48369b5cc9ecc57ecc8dc91654) [@QuLogic](https://github.com/QuLogic)
|
||||
* Add workaround for regular CSS imports in SCSS [1a8af7d4](https://github.com/gohugoio/hugo/commit/1a8af7d4f087256710ae0bdf504ed53c0c24a211) [@bep](https://github.com/bep) [#7059](https://github.com/gohugoio/hugo/issues/7059)
|
||||
* Add .RegularPagesRecursive [03b93bb9](https://github.com/gohugoio/hugo/commit/03b93bb9884ea479c855c2699e8c7b039dce6224) [@bep](https://github.com/bep) [#6411](https://github.com/gohugoio/hugo/issues/6411)
|
||||
* Add data context to the key in ExecuteAsTemplate [18cb21ff](https://github.com/gohugoio/hugo/commit/18cb21ff2e4a60e7094908e4d6113a9d5a086316) [@bep](https://github.com/bep) [#7046](https://github.com/gohugoio/hugo/issues/7046)
|
||||
* Improve Tailwind/PostCSS error messages [df298558](https://github.com/gohugoio/hugo/commit/df298558a5a5b747288d9656402af85e0ac75a43) [@bep](https://github.com/bep) [#7041](https://github.com/gohugoio/hugo/issues/7041)[#7042](https://github.com/gohugoio/hugo/issues/7042)
|
||||
* Update Blackfriday [b1106f87](https://github.com/gohugoio/hugo/commit/b1106f8715cac3544b8ea662b969336fe56fa047) [@bep](https://github.com/bep) [#7039](https://github.com/gohugoio/hugo/issues/7039)
|
||||
* Add languageDirection to language configuration [5914f91b](https://github.com/gohugoio/hugo/commit/5914f91b6c980e42693661d5fd5640e237691df6) [@le0tan](https://github.com/le0tan) [#6550](https://github.com/gohugoio/hugo/issues/6550)
|
||||
|
||||
## Fixes
|
||||
|
||||
### Other
|
||||
|
||||
* Fix Go build version [2ebb9f54](https://github.com/gohugoio/hugo/commit/2ebb9f5484162062c74698237bcdaa31cb8666b9) [@bep](https://github.com/bep)
|
||||
* Fix GetTerms nil pointer [95f49211](https://github.com/gohugoio/hugo/commit/95f492114e33fc6e4d9dcfd2b7c1eca5c50d755f) [@carlmjohnson](https://github.com/carlmjohnson) [#7061](https://github.com/gohugoio/hugo/issues/7061)
|
||||
* Fix scss vs css import regexp [c7b6d74e](https://github.com/gohugoio/hugo/commit/c7b6d74e898c78da9f5e272e528ff9654206576e) [@bep](https://github.com/bep) [#7063](https://github.com/gohugoio/hugo/issues/7063)
|
||||
* Fix --templateMetricsHints [5eadc4c0](https://github.com/gohugoio/hugo/commit/5eadc4c0a8e5c51e72670591c4b7877e79c15e3c) [@bep](https://github.com/bep) [#7048](https://github.com/gohugoio/hugo/issues/7048)
|
||||
* Try to fix a Go 1.15 go vet error [c0177fe2](https://github.com/gohugoio/hugo/commit/c0177fe2b28eb09d1534e62370849c3f1d70b40f) [@bep](https://github.com/bep)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
---
|
||||
date: 2020-03-22
|
||||
title: "Hugo 0.68.1: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.68.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with one important fix.
|
||||
|
||||
* Revert "resources: Add data context to the key in ExecuteAsTemplate" [c9dc316a](https://github.com/gohugoio/hugo/commit/c9dc316ad160e78c9dff4e75313db4cac8ea6414) [@bep](https://github.com/bep) [#7064](https://github.com/gohugoio/hugo/issues/7064)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
---
|
||||
date: 2020-03-24
|
||||
title: "Hugo 0.68.2: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.68.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with one important fix.
|
||||
|
||||
* Fix cache reset for a page's collections on server live reload [cfa73050](https://github.com/gohugoio/hugo/commit/cfa73050a49b2646fe3557cefa0ed31989b0eeeb) [@bep](https://github.com/bep) [#7085](https://github.com/gohugoio/hugo/issues/7085)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
---
|
||||
date: 2020-03-24
|
||||
title: "Hugo 0.68.3: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.68.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with one important fix.
|
||||
|
||||
* Fix _build.list.local logic [523d5194](https://github.com/gohugoio/hugo/commit/523d51948fc20e2afb4721b43203c5ab696ae220) [@bep](https://github.com/bep) [#7089](https://github.com/gohugoio/hugo/issues/7089)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
[**Aether**](https://getaether.net) is an open-source peer-to-peer network that hosts self-moderating online-communities.
|
||||
|
||||
[**Aether Pro**](https://aether.app), based on Aether, is a collaboration tool for remote-friendly companies.
|
||||
|
||||
The site is built by:
|
||||
|
||||
* [Burak Nehbit](https://twitter.com/nehbit)
|
||||
|
||||
|
After Width: | Height: | Size: 269 KiB |
@@ -0,0 +1,39 @@
|
||||
---
|
||||
|
||||
title: Aether
|
||||
date: 2020-02-26
|
||||
description: "Showcase: \"Hugo is not just a static site generator for us, it's the core framework at the heart of our entire web front-end.\""
|
||||
|
||||
# The URL to the site on the internet.
|
||||
siteURL: https://getaether.net
|
||||
|
||||
# Add credit to the article author. Leave blank or remove if not needed/wanted.
|
||||
byline: "[Burak Nehbit](https://twitter.com/nehbit), Maintainer, Aether"
|
||||
|
||||
---
|
||||
|
||||
To say that this website, our main online presence, needed to do a lot would be an understatement.
|
||||
|
||||
Our site is home to both *Aether* and *Aether Pro*, our **knowledgebase for each product**, a **server for static assets that we use in our emails**, the **interactive sign-up flows**, **payments client**, **downloads provider**, and even a **mechanism for delivering auto-update notifications** to our native clients. We are using a single Hugo site for all these — it's not a static site generator for us, it's the core framework at the heart of our *entire* web front-end.
|
||||
|
||||
Not only that, this had to work with one developer crunched for time who spends most of his time working on two separate apps across 3 desktop platforms — someone whose main job is very far from building static websites. We only had scraps of time to design and build this Hugo site, make it performant and scalable, and Hugo did a phenomenal job delivering on that promise.
|
||||
|
||||
The last piece is, funnily enough, moving our blog to Hugo, which it is not as of now. This was an inherited mistake we are currently rectifying. Soon, our entire web footprint will be living in Hugo.
|
||||
|
||||
### Structure
|
||||
|
||||
Our website is built in such a way that there is a separate Vue.js instance for each of the contexts since we are no using JS-based single-page navigation. We use Hugo for navigation and to build most pages. For the pages we need to make interactive, we use Vue.js to build individual, self-contained single-page Javascript apps. One such example is our sign-up flow at [aether.app](https://aether.app), an individual Vue app living within a Hugo page, with its own JS-based navigation.
|
||||
|
||||
This is a relatively complex setup, and somewhat out of the ordinary. Yet, even with this custom setup, using Hugo was painless.
|
||||
|
||||
### Tools
|
||||
|
||||
**CMS**: Hugo
|
||||
|
||||
**Theme**: Custom-designed
|
||||
|
||||
**Hosting**: Netlify, pushed to production via `git push`.
|
||||
|
||||
**Javascript runtime**: Vue.js
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ images = ["post-cover.png"]
|
||||
{{</ code-toggle >}}
|
||||
|
||||
If `images` aren't specified in the page front-matter, then hugo searches for [image page resources](/content-management/image-processing/) with `feature`, `cover`, or `thumbnail` in their name.
|
||||
If no image resources with those names are found, the images defined in the [site config](getting-started/configuration/) are used instead.
|
||||
If no image resources with those names are found, the images defined in the [site config](/getting-started/configuration/) are used instead.
|
||||
If no images are found at all, then an image-less Twitter `summary` card is used instead of `summary_large_image`.
|
||||
|
||||
Hugo uses the page title and description for the card's title and description fields. The page summary is used if no description is given.
|
||||
|
||||
@@ -239,7 +239,7 @@ Hugo will look for the name given, so you can name it whatever you want. But if
|
||||
[partial name].[OutputFormat].[suffix]
|
||||
```
|
||||
|
||||
The partial below is a plain text template (Outpuf Format is `CSV`, and since this is the only output format with the suffix `csv`, we don't need to include the Output Format's `Name`):
|
||||
The partial below is a plain text template (Output Format is `CSV`, and since this is the only output format with the suffix `csv`, we don't need to include the Output Format's `Name`):
|
||||
|
||||
```
|
||||
{{ partial "mytextpartial.csv" . }}
|
||||
|
||||
@@ -49,10 +49,12 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import
|
||||
- [wordpress-to-hugo-exporter](https://github.com/SchumacherFM/wordpress-to-hugo-exporter) - A one-click WordPress plugin that converts all posts, pages, taxonomies, metadata, and settings to Markdown and YAML which can be dropped into Hugo. (Note: If you have trouble using this plugin, you can [export your site for Jekyll](https://wordpress.org/plugins/jekyll-exporter/) and use Hugo's built in Jekyll converter listed above.)
|
||||
- [exitwp-for-hugo](https://github.com/wooni005/exitwp-for-hugo) - A python script which works with the xml export from Wordpress and converts Wordpress pages and posts to Markdown and YAML for hugo.
|
||||
- [blog2md](https://github.com/palaniraja/blog2md) - Works with [exported xml](https://en.support.wordpress.com/export/) file of your free YOUR-TLD.wordpress.com website. It also saves approved comments to `YOUR-POST-NAME-comments.md` file along with posts.
|
||||
- [wordhugopress](https://github.com/nantipov/wordhugopress) - A small utility written in Java, exports the entire WordPress site from the database and resource (e.g. images) files stored locally or remotelly. Therefore, migration from the backup files is possible. Supports merging of the multiple WordPress sites into a single Hugo one.
|
||||
|
||||
## Medium
|
||||
|
||||
- [medium2md](https://github.com/gautamdhameja/medium-2-md) - A simple Medium to Hugo exporter able to import stories in one command, including Front Matter.
|
||||
- [medium-to-hugo](https://github.com/bgadrian/medium-to-hugo) - CLI tool written in Go to export medium posts into a Hugo compatible Markdown format. Tags and images are included. All images will be downloaded locally and linked appropriately.
|
||||
|
||||
## Tumblr
|
||||
|
||||
|
||||
@@ -31,3 +31,4 @@ A static website with a dynamic search function? Yes, Hugo provides an alternati
|
||||
|
||||
* [Algolia](https://www.algolia.com/)'s Search API makes it easy to deliver a great search experience in your apps and websites. Algolia Search provides hosted full-text, numerical, faceted, and geolocalized search.
|
||||
* [Bonsai](https://www.bonsai.io) is a fully-managed hosted Elasticsearch service that is fast, reliable, and simple to set up. Easily ingest your docs from Hugo into Elasticsearch following [this guide from the docs](https://docs.bonsai.io/docs/hugo).
|
||||
* [ExpertRec](https://www.expertrec.com/) is a hosted search-as-a-service solution that is fast and scalable. Set-up and integration is extremely easy and takes only a few minutes. The search settings can be modified without coding using a dashboard.
|
||||
|
||||
@@ -1415,7 +1415,7 @@
|
||||
"goldmark": {
|
||||
"renderer": {
|
||||
"hardWraps": false,
|
||||
"xHTML": false,
|
||||
"xhtml": false,
|
||||
"unsafe": false
|
||||
},
|
||||
"parser": {
|
||||
@@ -1451,6 +1451,36 @@
|
||||
"footnoteAnchorPrefix": "",
|
||||
"footnoteReturnLinkContents": ""
|
||||
}
|
||||
},
|
||||
"minify": {
|
||||
"minifyOutput": false,
|
||||
"disableHTML": false,
|
||||
"disableCSS": false,
|
||||
"disableJS": false,
|
||||
"disableJSON": false,
|
||||
"disableSVG": false,
|
||||
"disableXML": false,
|
||||
"tdewolff": {
|
||||
"html": {
|
||||
"keepConditionalComments": true,
|
||||
"keepDefaultAttrVals": true,
|
||||
"keepDocumentTags": true,
|
||||
"keepEndTags": true,
|
||||
"keepWhitespace": false
|
||||
},
|
||||
"css": {
|
||||
"decimals": -1,
|
||||
"keepCSS2": true
|
||||
},
|
||||
"js": {},
|
||||
"json": {},
|
||||
"svg": {
|
||||
"decimals": -1
|
||||
},
|
||||
"xml": {
|
||||
"keepWhitespace": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"media": {
|
||||
@@ -3192,6 +3222,12 @@
|
||||
"Aliases": null,
|
||||
"Examples": null
|
||||
},
|
||||
"IsProduction": {
|
||||
"Description": "",
|
||||
"Args": null,
|
||||
"Aliases": null,
|
||||
"Examples": null
|
||||
},
|
||||
"Version": {
|
||||
"Description": "",
|
||||
"Args": null,
|
||||
@@ -3544,6 +3580,19 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
"Sqrt": {
|
||||
"Description": "Sqrt returns the square root of a number.\nNOTE: will return for NaN for negative values of a",
|
||||
"Args": [
|
||||
"a"
|
||||
],
|
||||
"Aliases": null,
|
||||
"Examples": [
|
||||
[
|
||||
"{{math.Sqrt 81}}",
|
||||
"9"
|
||||
]
|
||||
]
|
||||
},
|
||||
"Sub": {
|
||||
"Description": "Sub subtracts two numbers.",
|
||||
"Args": [
|
||||
|
||||
@@ -3,7 +3,7 @@ publish = "public"
|
||||
command = "hugo --gc --minify"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.64.1"
|
||||
HUGO_VERSION = "0.67.1"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
@@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
||||
command = "hugo --gc --minify --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.64.1"
|
||||
HUGO_VERSION = "0.67.1"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.64.1"
|
||||
HUGO_VERSION = "0.67.1"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.64.1"
|
||||
HUGO_VERSION = "0.67.1"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 66 KiB |