Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2019-08-26Image resource refactorBjørn Erik Pedersen
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend. This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below: {{ ($myimg | fingerprint ).Width }} Fixes #5903 Fixes #6234 Fixes #6266
2019-08-17releaser: Prepare repository for 0.58.0-DEVhugoreleaser
[ci skip]
2019-08-17releaser: Bump versions for release of 0.57.2hugoreleaser
[ci skip]
2019-08-15releaser: Prepare repository for 0.58.0-DEVhugoreleaser
[ci skip]
2019-08-15releaser: Bump versions for release of 0.57.1hugoreleaser
[ci skip]
2019-08-14releaser: Prepare repository for 0.58.0-DEVhugoreleaser
[ci skip]
2019-08-14releaser: Bump versions for release of 0.57.0hugoreleaser
[ci skip]
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2019-08-10Fixed tautological error conditionsChristian Muehlhaeuser
Drop error & nil checks where the value can not have changed.
2019-08-08Simplify page tree logicBjørn Erik Pedersen
This is preparation for #6041. For historic reasons, the code for bulding the section tree and the taxonomies were very much separate. This works, but makes it hard to extend, maintain, and possibly not so fast as it could be. This simplification also introduces 3 slightly breaking changes, which I suspect most people will be pleased about. See referenced issues: This commit also switches the radix tree dependency to a mutable implementation: github.com/armon/go-radix. Fixes #6154 Fixes #6153 Fixes #6152
2019-07-31releaser: Prepare repository for 0.57.0-DEVhugoreleaser
[ci skip]
2019-07-31releaser: Bump versions for release of 0.56.3hugoreleaser
[ci skip]
2019-07-30releaser: Prepare repository for 0.57.0-DEVhugoreleaser
[ci skip]
2019-07-30releaser: Bump versions for release of 0.56.2hugoreleaser
[ci skip]
2019-07-28common/maps: Do not return error on params dot access on incompatible typesBjørn Erik Pedersen
This error was introduced in 0.56 and has shown some site breakage in the wild. Fixes #6121
2019-07-25releaser: Prepare repository for 0.57.0-DEVhugoreleaser
[ci skip]
2019-07-25releaser: Bump versions for release of 0.56.0hugoreleaser
[ci skip]
2019-07-24Add Hugo ModulesBjørn Erik Pedersen
This commit implements Hugo Modules. This is a broad subject, but some keywords include: * A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project. * A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects. * Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running. * Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions. * A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`. All of the above is backed by Go Modules. Fixes #5973 Fixes #5996 Fixes #6010 Fixes #5911 Fixes #5940 Fixes #6074 Fixes #6082 Fixes #6092
2019-05-02releaser: Prepare repository for 0.56.0-DEVhugoreleaser
[ci skip]
2019-05-02releaser: Bump versions for release of 0.55.5hugoreleaser
[ci skip]
2019-04-25releaser: Prepare repository for 0.56.0-DEVhugoreleaser
[ci skip]
2019-04-25releaser: Bump versions for release of 0.55.4hugoreleaser
[ci skip]
2019-04-20releaser: Prepare repository for 0.56.0-DEVhugoreleaser
[ci skip]
2019-04-20releaser: Bump versions for release of 0.55.3hugoreleaser
[ci skip]
2019-04-17releaser: Prepare repository for 0.56.0-DEVhugoreleaser
[ci skip]
2019-04-17releaser: Bump versions for release of 0.55.2hugoreleaser
[ci skip]
2019-04-12releaser: Prepare repository for 0.56.0-DEVhugoreleaser
[ci skip]
2019-04-12releaser: Bump versions for release of 0.55.1hugoreleaser
[ci skip]
2019-04-08releaser: Prepare repository for 0.56.0-DEVhugoreleaser
[ci skip]
2019-04-08releaser: Bump versions for release of 0.55.0hugoreleaser
[ci skip]
2019-03-26herrors/errors: Improve the "feature not available" errorBjørn Erik Pedersen
2019-03-24all: Apply staticcheck recommendationsBjørn Erik Pedersen
2019-03-23Make Page an interfaceBjørn Erik Pedersen
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct. This is all a preparation step for issue #5074, "pages from other data sources". But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes. Most notable changes: * The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday. This means that any markdown will partake in the global ToC and footnote context etc. * The Custom Output formats are now "fully virtualized". This removes many of the current limitations. * The taxonomy list type now has a reference to the `Page` object. This improves the taxonomy template `.Title` situation and make common template constructs much simpler. See #5074 Fixes #5763 Fixes #5758 Fixes #5090 Fixes #5204 Fixes #4695 Fixes #5607 Fixes #5707 Fixes #5719 Fixes #3113 Fixes #5706 Fixes #5767 Fixes #5723 Fixes #5769 Fixes #5770 Fixes #5771 Fixes #5759 Fixes #5776 Fixes #5777 Fixes #5778
2019-03-07tpl/tplimpl: Fix template truth logicBjørn Erik Pedersen
Before this commit, due to a bug in Go's `text/template` package, this would print different output for typed nil interface values: ``` {{ if .AuthenticatedUser }}User is authenticated!{{ else }}{{ end }} {{ if not .AuthenticatedUser }}{{ else }}}User is authenticated!{{ end }} ``` This commit works around this by wrapping every `if` and `with` with a custom `getif` template func with truth logic that matches `not`, `and` and `or`. Those 3 template funcs from Go's stdlib are now pulled into Hugo's source tree and adjusted to support custom zero values, e.g. types that implement `IsZero`. This means that you can now do: ``` {{ with .Date }}{{ . }}{{ end }} ``` And it would work as expected. Fixes #5738
2019-02-02common/herrors: Fix args order in strings.TrimPrefixIskander (Alex) Sharipov
Old code always returned "." or "" (if filepath.Ext(filename) returned "."). Now it properly trims the prefix. Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
2019-02-01releaser: Prepare repository for 0.55.0-DEVhugoreleaser
[ci skip]
2019-02-01releaser: Bump versions for release of 0.54.0hugoreleaser
[ci skip]
2019-02-01common/hugo: Use official semver even for main releasesBjørn Erik Pedersen
Closes #5639
2018-12-24releaser: Prepare repository for 0.54-DEVhugoreleaser
[ci skip]
2018-12-24releaser: Bump versions for release of 0.53hugoreleaser
[ci skip]
2018-12-11Add /config dir supportBjørn Erik Pedersen
This commit adds support for a configuration directory (default `config`). The different pieces in this puzzle are: * A new `--environment` (or `-e`) flag. This can also be set with the `HUGO_ENVIRONMENT` OS environment variable. The value for `environment` defaults to `production` when running `hugo` and `development` when running `hugo server`. You can set it to any value you want (e.g. `hugo server -e "Sensible Environment"`), but as it is used to load configuration from the file system, the letter case may be important. You can get this value in your templates with `{{ hugo.Environment }}`. * A new `--configDir` flag (defaults to `config` below your project). This can also be set with `HUGO_CONFIGDIR` OS environment variable. If the `configDir` exists, the configuration files will be read and merged on top of each other from left to right; the right-most value will win on duplicates. Given the example tree below: If `environment` is `production`, the left-most `config.toml` would be the one directly below the project (this can now be omitted if you want), and then `_default/config.toml` and finally `production/config.toml`. And since these will be merged, you can just provide the environment specific configuration setting in you production config, e.g. `enableGitInfo = true`. The order within the directories will be lexical (`config.toml` and then `params.toml`). ```bash config ├── _default │   ├── config.toml │   ├── languages.toml │   ├── menus │   │   ├── menus.en.toml │   │   └── menus.zh.toml │   └── params.toml ├── development │   └── params.toml └── production ├── config.toml └── params.toml ``` Some configuration maps support the language code in the filename (e.g. `menus.en.toml`): `menus` (`menu` also works) and `params`. Also note that the only folders with "a meaning" in the above listing is the top level directories below `config`. The `menus` sub folder is just added for better organization. We use `TOML` in the example above, but Hugo also supports `JSON` and `YAML` as configuration formats. These can be mixed. Fixes #5422
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-29common/collections: Fix defines typoChristian Oliff
2018-11-27Add inline shortcode supportBjørn Erik Pedersen
An inline shortcode's name must end with `.inline`, all lowercase. E.g.: ```bash {{< time.inline >}}{{ now }}{{< /time.inline >}} ``` The above will print the current date and time. Note that an inline shortcode's inner content is parsed and executed as a Go text template with the same context as a regular shortcode template. This means that the current page can be accessed via `.Page.Title` etc. This also means that there are no concept of "nested inline shortcodes". The same inline shortcode can be reused later in the same content file, with different params if needed, using the self-closing syntax: ``` {{< time.inline />}} ``` Fixes #4011
2018-11-13More spelling correctionsBjørn Erik Pedersen
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-02Fix ANSI character output regression on WindowsLorenz Cuno Klopfenstein
Fixes #5377
2018-11-01Add file (line/col) info to ref/relref errorsBjørn Erik Pedersen
See #5371
2018-11-01common/loggers: Improve log color regexpBjørn Erik Pedersen
To avoid coloring WARNING inside log errors.
2018-10-28common/loggers: Make sure the global logger also gets colored labelsBjørn Erik Pedersen
See #4414