Commit graph

600 commits

Author SHA1 Message Date
hugoreleaser 2900801acf releaser: Prepare repository for 0.52-DEV
[ci skip]
2018-11-07 10:11:48 +00:00
hugoreleaser 1ccc0b79a2 releaser: Bump versions for release of 0.51
[ci skip]
2018-11-07 10:09:43 +00:00
hugoreleaser f863b6a07e releaser: Prepare repository for 0.51-DEV
[ci skip]
2018-10-29 09:54:42 +00:00
hugoreleaser b14c11b0e1 releaser: Bump versions for release of 0.50
[ci skip]
2018-10-29 09:51:50 +00:00
Bjørn Erik Pedersen 35fbfb19a1
commands: Show server error info in browser
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-16 22:10:56 +02:00
Shreyansh Khajanchi 3d4a9882bf helpers: Call rst2html directly on *nix
Initially, rst2html was called via the python interpreter which would
fail if the script was wrapped in a launcher as on NixOS.
Ideally, on *nix, binaries should be invoked directly to ensure that
shebangs work properly as is being done now.
Handle the case of windows as it doesn't do shebangs.
2018-10-11 22:46:10 +02:00
Bjørn Erik Pedersen e421696d02 helpers: Consolidate MakeSegment vs MakePathSanitized
In short:

* Avoid double tolower in MakeSegment
* Use MakePathSanitized for taxonomies in pageToPermalinkTitle; this matches what MakeSegment does.
* Move the "double hyphen and space" logic into UnicodeSanitize

The last bullet may be slightly breaking for some that now does not get the "--" in some URLs, but we need to reduce the amount of URL logic.

See #4926
2018-10-03 15:55:25 +02:00
hugoreleaser 66b9e2bff2 releaser: Prepare repository for 0.50-DEV
[ci skip]
2018-09-24 10:04:24 +00:00
hugoreleaser 7f005f5e98 releaser: Bump versions for release of 0.49
[ci skip]
2018-09-24 10:01:04 +00:00
Cameron Moore c8ce65046d helpers: Fix golint issues
helpers/general.go:448:1: comment on exported function DiffStrings should be of the form "DiffStrings ..."
helpers/hugo.go:42:6: exported type HugoVersionString should have comment or be unexported
helpers/hugo.go:48:1: exported method HugoVersion.Version should have comment or be unexported
helpers/hugo.go:56:1: comment on exported method HugoVersionString.Compare should be of the form "Compare ..."
helpers/hugo.go:62:1: comment on exported method HugoVersionString.Eq should be of the form "Eq ..."
helpers/path.go:548:1: comment on exported function OpenFilesForWriting should be of the form "OpenFilesForWriting ..."
helpers/processing_stats.go:24:6: exported type ProcessingStats should have comment or be unexported
helpers/processing_stats.go:55:1: exported function NewProcessingStats should have comment or be unexported
helpers/processing_stats.go:59:1: exported method ProcessingStats.Incr should have comment or be unexported
helpers/processing_stats.go:63:1: exported method ProcessingStats.Add should have comment or be unexported
helpers/processing_stats.go:67:1: exported method ProcessingStats.Table should have comment or be unexported
helpers/processing_stats.go:83:1: exported function ProcessingStatsTable should have comment or be unexported
2018-09-07 08:25:51 +02:00
hugoreleaser 1ff54ab3d9 releaser: Prepare repository for 0.49-DEV
[ci skip]
2018-08-29 06:36:18 +00:00
hugoreleaser 09811d0bee releaser: Bump versions for release of 0.48
[ci skip]
2018-08-29 06:33:03 +00:00
Bjørn Erik Pedersen f4675fa0f0
helpers: Fix permissions when creating new folders
This was mistakingly changed from 07777 (rwx, rw, r before umask) to 0755 in Hugo 0.37. This commit reverts to the old value.

Fixes #5128
2018-08-28 17:14:56 +02:00
Cameron Moore fff132537b Fix handling of taxonomy terms containing slashes
Fixes #4090
2018-08-22 07:18:37 +02:00
hugoreleaser a81c64e43e releaser: Prepare repository for 0.48-DEV
[ci skip]
2018-08-20 08:19:37 +00:00
hugoreleaser 16b691a875 releaser: Bump versions for release of 0.47.1
[ci skip]
2018-08-20 08:16:49 +00:00
hugoreleaser 6746826689 releaser: Prepare repository for 0.48-DEV
[ci skip]
2018-08-17 09:17:44 +00:00
hugoreleaser 6711dacded releaser: Bump versions for release of 0.47
[ci skip]
2018-08-17 09:15:18 +00:00
Bjørn Erik Pedersen 78f8475a05 Fix Resource output in multihost setups
In Hugo 0.46 we made the output of what you get from resources.Get and similar static, i.e. language agnostic. This makes total sense, as it is wasteful and time-consuming to do SASS/SCSS/PostCSS processing for lots of languages when the output is lots of duplicates with different filenames.

But since we now output the result once only, this had a negative side effect for multihost setups: We publish the resource once only to the root folder (i.e. not to the language "domain folder").

This commit removes the language code from the processed image keys. This creates less duplication in the file cache, but it means that you should do a `hugo --gc` to clean up stale files.

Fixes #5058
2018-08-13 19:00:51 +02:00
Bjørn Erik Pedersen 789ef8c639
Add support for minification of final output
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-08-06 19:58:41 +02:00
hugoreleaser 31faf98ce3 releaser: Prepare repository for 0.47-DEV
[ci skip]
2018-08-01 09:03:22 +00:00
hugoreleaser 3aa838cf2b releaser: Bump versions for release of 0.46
[ci skip]
2018-08-01 09:00:52 +00:00
hugoreleaser 0cae1cf828 releaser: Prepare repository for 0.46-DEV
[ci skip]
2018-07-25 08:58:54 +00:00
hugoreleaser e38843f4bf releaser: Bump versions for release of 0.45.1
[ci skip]
2018-07-25 08:56:21 +00:00
hugoreleaser 3a6784b162 releaser: Prepare repository for 0.46-DEV
[ci skip]
2018-07-22 12:12:08 +00:00
hugoreleaser 2c5a036def releaser: Bump versions for release of 0.45
[ci skip]
2018-07-22 12:09:26 +00:00
hugoreleaser f44c9ab9cd releaser: Prepare repository for 0.45-DEV
[ci skip]
2018-07-13 06:05:41 +00:00
hugoreleaser 0831d8ccaf releaser: Bump versions for release of 0.44
[ci skip]
2018-07-13 06:03:09 +00:00
hugoreleaser 6084f0433c releaser: Prepare repository for 0.44-DEV
[ci skip]
2018-07-09 10:03:30 +00:00
hugoreleaser e6136b36f3 releaser: Bump versions for release of 0.43
[ci skip]
2018-07-09 10:00:04 +00:00
Bjørn Erik Pedersen dea71670c0
Add Hugo Piper with SCSS support and much more
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-07-06 11:46:12 +02:00
hugoreleaser 187621ae24 releaser: Prepare repository for 0.43-DEV
[ci skip]
2018-06-13 10:19:00 +00:00
hugoreleaser fc97388968 releaser: Bump versions for release of 0.42.1
[ci skip]
2018-06-13 10:16:33 +00:00
hugoreleaser 0f1fc01ef2
releaser: Prepare repository for 0.43-DEV
[ci skip]
2018-06-12 08:45:06 +02:00
hugoreleaser 19d91abc92 releaser: Bump versions for release of 0.42
[ci skip]
2018-06-12 06:37:19 +00:00
Bjørn Erik Pedersen 80230f26a3
Add support for theme composition and inheritance
This commit adds support for theme composition and inheritance in Hugo.

With this, it helps thinking about a theme as a set of ordered components:

```toml
theme = ["my-shortcodes", "base-theme", "hyde"]
```

The theme definition example above in `config.toml` creates a theme with the 3 components with presedence from left to right.

So, Hugo will, for any given file, data entry etc., look first in the project, and then in `my-shortcode`, `base-theme` and lastly `hyde`.

Hugo uses two different algorithms to merge the filesystems, depending on the file type:

* For `i18n` and `data` files, Hugo merges deeply using the translation id and data key inside the files.
* For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen.

The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are  plans to improve on this and get a URL scheme so this can be resolved automatically.

Also note that a component that is part of a theme can have its own configuration file, e.g. `config.toml`. There are currently some restrictions to what a theme component can configure:

* `params` (global and per language)
* `menu` (global and per language)
* `outputformats` and `mediatypes`

The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts.

A final note: Themes/components can also have a `theme` definition in their `config.toml` and similar, which is the "inheritance" part of this commit's title. This is currently not supported by the Hugo theme site. We will have to wait for some "auto dependency" feature to be implemented for that to happen, but this can be a powerful feature if you want to create your own theme-variant based on others.

Fixes #4460
Fixes #4450
2018-06-10 23:55:20 +02:00
Stefan Neuhaus 20cbc2c785 Add a BlackFriday option for rel="noreferrer" on external links
Add a configuration option "noreferrerLinks". When set to "true" the "HTML_NOREFERRER_LINKS" flag is being passed to Blackfriday. Thereby all *absolute* links will get a "noreferrer" value for their "rel" attribute.

See #4722
2018-05-29 16:54:43 +02:00
Stefan Neuhaus 7a6192647a Add a BlackFriday option for rel="nofollow" on external links
Add a configuration option "nofollowLinks". When set to "true" the "HTML_NOFOLLOW_LINKS" flag is being passed to Blackfriday. Thereby all *absolute* links will get a "nofollow" value for the "rel" attribute.

Fixes #4722
2018-05-28 01:21:36 +02:00
hugoreleaser 5241f0baee
releaser: Prepare repository for 0.42-DEV
[ci skip]
2018-05-27 10:30:06 +02:00
hugoreleaser 0e77f5d4e7 releaser: Bump versions for release of 0.41
[ci skip]
2018-05-25 16:57:17 +00:00
Bjørn Erik Pedersen 35ccf06dae
Fix some recently broken embedded templates
And add tests for them.

Fixes #4757
2018-05-23 10:03:11 +02:00
hugoreleaser 8b03c51eae releaser: Prepare repository for 0.41-DEV
[ci skip]
2018-04-30 06:50:00 +00:00
hugoreleaser f1269a6d00 releaser: Bump versions for release of 0.40.2
[ci skip]
2018-04-30 06:47:41 +00:00
Bjørn Erik Pedersen 001a28c2f9 Fix .WordCount, .FuzzyWordCount, .ReadingTime when summary marker is set
This bug was introduced in Hugo 0.40. It is when you use the `<!--more-->` summary marker.

Note that this affects the word stats only. The related `PlainWords`, `Plain`, `Content` all return correct values.

Fixes #4675
Fixes #4682
2018-04-29 10:58:58 +02:00
hugoreleaser 391f59f996 releaser: Prepare repository for 0.41-DEV
[ci skip]
2018-04-25 13:23:15 +00:00
hugoreleaser b5dafb0f23 releaser: Bump versions for release of 0.40.1
[ci skip]
2018-04-25 13:20:44 +00:00
hugoreleaser 44e47478d0 releaser: Prepare repository for 0.41-DEV
[ci skip]
2018-04-23 07:43:27 +00:00
hugoreleaser 3aed268379 releaser: Bump versions for release of 0.40
[ci skip]
2018-04-23 07:40:57 +00:00
Bjørn Erik Pedersen 4d26ab33dc
Make .Content (almost) always available in shortcodes
This resolves some surprising behaviour when reading other pages' content from shortcodes. Before this commit, that behaviour was undefined. Note that this has never been an issue from regular templates.

It will still not be possible to get **the current shortcode's  page's rendered content**. That would have impressed Einstein.

The new and well defined rules are:

* `.Page.Content` from a shortcode will be empty. The related `.Page.Truncated` `.Page.Summary`, `.Page.WordCount`, `.Page.ReadingTime`, `.Page.Plain` and `.Page.PlainWords` will also have empty values.
* For _other pages_ (retrieved via `.Page.Site.GetPage`, `.Site.Pages` etc.) the `.Content` is there to use as you please as long as you don't have infinite content recursion in your shortcode/content setup. See below.
* `.Page.TableOfContents` is good to go (but does not support shortcodes in headlines; this is unchanged)

If you get into a situation of infinite recursion, the `.Content` will be empty. Run `hugo -v` for more information.

Fixes #4632
Fixes #4653
Fixes #4655
2018-04-21 22:02:56 +02:00
hugoreleaser 89d2cf49ac releaser: Prepare repository for 0.40-DEV
[ci skip]
2018-04-16 07:33:49 +00:00
hugoreleaser 60845a5a0e releaser: Bump versions for release of 0.39
[ci skip]
2018-04-16 07:31:26 +00:00
hugoreleaser d7f47b780c releaser: Prepare repository for 0.39-DEV
[ci skip]
2018-04-09 08:19:32 +00:00
hugoreleaser 62e7588262 releaser: Bump versions for release of 0.38.2
[ci skip]
2018-04-09 08:17:14 +00:00
hugoreleaser e7d87e2410 releaser: Prepare repository for 0.39-DEV
[ci skip]
2018-04-05 16:39:05 +00:00
hugoreleaser 3a96fa40bf releaser: Bump versions for release of 0.38.1
[ci skip]
2018-04-05 16:35:25 +00:00
hugoreleaser 4f639d6bd5 releaser: Prepare repository for 0.39-DEV
[ci skip]
2018-04-02 11:06:04 +00:00
hugoreleaser 20e9c08e1f releaser: Bump versions for release of 0.38
[ci skip]
2018-04-02 11:03:32 +00:00
Bjørn Erik Pedersen 10c33c17cd
docs: Generate docshelper data
And fix build ...
2018-04-02 08:52:42 +02:00
Bjørn Erik Pedersen 2c54f1ad48
docshelper: List Chroma lexers
Fixes #4554
2018-04-02 08:50:42 +02:00
Bjørn Erik Pedersen eb42774e58
Add support for a content dir set per language
A sample config:

```toml
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true

[Languages]
[Languages.en]
weight = 10
title = "In English"
languageName = "English"
contentDir = "content/english"

[Languages.nn]
weight = 20
title = "På Norsk"
languageName = "Norsk"
contentDir = "content/norwegian"
```

The value of `contentDir` can be any valid path, even absolute path references. The only restriction is that the content dirs cannot overlap.

The content files will be assigned a language by

1. The placement: `content/norwegian/post/my-post.md` will be read as Norwegian content.
2. The filename: `content/english/post/my-post.nn.md` will be read as Norwegian even if it lives in the English content folder.

The content directories will be merged into a big virtual filesystem with one simple rule: The most specific language file will win.
This means that if both `content/norwegian/post/my-post.md` and `content/english/post/my-post.nn.md` exists, they will be considered duplicates and the version inside `content/norwegian` will win.

Note that translations will be automatically assigned by Hugo by the content file's relative placement, so `content/norwegian/post/my-post.md` will be a translation of `content/english/post/my-post.md`.

If this does not work for you, you can connect the translations together by setting a `translationKey` in the content files' front matter.

Fixes #4523
Fixes #4552
Fixes #4553
2018-04-02 08:06:21 +02:00
Bjørn Erik Pedersen e9c7b6205f
Allow themes to define output formats, media types and params
This allows a `config.toml` (or `yaml`, ´yml`, or `json`)  in the theme to set:

1) `params` (but cannot override params in project. Will also get its own "namespace", i.e. `{{ .Site.Params.mytheme.my_param }}` will be the same as `{{ .Site.Params.my_param }}` providing that the main project does not define a param with that key.
2) `menu` -- but cannot redefine/add menus in the project. Must create its own menus with its own identifiers.
3) `languages` -- only `params` and `menu`. Same rules as above.
4) **new** `outputFormats`
5) **new** `mediaTypes`

This should help with the "theme portability" issue and people having to copy and paste lots of setting into their projects.

Fixes #4490
2018-03-21 09:22:19 +01:00
Bjørn Erik Pedersen 68bf1511f2
hugolib: Extract date and slug from filename
This commit makes it possible to extract the date from the content filename. Also, the filenames in these cases will make for very poor permalinks, so we will also use the remaining part as the page `slug` if that value is not set in front matter.

This should make it easier to move content from Jekyll to Hugo.

To enable, put this in your `config.toml`:

```toml
[frontmatter]
date  = [":filename", ":default"]
```

This commit is also a spring cleaning of how the different dates are configured in Hugo. Hugo will check for dates following the configuration from left to right, starting with `:filename` etc.

So, if you want to use the `file modification time`, this can be a good configuration:

 ```toml
[frontmatter]
date = [ "date",":fileModTime", ":default"]
lastmod = ["lastmod" ,":fileModTime", ":default"]
```

The current `:default` values for the different dates are

```toml
[frontmatter]
date = ["date","publishDate", "lastmod"]
lastmod = ["lastmod", "date","publishDate"]
publishDate = ["publishDate", "date"]
expiryDate = ["expiryDate"]
```

The above will now be the same as:

```toml
[frontmatter]
date = [":default"]
lastmod = [":default"]
publishDate = [":default"]
expiryDate = [":default"]
```

Note:

* We have some built-in aliases to the above: lastmod => modified, publishDate => pubdate, published and expiryDate => unpublishdate.
* If you want a new configuration for, say, `date`, you can provide only that line, and the rest will be preserved.
* All the keywords to the right that does not start with a ":" maps to front matter parameters, and can be any date param (e.g. `myCustomDateParam`).
* The keywords to the left are the **4 predefined dates in Hugo**, i.e. they are constant values.
* The current "special date handlers" are `:fileModTime` and `:filename`. We will soon add `:git` to that list.

Fixes #285
Closes #3310
Closes #3762
Closes #4340
2018-03-11 18:26:18 +01:00
hugoreleaser 9ac6206584 releaser: Prepare repository for 0.38-DEV
[ci skip]
2018-03-07 17:58:48 +00:00
hugoreleaser c29a2ed2f5 releaser: Bump versions for release of 0.37.1
[ci skip]
2018-03-07 17:56:23 +00:00
hugoreleaser 06e5ee6526 releaser: Prepare repository for 0.38-DEV
[ci skip]
2018-02-27 09:17:53 +00:00
hugoreleaser 1f1c562b9c releaser: Bump versions for release of 0.37
[ci skip]
2018-02-27 09:15:23 +00:00
Bjørn Erik Pedersen 19d9a46f63
Properly handle -DEV suffix when comparing Hugo versions
See #4443
2018-02-22 17:16:42 +01:00
Bjørn Erik Pedersen 0602135fd4
Make ge, le etc. work with the Hugo Version number
This means that you can do something ala:

```html
{{ if ge .Hugo.Version "0.36" }}Reasonable new Hugo version!{{ end }}
```

The intented use is feature toggling, but please note that it will take some time and Hugo versions until this can be trusted. It does not work in older Hugo versions.

Fixes #4443
2018-02-22 09:15:12 +01:00
Bjørn Erik Pedersen 772128485a Run gofmt -s with Go 1.10
See #4434
2018-02-21 09:59:33 +01:00
Bjørn Erik Pedersen d382502d6d tpl/transform: Add template func for TOML/JSON/YAML docs examples conversion
Usage:

```html
{{ "title = \"Hello World\"" | transform.Remarshal "json" | safeHTML }}
```

Fixes #4389
2018-02-10 12:36:31 +01:00
hugoreleaser e02ee7d6ad releaser: Prepare repository for 0.37-DEV
[ci skip]
2018-02-05 15:24:52 +00:00
hugoreleaser 4bc8727fc6 releaser: Bump versions for release of 0.36
[ci skip]
2018-02-05 15:22:26 +00:00
hugoreleaser 19e26cb4eb releaser: Prepare repository for 0.36-DEV
[ci skip]
2018-01-31 10:47:09 +00:00
hugoreleaser 58188807aa releaser: Bump versions for release of 0.35
[ci skip]
2018-01-31 10:44:41 +00:00
Bjørn Erik Pedersen ae742cb1bd Fix language params handling
This fixes some issues with language params handling by separating params from configuration values per language.

This means that you can now do this:

```toml
[languages]
[languages.en]
languageName = "English"
weight = 1
title = "My Cool Site"
[languages.en.params]
myParam = "Hi!"
```

This is not a breaking change, but the above is a less suprising way of configuring custom params.

It also fixes some hard-to-debug corner-cases in multilingual sites.

Fixes #4356
Fixes #4352
2018-01-30 18:53:07 +01:00
Bjørn Erik Pedersen 6413559f75 Add a way to disable one or more languages
This commit adds a new config setting:

```toml
disableLanguages = ["fr"]
```

If this is a multilingual site:

* No site for the French language will be created
* French content pages will be ignored/not read
* The French language configuration (menus etc.) will also be ignored

This makes it possible to start translating new languages and turn it on when you're happy etc.

Fixes #4297
Fixed #4329
2018-01-26 14:04:14 +01:00
Bjørn Erik Pedersen ebdd8cba3f
helpers: Avoid unescape in highlight
Fixes #4219
2018-01-23 09:48:04 +01:00
hugoreleaser 87217d1d0a releaser: Prepare repository for 0.35-DEV
[ci skip]
2018-01-22 12:08:54 +00:00
hugoreleaser 2228d3e289 releaser: Bump versions for release of 0.34
[ci skip]
2018-01-22 12:06:38 +00:00
hugoreleaser cd77968284 releaser: Prepare repository for 0.34-DEV
[ci skip]
2018-01-18 10:16:12 +00:00
hugoreleaser c6b9037294 releaser: Bump versions for release of 0.33
[ci skip]
2018-01-18 10:13:30 +00:00
hugoreleaser 27c77e1ab9 releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-11 09:00:51 +00:00
hugoreleaser a97ef61bad releaser: Bump versions for release of 0.32.4
[ci skip]
2018-01-11 08:58:01 +00:00
hugoreleaser 238e7f7fbe releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-08 11:12:41 +00:00
hugoreleaser fdec5e3084 releaser: Bump versions for release of 0.32.3
[ci skip]
2018-01-08 11:10:08 +00:00
Bjørn Erik Pedersen 8969331f5b Fix multihost detection for sites without language definition
Static content was wrongly put into the lang-code subfolder.

Fixes #4221
2018-01-06 19:14:31 +01:00
Bjørn Erik Pedersen ab82a27d05 Fix URLs for bundle resources in multihost mode
Fixes #4217
2018-01-06 10:29:13 +01:00
Bjørn Erik Pedersen f25d8a9e17 Fix sub-folder baseURL handling for Page resources
I.e. images etc.

Fixes #4228
2018-01-06 10:29:13 +01:00
hugoreleaser 54a89cde69 releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-03 09:56:18 +00:00
hugoreleaser 865877cd05 releaser: Bump versions for release of 0.32.2
[ci skip]
2018-01-03 09:54:04 +00:00
hugoreleaser 3dd8c1c026 releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-02 09:10:11 +00:00
hugoreleaser 54ef60b03a releaser: Bump versions for release of 0.32.1
[ci skip]
2018-01-02 09:07:55 +00:00
hugoreleaser 72158ab2e8 releaser: Prepare repository for 0.33-DEV
[ci skip]
2017-12-31 09:26:48 +00:00
hugoreleaser 82db039436 releaser: Bump versions for release of 0.32
[ci skip]
2017-12-31 09:24:45 +00:00
Bjørn Erik Pedersen 72903be587
commands: Make sure all language homes are always re-rendered in fast render mode
Fixes #4125
2017-12-29 09:37:37 +01:00
Bjørn Erik Pedersen 612dcc1944
helpers: Avoid writing the last MD5 buff part twice 2017-12-28 22:52:27 +01:00
Bjørn Erik Pedersen e50a8c7a14 resource: Use MD5 to identify image files
But only a set of byte chunks spread around in the image file to calculate the fingerprint, which is much faster than reading the whole file:

```bash
BenchmarkMD5FromFileFast/full=false-4         	  300000	      4356 ns/op	     240 B/op	       5 allocs/op
BenchmarkMD5FromFileFast/full=true-4          	   30000	     42899 ns/op	   32944 B/op	       5 allocs/op
```

Fixes #4186
2017-12-28 17:41:51 +01:00
Bjørn Erik Pedersen 3cdf19e9b7
Implement Page bundling and image handling
This commit is not the smallest in Hugo's history.

Some hightlights include:

* Page bundles (for complete articles, keeping images and content together etc.).
* Bundled images can be processed in as many versions/sizes as you need with the three methods `Resize`, `Fill` and `Fit`.
* Processed images are cached inside `resources/_gen/images` (default) in your project.
* Symbolic links (both files and dirs) are now allowed anywhere inside /content
* A new table based build summary
* The "Total in nn ms" now reports the total including the handling of the files inside /static. So if it now reports more than you're used to, it is just **more real** and probably faster than before (see below).

A site building  benchmark run compared to `v0.31.1` shows that this should be slightly faster and use less memory:

```bash
▶ ./benchSite.sh "TOML,num_langs=.*,num_root_sections=5,num_pages=(500|1000),tags_per_page=5,shortcodes,render"

benchmark                                                                                                         old ns/op     new ns/op     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4      101785785     78067944      -23.30%
BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4     185481057     149159919     -19.58%
BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4      103149918     85679409      -16.94%
BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4     203515478     169208775     -16.86%

benchmark                                                                                                         old allocs     new allocs     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4      532464         391539         -26.47%
BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4     1056549        772702         -26.87%
BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4      555974         406630         -26.86%
BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4     1086545        789922         -27.30%

benchmark                                                                                                         old bytes     new bytes     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4      53243246      43598155      -18.12%
BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4     105811617     86087116      -18.64%
BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4      54558852      44545097      -18.35%
BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4     106903858     86978413      -18.64%
```

Fixes #3651
Closes #3158
Fixes #1014
Closes #2021
Fixes #1240
Updates #3757
2017-12-27 18:44:47 +01:00
Bjørn Erik Pedersen db4b7a5c67 Reuse the BlackFriday instance when possible
This is in heavy use in rendering, so this makes a difference:

```bash
benchmark                                                                                    old ns/op     new ns/op     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4     124551144     107743429     -13.49%

benchmark                                                                                    old allocs     new allocs     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4     528684         435118         -17.70%

benchmark                                                                                    old bytes     new bytes     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4     53306848      45147832      -15.31%
```
2017-12-16 19:44:33 +01:00
Brian Chen e69da7a4cb Add Pandoc support, refactor external helpers
Recognize the Pandoc format under the file extension .pandoc or .pdc,
and shell out to pandoc as an external helper to format Pandoc content.

Refactor out repeated code with external helpers. Change the error
output formatting. I did not see any of the external helpers print the
string "<input>" to represent stdin as a file; just prepending the file
name to error output is more general and doesn't sacrifice that much in
terms of readability.

Closes #234
2017-11-30 12:15:52 +01:00
hugoreleaser 8a8ba63c7e releaser: Prepare repository for 0.32-DEV
[ci skip]
2017-11-27 11:27:33 +00:00
hugoreleaser aa68205d16 releaser: Bump versions for release of 0.31.1
[ci skip]
2017-11-27 11:26:08 +00:00
hugoreleaser 42fbf15fb7 releaser: Prepare repository for 0.32-DEV
[ci skip]
2017-11-20 10:30:09 +00:00
hugoreleaser f4b416bbef releaser: Bump versions for release of 0.31
[ci skip]
2017-11-20 10:28:21 +00:00
Bjørn Erik Pedersen 118b83d74b
helpers: Properly handle []interface{} as staticDir
And now with a proper integration test ...
2017-11-19 15:44:20 +01:00
Bjørn Erik Pedersen c1d325934e helpers: Remove (now) unused GetStaticDir
* In Hugo there is no single static dir
* It was used as a filter in the content dir, which makes no sense since any overlap here is impossible
2017-11-19 14:03:21 +01:00
Bjørn Erik Pedersen 60dfb9a6e0 Add support for multiple staticDirs
This commit adds support for multiple statDirs both on the global and language level.

A simple `config.toml` example:

```bash
staticDir = ["static1", "static2"]
[languages]
[languages.no]
staticDir = ["staticDir_override", "static_no"]
baseURL = "https://example.no"
languageName = "Norsk"
weight = 1
title = "På norsk"

[languages.en]
staticDir2 = "static_en"
baseURL = "https://example.com"
languageName = "English"
weight = 2
title = "In English"
```

In the above, with no theme used:

the English site will get its static files as a union of "static1", "static2" and "static_en". On file duplicates, the right-most version will win.
the Norwegian site will get its static files as a union of "staticDir_override" and "static_no".

This commit also concludes the Multihost support in #4027.

Fixes #36
Closes #4027
2017-11-17 11:01:46 +01:00
Bjørn Erik Pedersen 2e0465764b Add multilingual multihost support
This commit adds multihost support when more than one language is configured and `baseURL` is set per language.

Updates #4027
2017-11-17 11:01:46 +01:00
hugoreleaser 1d52bfbb47 releaser: Prepare repository for 0.31-DEV
[ci skip]
2017-10-19 11:35:38 +00:00
hugoreleaser bf633ea2f2 releaser: Bump versions for release of 0.30.2
[ci skip]
2017-10-19 11:34:09 +00:00
hugoreleaser bc53cd7b15 releaser: Prepare repository for 0.31-DEV
[ci skip]
2017-10-19 05:43:34 +00:00
hugoreleaser 89a3f47a21 releaser: Bump versions for release of 0.30.1
[ci skip]
2017-10-19 05:41:50 +00:00
hugoreleaser 45e0908b86 releaser: Prepare repository for 0.31-DEV
[ci skip]
2017-10-16 08:40:34 +00:00
hugoreleaser 811f381e23 releaser: Bump versions for release of 0.30
[ci skip]
2017-10-16 08:39:00 +00:00
Bjørn Erik Pedersen 7c30e2cbb0 Add table linenos support for Chroma highlighter
Fixes #3915
2017-10-14 16:00:27 +02:00
Bjørn Erik Pedersen a58741a172 helpers: Fix broken test 2017-10-04 09:27:15 +02:00
Cameron Moore 47fdfd5196 Clean up lint in various packages
Changes fall into one of the following:

- gofmt -s
- receiver name is inconsistent
- omit unused 2nd value from range
- godoc comment formed incorrectly
- err assigned and not used
- if block ends with a return statement followed by else
2017-09-29 16:23:16 +02:00
Bjørn Erik Pedersen d45e358a05 helpers: Fix broken Chroma test 2017-09-29 10:40:56 +02:00
Brendan Roy 8717a60cc0 Change SummaryLength to be configurable (#3924)
Move SummaryLength into the ContentSpec struct and refactor the
relevant summary functions to be methods of ContentSpec. The new
summaryLength struct member is configurable by the summaryLength config
value, and the default remains 70. Also updates hugolib/page to use the
refactored methods.

Resolves #3734
2017-09-29 09:04:55 +02:00
hugoreleaser f806e951fd releaser: Prepare repository for 0.30-DEV
[ci skip]
2017-09-26 19:24:34 +00:00
hugoreleaser 396759a09b releaser: Bump versions for release of 0.29
[ci skip]
2017-09-26 19:23:15 +00:00
hugoreleaser 404e2994e5 releaser: Prepare repository for 0.29-DEV
[ci skip]
2017-09-25 08:00:38 +00:00
hugoreleaser 9e850c1f64 releaser: Bump versions for release of 0.28
[ci skip]
2017-09-25 07:59:12 +00:00
Bjørn Erik Pedersen fb33d8286d Use Chroma as new default syntax highlighter
If you want to use Pygments, set `pygmentsUseClassic=true` in your site config.

Fixes #3888
2017-09-25 08:59:02 +02:00
hugoreleaser 5c3b210368 releaser: Prepare repository for 0.28-DEV
[ci skip]
2017-09-13 13:13:28 +02:00
hugoreleaser 18126434f1 releaser: Bump versions for release of 0.27.1
[ci skip]
2017-09-13 11:03:59 +00:00
hugoreleaser 0375cbd025 releaser: Prepare repository for 0.28-DEV
[ci skip]
2017-09-11 05:33:02 +00:00
hugoreleaser 828eb70fa6 releaser: Bump versions for release of 0.27
[ci skip]
2017-09-11 05:32:02 +00:00
Bjørn Erik Pedersen d2249c5099 Set up Hugo release flow on CircleCI
This rewrites the release logic to use CircleCI 2.0 and its approve workflow in combination with the state of the release notes to determine what to do next.

Fixes #3779
2017-09-10 17:14:02 +02:00
Daniel Karlsson c8257f8b72 Render task list item inside label for correct accessibility
Fixes #3303
2017-08-09 20:09:43 +02:00
Bjørn Erik Pedersen 40d7d3baa8 releaser: Prepare repository for 0.27-DEV
[ci skip]
2017-08-07 09:13:50 +02:00
Bjørn Erik Pedersen b36f6e31e0 releaser: Bump versions for release of 0.26
[ci skip]
2017-08-07 09:05:07 +02:00
Bjørn Erik Pedersen f768c27f0d helpers: Remove some unused funcs 2017-08-03 15:59:10 +02:00
Jorin Vogel 81c13171a9 Add some missing doc comments
As pointed out by the linter, some exported functions and types are
missing doc comments.
The linter warnings have been reduced from 194 to 116.
Not all missing comments have been added in this commit though.
2017-08-03 15:57:51 +02:00
Bjørn Erik Pedersen 9891c0fb0e Remove sourceRelativeLinks
Fixes #3766
2017-08-02 22:04:38 +02:00
Abdullah Diab 481924b34d helpers: Fix broken TaskList in Markdown
As per the referenced issue, if the task list in Markdown has
nothing before it, it will be rendered wrongly:

```
---
title: "My First Post"
date: 2017-07-29T20:21:57+02:00
draft: true
---

* [ ] TaskList

```

is rendered as:

```
<ul> class="task-list"
<li><input type="checkbox" disabled class="task-list-item"> TaskList</li>
</ul>
```

The problem lies in the `List` function of `HugoHTMLRenderer`, it had
a hardocded index of `4` for the first `>` of the list, it is used to
insert the class into the text before the closing bracket, but that
hardcoded index is only right when there is a newline before the
opening bracket, which is the case when there is anything in the
document before the task list, but if there is nothing, then there is
no newline, and the correct index of the first `>` will be `3`.

To fix that we're changing the hardcoded index to be dynamic by using
`bytes.Index` to find it properly. We're also adding a test case to
make sure this is tested against.

Fixes #3710
2017-08-02 00:33:37 +02:00
Bjørn Erik Pedersen 8fb594bfb0 Make the title case style guide configurable
This works for the `title` func and the other places where Hugo makes title case.

* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes #989
2017-07-31 22:16:46 +02:00
Bjørn Erik Pedersen cb9dfc2613 helpers: Add support for French Guillemets
Fixes #3725
2017-07-29 10:10:40 +02:00
Vasyl Solovei b60aa1a504 helpers: Add --trace to asciidoctor args
This will help to understand and fix errors by
seeing stacktrace of an error.

See #3714
2017-07-21 03:07:56 -06:00
Bjørn Erik Pedersen 91f410ea90 Bump versions to 0.26-DEV 2017-07-10 09:16:02 +02:00
Bjørn Erik Pedersen aded65b71d releaser: Prepare repository for 0.25-DEV
[ci skip]
2017-07-10 09:02:20 +02:00
Bjørn Erik Pedersen 0e09be7b3c releaser: Bump versions for release of 0.25.1
[ci skip]
2017-07-10 08:57:34 +02:00
Bjørn Erik Pedersen 1e19a98451 releaser: Prepare repository for 0.26-DEV
[ci skip]
2017-07-07 09:34:13 +02:00
Bjørn Erik Pedersen 6e086e3d03 releaser: Bump versions for release of 0.25
[ci skip]
2017-07-07 09:23:54 +02:00
Bjørn Erik Pedersen 5f831a6223 releaser: Replace the magic version handling
Take the new version as a string value.
2017-07-05 14:27:43 +02:00
Bjørn Erik Pedersen a1d260b41a hugolib: Extend the sections API
This commit adds some section related methods that have been asked for:

* .CurrentSection
* .IsDescendant
* .IsAncestor

Fixes #3591
2017-07-04 09:11:49 +02:00
Haishan Zhou a54404968a helpers: Add Blackfriday 'joinLines' extension support (#3574)
See https://github.com/russross/blackfriday/pull/334
"add an extension to handle Chinese (or CJK) newlines"
for more information.
2017-06-27 04:56:50 -06:00
Frank Braun bfce30d859 helpers: add --initial-header-level=2 to rst2html (#3528)
reStructuredText doesn't have explicit section levels but sets them in
the order of appearance. Since level 1 is already set from the title in
the front matter it makes more sense to start with level 2 when
converting with rst2html.
2017-06-27 04:26:33 -06:00
Bjørn Erik Pedersen 3554fd1218 releaser: Prepare repository for 0.25-DEV
[ci skip]
2017-06-21 13:58:01 +02:00
Bjørn Erik Pedersen 8f69fe57a4 releaser: Bump versions for release of 0.24
[ci skip]
2017-06-21 13:52:27 +02:00