Hugo already, in its server mode, support partial rebuilds. To put it simply: If you change `about.md`, only that content page is read and processed, then Hugo does some processing (taxonomies etc.) and the full site is rendered.
This commit covers the rendering part: We now only re-render the pages you work on, i.e. the last n pages you watched in the browser (which obviously also includes the page in the example above).
To be more specific: When you are running the hugo server in watch (aka. livereload) mode, and change a template or a content file, then we do a partial re-rendering of the following:
* The current content page (if it is a content change)
* The home page
* Up to the last 10 pages you visited on the site.
This should in most cases be enough, but if you navigate to something completely different, you may see stale content. Doing an edit will then refresh that page.
Note that this feature is enabled by default. To turn it off, run `hugo server --disableFastRender`.
Fixes#3962
See #1643
This makes live reloading behind a HTTPS proxy working, as in the example below using the service from https://ngrok.com:
```
hugo server -b https://ba6sdfe72.ngrok.io --appendPort=false --liveReloadPort=443 --navigateToChanged
```
Fixes#3882
This closes#98, even if this commit does not do full content text search.
We may revisit that problem in the future, but that deserves its own issue.
Fixes#98
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
Note that even with this setting enabled, the aliases themselves are preserved on the pages.
The big motivation for this change is to be able to use the alias definitions to generate `.htaccess` or Netlify's `_redirect` files with server-side redirects.
Fixes#3613
This issue is more visible now that we support nested sections.
This commit makes operations like pasting new content folders or deleting content folders during server watch just work.
Fixes#3570
When we know to look into the index pages collection, do that:
```
benchmark old ns/op new ns/op delta
BenchmarkGetPage-4 51483 7072 -86.26%
benchmark old allocs new allocs delta
BenchmarkGetPage-4 71 71 +0.00%
benchmark old bytes new bytes delta
BenchmarkGetPage-4 2648 2648 +0.00%
```
This commit also returns an error if .Site.GetPage is called with the regular Page Kind, as that is currently not supported.
Fixes#3503
Partial rebuild does not have the same logic as normal rebuild on
selecting which file to build. This change makes it possible to
share the file select logic between two kinds of build.
Fix#3325.
This makes it consistent with how it behaves when it's set in config.toml.
This commit also unifies BaseURL in Site.Info so we now have one source for this value.
Fixes#3262
Before this commit, Hugo used `html/template` for all Go templates.
While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc.
This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use.
A couple of notes:
* The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work.
* Ambiguous types will fall back to HTML.
* Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials.
* Shortcode templates are, by definition, currently HTML templates only.
Fixes#3221
Having the content page name in the log key for the distinct error logger isnt't very usable when you have an error in a commonly used partial.
Using the Page Kind reduces the amount of log entries. Here is an example from an error in the partial menu.html, used in all the page templates:
```
Started building sites ...
ERROR 2017/04/02 12:19:43 Error while rendering "page": template: /Users/bep/sites/bepsays.com/layouts/_default/single.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/single.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "section": template: /Users/bep/sites/bepsays.com/layouts/_default/section.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/section.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "taxonomy": template: /Users/bep/sites/bepsays.com/layouts/_default/list.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/list.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "home": template: /Users/bep/sites/bepsays.com/layouts/index.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/index.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "404": template: 404.html:2:3: executing "404.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
Built site for language nn:
```
Which is pretty good.
Before this commit, Hugo used `html/template` for all Go templates.
While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc.
This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use.
A couple of notes:
* The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work.
* Ambiguous types will fall back to HTML.
* Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials.
* Shortcode templates are, by definition, currently HTML templates only.
Fixes#3221
Using it for list pages doesn't work and has potential weird side-effects.
The user probably meant to range over .Site.ReqularPages, and that is now marked clearly in the log.