summaryrefslogtreecommitdiffstats
path: root/tpl
AgeCommit message (Collapse)Author
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-08-06Remove alias of os.Statsatotake
2018-08-06Renmae FileStat Statsatotake
2018-08-06Fix typosatotake
2018-08-06Add fileStat to tpl/os/ossatotake
2018-07-31tpl/partials: Add templates.ExistsBjørn Erik Pedersen
Fixes #5010
2018-07-31tpl/partials: Remove superflous loopBjørn Erik Pedersen
No need to check the themes template prefix.
2018-07-18Add optional lang as argument to rel/relrefBjørn Erik Pedersen
Fixes #4956
2018-07-12Improve type support in resources.ConcatBjørn Erik Pedersen
This allows the result of `.Resources.Match` and similar to be concatenated. Fixes #4934
2018-07-11Flush partialCached cache on rebuildsBjørn Erik Pedersen
Fixes #4931
2018-07-09tpl: Set permission of embedded templates to 0644Anthony Fok
2018-07-06Add a newScratch template funcBjørn Erik Pedersen
Fixes #4685
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-07-01tpl/collections: Return en empty slice in after instead of errorBjørn Erik Pedersen
When the given index is out of bounds. So it can safely be used with `with` etc. without extra length checking. Fixes #4894
2018-06-26tpl: Remove some "debug info"Bjørn Erik Pedersen
See #4881
2018-06-26tpl: Update internal pagination template to support Bootstrap 4Bjørn Erik Pedersen
Fixes #4881
2018-06-23Revert "tpl: Support text/template/parse API change in go1.11"Anthony Fok
Go developers have undone the breaking API changes in the following commit: commit bedfa4e1c37bd08063865da628f242d27ca06ec4 Author: Daniel Theophanes <kardianos@gmail.com> Date: Thu Jun 21 10:41:26 2018 -0700 text/template/parse: undo breaking API changes golang.org/cl/84480 altered the API for the parse package for clarity and consistency. However, the changes also broke the API for consumers of the package. This CL reverts the API to the previous spelling, adding only a single new exported symbol. Fixes #25968 Change-Id: Ieb81054b61eeac7df3bc3864ef446df43c26b80f Reviewed-on: https://go-review.googlesource.com/120355 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> See https://github.com/golang/go/issues/25968 This reverts commit 9f27091e1067875e2577c331acc60adaef5bb234. Closes #4784 Fixes #4873
2018-06-14tpl: Support text/template/parse API change in go1.11Anthony Fok
Thanks to @rjoleary for the investigation. Fixes #4784
2018-06-10Add support for theme composition and inheritanceBjørn Erik Pedersen
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-09tpl: Always load GA script over HTTPSChristian Oliff
2018-06-09tplimpl: Remove speakerdeck shortcodeAlexandros
Fixes #4830
2018-06-04tpl/strings: strings.RuneCountDavid E. Wheeler
2018-06-04tpl: Prevent isBaseTemplate() from matching "baseof" in dirAnthony Fok
Fixes #4809
2018-06-03tpl/strings: Remove overflow check in strings.RepeatBjørn Erik Pedersen
The test fails on 32 bit systems. Let it panic instead.
2018-06-03tpl/strings: Adjust the overflow validation in strings.RepeatBjørn Erik Pedersen
This now matches the validation in the stdlib, but we return an error instead.
2018-06-03tpl: Add strings.RepeatDavid E. Wheeler
2018-05-31Fixes #4798Alex
2018-05-30tpl: Remove frameborder attr YT iframe + CSS fixesAlex
2018-05-30Fix vimeo_simple thumb scalingAlex
2018-05-30Add vimeo_simpleAlexandros
Fixes #4749
2018-05-27fix typo instagram_simpleAlex
2018-05-25Fix GA anonymizeIp orderBjørn Erik Pedersen
2018-05-25Add no-cookie variants of the Google Analytics templatesBjørn Erik Pedersen
The current full set of options for GA is now: ```toml [privacy] [privacy.googleAnalytics] disable = false respectDoNotTrack = true anonymizeIP = true useSessionStorage = true ``` Fixes #4775
2018-05-25tpl: Remove the shortcode assets for nowBjørn Erik Pedersen
Not in use.
2018-05-25tpl: Adjust instagram_simple marginsBjørn Erik Pedersen
2018-05-25Remove youtube_simple for nowBjørn Erik Pedersen
We need to revisit and complete that. See #4751
2018-05-25Add anonymizeIP to GA privacy configBjørn Erik Pedersen
See #4751
2018-05-24Fix broken testBjørn Erik Pedersen
2018-05-24Support DNT in Twitter shortcode for GDPRBjørn Erik Pedersen
Fixes #4765
2018-05-24tpl: Alias tweet shortode to twitterBjørn Erik Pedersen
See #4765
2018-05-23Regenerate embedded templatesBjørn Erik Pedersen
See #4761
2018-05-23Fix youtube_simple thumb scalingAlexandros
Fixes #4761
2018-05-23Add instagram_simple shortcodeBjørn Erik Pedersen
Fixes #4748
2018-05-23Remove the id from youtube_simpleBjørn Erik Pedersen
For now, anyway. See #4751
2018-05-23Fix some recently broken embedded templatesBjørn Erik Pedersen
And add tests for them. Fixes #4757
2018-05-22Move the privacy config into a parentBjørn Erik Pedersen
See #4751
2018-05-22tpl: Add another class and an id to youtube_simpleBjørn Erik Pedersen
To provide some more styling options. See #4616
2018-05-21Make the simple mode YouTube links schemalessBjørn Erik Pedersen
See #4616
2018-05-21Add YouTube shortcode simple modeBjørn Erik Pedersen
Adapted from the work of @onedrawingperday. See #4616
2018-05-21Add PrivacyEnhanced mode for YouTube to the GDPR PolicyBjørn Erik Pedersen
See #4616