summaryrefslogtreecommitdiffstats
path: root/hugolib
AgeCommit message (Collapse)Author
2017-05-01tpl/collections: Make it a package that stands on its ownBjørn Erik Pedersen
See #3042
2017-04-30tpl: Add template function namespacesCameron Moore
This commit moves almost all of the template functions into separate packages under tpl/ and adds a namespace framework. All changes should be backward compatible for end users, as all existing function names in the template funcMap are left intact. Seq and DoArithmatic have been moved out of the helpers package and into template namespaces. Most of the tests involved have been refactored, and many new tests have been written. There's still work to do, but this is a big improvement. I got a little overzealous and added some new functions along the way: - strings.Contains - strings.ContainsAny - strings.HasSuffix - strings.TrimPrefix - strings.TrimSuffix Documentation is forthcoming. Fixes #3042
2017-04-30Render 404 in default language onlyMitchell Cohen
This prevents 404.html from being re-rendered for each site. Fixes #3075
2017-04-27hubolib: Narrow a test assertionBjørn Erik Pedersen
2017-04-27hugolib: Avoid index.md in /index/index.htmlBjørn Erik Pedersen
Hugo 0.20 broke some sites that grouped their blog post and images together in subfolders. This commit re-introduces that behaviour: * If the file base name resolves to the same as the base name for the output type (i.e. "index" for HTML), the user probably meant it, so we treat that as an `uglyURL`, i.e. `my-blog-post-1.md`=> `/my-blog-post-1/index.html` * The main use case for this is to group blog post and images together. * Note that for the top level folder there will be a potential name conflict with a `section` `index.html` (if enabled) * This issue will not be relevant for subfolders in sections * Hugo will soon add support for nested sections, but we will have to find a way to separate them from the rest (`/content/_mysubsection` maybe). Fixes #3396
2017-04-26hugolib: Make missing GitInfo a WARNINGBjørn Erik Pedersen
And not an ERROR. Fixes #3376
2017-04-24Automate the Hugo release processBjørn Erik Pedersen
This commit adds a work flow aroung GoReleaser to get the Hugo release process automated and more uniform: * It can be run fully automated or in two steps to allow for manual edits of the relase notes. * It supports both patch and full releases. * It fetches author, issue, repo info. etc. for the release notes from GitHub. * The file names produced are mainly the same as before, but we no use tar.gz as archive for all Unix versions. * There isn't a fully automated CI setup in place yet, but the release tag is marked in the commit message with "[ci deploy]" Fixes #3358
2017-04-23hugolib: Fix handling of zero-length filesBjørn Erik Pedersen
This was a regression in Hugo 0.20. This commit makes sure that zeron-length files are not rendered to file. Fixes #3355
2017-04-22hugolib: Prevent decoding pageParam in common casesAlbert Nigmatzianov
2017-04-22hugolib: Ignore non-source files on partial rebuildxofyarg
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.
2017-04-18hugolib: Log WARNING only on unknown /data filesBjørn Erik Pedersen
Fixes #3361
2017-04-12hugolib, output: Do not lower case template namesBjørn Erik Pedersen
This regression was introduced in Hugo 0.20. Fixes #3333
2017-04-12hugolib: Must recreate Paginator on live-reloadBjørn Erik Pedersen
The structure may potentially have changed, and then it fails. Fixes #3315
2017-04-12hugolib: Avoid recreating the Paginator on copyBjørn Erik Pedersen
See #3315
2017-04-12hugolib: Avoid processing the same notify event twiceBjørn Erik Pedersen
On `macOS`, at least, we've seen multiple WRITE events for same file, and no need to do the same job twice.
2017-04-10hugolib: Final fix of rssURI deprecationBjørn Erik Pedersen
Fixes #3319
2017-04-10hugolib: Only show rssUri deprecation WARNING if it is actually setBjørn Erik Pedersen
Fixes #3319
2017-04-08hugolib: Remove unused lineBjørn Erik Pedersen
2017-04-08hugolib: Delay deletion of Page.Now()Bjørn Erik Pedersen
Looking at the state of the themes, it will be too painful to log ERROR now.
2017-04-08hugolib, output: Add NotAlternative to OutputFormatBjørn Erik Pedersen
To make sure CSS and similar does not appear in the AlternativeOutputFormats list.
2017-04-08hugolib: Deprecate rssURIBjørn Erik Pedersen
2017-04-07hubolib: Do not add missing trailing slash to command line baseURLBjørn Erik Pedersen
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
2017-04-07hugolib: Add .Site.Params.mainSectionsBjørn Erik Pedersen
Fixes #3206
2017-04-07hugolib: Only do link transforms etc. on HTML type of pagesBjørn Erik Pedersen
See #2828
2017-04-07hugolib: Update deprecation vs Hugo 0.20Bjørn Erik Pedersen
Fixes #3271
2017-04-06all: Handle all errorsBjørn Erik Pedersen
As reported by `errcheck`.
2017-04-04hugolib: Add optional outputFormat to Ref/RelRefBjørn Erik Pedersen
Fixes #3224
2017-04-04Register all media types when in server modeBjørn Erik Pedersen
Fixes #3274
2017-04-04all: Use the configured output types to resolve template typeBjørn Erik Pedersen
Closes #320
2017-04-04hugolib: Improve render error handlingBjørn Erik Pedersen
Catch and return the "template not found" error earlier.
2017-04-04hugolib: Read media types and output formats from site configBjørn Erik Pedersen
Closes #3222 Closes #3223
2017-04-04output: Add output formats decoderBjørn Erik Pedersen
And clean up the output package.
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
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
2017-04-02hugolib: Don't ignore errors from applyDepsIfNeededAlbert Nigmatzianov
2017-04-02hugolib, i18n: Update tests with flat format and TOML filesAlbert Nigmatzianov
2017-04-02Revert "tpl: Rework to handle both text and HTML templates"Bjørn Erik Pedersen
Will have to take another stab at this ... This reverts commit 5c5efa03d2512749950b0d05a7d4bde35ecbdc37. Closes #3260
2017-04-02hugolib: Use Page Kind in template errors to prevent log spamBjørn Erik Pedersen
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.
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
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
2017-03-29hugolib, helpers: Reduce log level to WARN on .Render for non-regular pagesBjørn Erik Pedersen
We will eventually support all types in the Render method.
2017-03-28hugolib, output: GofmtBjørn Erik Pedersen
2017-03-27hugolib, output: Restrict Render to regular PagesBjørn Erik Pedersen
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.
2017-03-27hugolib: Fix Render layouts for list pagesBjørn Erik Pedersen
2017-03-27hugolib: Wrap pageOutput create in sync.OnceBjørn Erik Pedersen
2017-03-27hugolib: Fix panic for Permalink in 404 etc. templatesBjørn Erik Pedersen
2017-03-27output: Rename HTMLType etc. to HTMLFormatBjørn Erik Pedersen
2017-03-27hugolib: Revise paginator alias path handlingBjørn Erik Pedersen
2017-03-27hugolib: More TODO fixesBjørn Erik Pedersen
2017-03-27hugolib, layout: Consolidate RSS template handlingBjørn Erik Pedersen
2017-03-27Remove the now superflous defaultExtensionBjørn Erik Pedersen
And some other unsed fields and methods.
2017-03-27all: Propagate baseURL error to the callersBjørn Erik Pedersen