summaryrefslogtreecommitdiffstats
path: root/commands
AgeCommit message (Collapse)Author
2018-12-06Add tpl/site and tpl/hugoBjørn Erik Pedersen
This means that the current `.Site` and ´.Hugo` is available as a globals, so you can do `site.IsServer`, `hugo.Version` etc. Fixes #5470 Fixes #5467 Fixes #5503
2018-11-24commands: Include drafts in convert commandBjørn Erik Pedersen
Fixes #5457
2018-11-18Fix ignored --config flag with 'new' commandKris Budhram
2018-11-15Fix Permalink for resource, baseURL with path and canonifyURLs setBjørn Erik Pedersen
Fixes #5226
2018-11-13Add a consolidated file cacheBjørn Erik Pedersen
This commits reworks how file caching is performed in Hugo. Now there is only one way, and it can be configured. This is the default configuration: ```toml [caches] [caches.getjson] dir = ":cacheDir" maxAge = -1 [caches.getcsv] dir = ":cacheDir" maxAge = -1 [caches.images] dir = ":resourceDir/_gen" maxAge = -1 [caches.assets] dir = ":resourceDir/_gen" maxAge = -1 ``` You can override any of these cache setting in your own `config.toml`. The placeholders explained: `:cacheDir`: This is the value of the `cacheDir` config option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache` directory below the OS temp dir for the others. `:resourceDir`: This is the value of the `resourceDir` config option. `maxAge` is the time in seconds before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml Fixes #5404
2018-11-06commands: Fix spelling秦世成
2018-11-04commands: Add --minify to hugo serverBjørn Erik Pedersen
2018-11-03commands: Fix recently broken error templateBjørn Erik Pedersen
We need a test for this ...
2018-11-03Make WARN the new default log log levelBjørn Erik Pedersen
This commit also pulls down the log level for a set of WARN statements to INFO. There should be no ERRORs or WARNINGs in a regular Hugo build. That is the story about the Boy Who Cried Wolf. Since the WARN log is now more visible, this commit also improves on some of them, most notable the "layout not found", which now would look something like this: ```bash WARN 2018/11/02 09:02:18 Found no layout for "home", language "en", output format "CSS": create a template below /layouts with one of these filenames: index.en.css.css, home.en.css.css, list.en.css.css, index.css.css, home.css.css, list.css.css, index.en.css, home.en.css, list.en.css, index.css, home.css, list.css, _default/index.en.css.css, _default/home.en.css.css, _default/list.en.css.css, _default/index.css.css, _default/home.css.css, _default/list.css.css, _default/index.en.css, _default/home.en.css, _default/list.en.css, _default/index.css, _default/home.css, _default/list.css ``` Fixes #5203
2018-11-02Skip watcher event files if matched in ignoreFilesKris Budhram
2018-11-01Add file (line/col) info to ref/relref errorsBjørn Erik Pedersen
See #5371
2018-10-28common/loggers: Make sure the global logger also gets colored labelsBjørn Erik Pedersen
See #4414
2018-10-26commands: Truncate the error log on repeated config errorsBjørn Erik Pedersen
2018-10-26commands: Only show Ansi escape codes if in a terminalBjørn Erik Pedersen
2018-10-24Revert "commands: Read disableFastRender from flag even if it's not changed"Bjørn Erik Pedersen
On second thought, removing this isn't worth it. This reverts commit 78a4c2e32ef9ea8e92bb7bb3586e4c22b02eb494.
2018-10-24commands: Read disableFastRender from flag even if it's not changedBjørn Erik Pedersen
Fixes #5353
2018-10-24comamnds: Use overflow-x: auto; for browser errorsBjørn Erik Pedersen
2018-10-24common/loggers: Remove the ANSI color for the browser error versionBjørn Erik Pedersen
2018-10-23commands, hugolib: Get file context in "config parse failed" errorsBjørn Erik Pedersen
Fixes #5325
2018-10-22hugolib: Improve errors in /i18n handllingBjørn Erik Pedersen
See #5324
2018-10-22hugolib: Continue the file context/line number errors workBjørn Erik Pedersen
See #5324
2018-10-22Convert the rest to new page parser code pathsBjørn Erik Pedersen
And remove some now unused code. See #5324
2018-10-22parser/metadecoders: Consolidate the metadata decodersBjørn Erik Pedersen
See #5324
2018-10-22commands: Avoid panic in error handler on config errorsBjørn Erik Pedersen
2018-10-17Prevent stale content in Fast Render ModeBjørn Erik Pedersen
We do that by re-render visited pages that is not already in the stack. This may potentially do some double work, but that small penalty should be well worth it. Fixes #5281
2018-10-16commands: Show server error info in browserBjørn Erik Pedersen
The main item in this commit is showing of errors with a file context when running `hugo server`. This can be turned off: `hugo server --disableBrowserError` (can also be set in `config.toml`). But to get there, the error handling in Hugo needed a revision. There are some items left TODO for commits soon to follow, most notable errors in content and config files. Fixes #5284 Fixes #5290 See #5325 See #5324
2018-10-16Revert "commands: Add .gitignore "hugo new site""Bjørn Erik Pedersen
This fails on Windows, so it needs to be reconsidered. This reverts commit 92979d92889ff8991acfadd42982c2e55d01b163.
2018-10-16commands: Add .gitignore "hugo new site"Nathaniel Peiffer
2018-10-15commands: Add help text to "hugo new"Elliot Forbes
2018-09-23Add directory based archetypesBjørn Erik Pedersen
Given this content: ```bash archetypes ├── default.md └── post-bundle ├── bio.md ├── images │   └── featured.jpg └── index.md ``` ```bash hugo new --kind post-bundle post/my-post ``` Will create a new folder in `/content/post/my-post` with the same set of files as in the `post-bundle` archetypes folder. This commit also improves the archetype language detection, so, if you use template code in your content files, the `.Site` you get is for the correct language. This also means that it is now possible to translate strings defined in the `i18n` bundles, e.g. `{{ i18n "hello" }}`. Fixes #4535
2018-09-21commands: Remove deprecated flagsBjørn Erik Pedersen
2018-09-07commands: Fix golint issuesCameron Moore
commands/hugo.go:65:1: exported method Response.IsUserError should have comment or be unexported commands/import_jekyll.go:100:21: error strings should not be capitalized or end with punctuation or a newline commands/server.go:417:1: receiver name sc should be consistent with previous receiver name s for serverCmd
2018-08-16Add configFile(s) back to the watch list after REMOVE eventAnthony Fok
Fixes #4701
2018-08-16commands: Gracefully handle typos in server config when running the serverBjørn Erik Pedersen
Fixes #5081
2018-08-14commands: Include theme name in version mismatch errorBjørn Erik Pedersen
Fixes #5044
2018-08-06Add support for minification of final outputBjørn Erik Pedersen
Hugo Pipes added minification support for resources fetched via ´resources.Get` and similar. This also adds support for minification of the final output for supported output formats: HTML, XML, SVG, CSS, JavaScript, JSON. To enable, run Hugo with the `--minify` flag: ```bash hugo --minify ``` This commit is also a major spring cleaning of the `transform` package to allow the new minification step fit into that processing chain. Fixes #1251
2018-07-22Get rid of the utils packageBjørn Erik Pedersen
2018-07-22Update hugo_windows.goBjørn Erik Pedersen
2018-07-18commands: Disable flaky server tests on Windows CIBjørn Erik Pedersen
2018-07-18commands: Increase sleep in server teset to make it less shaky on WindowsBjørn Erik Pedersen
2018-07-08Add "extended" to "hugo version"Anthony Fok
Fixes #4913
2018-07-06Add Hugo Piper with SCSS support and much moreBjørn Erik Pedersen
Before this commit, you would have to use page bundles to do image processing etc. in Hugo. This commit adds * A new `/assets` top-level project or theme dir (configurable via `assetDir`) * A new template func, `resources.Get` which can be used to "get a resource" that can be further processed. This means that you can now do this in your templates (or shortcodes): ```bash {{ $sunset := (resources.Get "images/sunset.jpg").Fill "300x200" }} ``` This also adds a new `extended` build tag that enables powerful SCSS/SASS support with source maps. To compile this from source, you will also need a C compiler installed: ``` HUGO_BUILD_TAGS=extended mage install ``` Note that you can use output of the SCSS processing later in a non-SCSSS-enabled Hugo. The `SCSS` processor is a _Resource transformation step_ and it can be chained with the many others in a pipeline: ```bash {{ $css := resources.Get "styles.scss" | resources.ToCSS | resources.PostCSS | resources.Minify | resources.Fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` The transformation funcs above have aliases, so it can be shortened to: ```bash {{ $css := resources.Get "styles.scss" | toCSS | postCSS | minify | fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` A quick tip would be to avoid the fingerprinting part, and possibly also the not-superfast `postCSS` when you're doing development, as it allows Hugo to be smarter about the rebuilding. Documentation will follow, but have a look at the demo repo in https://github.com/bep/hugo-sass-test New functions to create `Resource` objects: * `resources.Get` (see above) * `resources.FromString`: Create a Resource from a string. New `Resource` transformation funcs: * `resources.ToCSS`: Compile `SCSS` or `SASS` into `CSS`. * `resources.PostCSS`: Process your CSS with PostCSS. Config file support (project or theme or passed as an option). * `resources.Minify`: Currently supports `css`, `js`, `json`, `html`, `svg`, `xml`. * `resources.Fingerprint`: Creates a fingerprinted version of the given Resource with Subresource Integrity.. * `resources.Concat`: Concatenates a list of Resource objects. Think of this as a poor man's bundler. * `resources.ExecuteAsTemplate`: Parses and executes the given Resource and data context (e.g. .Site) as a Go template. Fixes #4381 Fixes #4903 Fixes #4858
2018-06-28commands: Fix broken server-reload on config changesBjørn Erik Pedersen
This was accidently broken in Hugo 0.42. Fixes #4878
2018-06-25Create missing head.html partial on new theme generationopenscript
2018-06-25Add html doctype to baseof.html template for new themesopenscript
2018-06-13commands: Do not fail server build when /static is missingBjørn Erik Pedersen
This was a un-intended change in Hugo 0.42. Most sites will have a static directory so this should not be a big issue, but this commit will revert back to old behaviour. Fixes #4846
2018-06-11commands: Create LICENSE rather than LICENSE.md in "new theme"Anthony Fok
See also #4623
2018-06-11commands: Create _default/baseof.html in "new theme"Anthony Fok
Thanks to @digitalcraftsman, @bep and @rdwatters for providing the actual content of the default baseof.html file. Fixes #3576
2018-06-11commands: Make "new theme" feedback more intuitiveAnthony Fok
2018-06-11commands: Move nextStepsText() to new_site.goAnthony Fok