Commit graph

414 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
00b590d7ab Improve the twitter card template
Now fall back to `images` set in site config for twitter card.

Fixes #3711
2017-07-17 23:09:52 +02:00
Bjørn Erik Pedersen
e0cf2e05bb tpl/collections: Add some empty slice tests to intersect
See #3686
2017-07-08 10:34:42 +02:00
Bjørn Erik Pedersen
dbbc5c4810 tpl/collections: Fix union when the first slice is empty
Fixes #3686
2017-07-08 10:31:09 +02:00
Bjørn Erik Pedersen
ccdd08d57a tpl/collections: Add Pages support to Intersect and Union
This enables `AND` (`intersect`)  and `OR` (`union`)  filters when combined with `where`.

Example:

```go
{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }}
{{ $pages := $pages | union (where .Site.RegularPages "Params.pinned" true) }}
{{ $pages := $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }}
```

The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page params.

Fixes #3174
2017-07-03 21:48:03 +02:00
Bjørn Erik Pedersen
d12cf5a25d tpl/collections: Fix In function for JSON arrays
Fixes #1468
2017-07-03 10:23:03 +02:00
Artem Sidorenko
34c566773a tpl/math: Add log function
It might be very useful for building tag clouds.
2017-07-03 00:20:48 +02:00
Bjørn Erik Pedersen
8431c8d39d tpl: Add WebP images support
Fixes #3529
2017-06-28 21:45:48 +02:00
Bruno Amaral
da72805a43 tpl: Only show post's own keywords in schema.org
Fixes #2635
Closes #2646
2017-06-28 21:26:18 +02:00
Yihui Xie
eccb064782 tpl: Simplify the Disqus template a little bit (#3655)
In accordance to the official guide: https://disqus.com/admin/universal/
2017-06-27 09:45:48 -06:00
Yihui Xie
2e1e4934b6 tpl: Improve the built-in Disqus template (#3639)
* Improve the built-in Disqus template

  Set `disqus_identifier`, `disqus_title`, and `disqus_url`
  only if the user has explicitly provided them.

  Do not load Disqus when the website is previewed locally,
  otherwise it is very confusing.

* Use disqus_config instead of three global variables

  https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables
2017-06-27 05:40:01 -06:00
Bjørn Erik Pedersen
873a6f1885 Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
Bjørn Erik Pedersen
c17ad675e8 all: Update textual references in Go source to point to gohugoio/hugo 2017-06-13 18:47:17 +02:00
Bjørn Erik Pedersen
d8717cd4c7 all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
Cameron Moore
b82cd82f11 tpl/collections: Add uint support to In 2017-06-08 21:01:15 +02:00
Cameron Moore
204c3a9e32 tpl/collections: Support interfaces in union
Fixes #3411
2017-06-08 21:01:15 +02:00
Nathan Sharfi
e28d9aa42c tpl: Add uniq function 2017-06-03 19:13:58 +02:00
Cameron Moore
4113693ac1 tpl/cast: Handle template.HTML and friends in ToInt
Also add tests for ToInt and ToString.

Resolves #3308
2017-05-22 23:20:53 +03:00
Bjørn Erik Pedersen
a119ef693f tpl/time: Re-add the time example 2017-05-20 11:41:43 +03:00
Bjørn Erik Pedersen
1f9e8dcc60 tpl: Make the Namespace func signature explicit
This makes it cleaner and avoids breaking client code, such as the docs helper JSON generator.
2017-05-20 11:34:38 +03:00
Cameron Moore
a59525b05b tpl/time: Remove asTime template func mapping 2017-05-20 00:00:20 +03:00
Cameron Moore
3954160a21 tpl/time: Support overlapping namespace and template func
Fixes #3421
2017-05-20 00:00:20 +03:00
Bjørn Erik Pedersen
93c5774dd7 tpl/collections: Make IsSet WARNING less chatty
Updates #3092
2017-05-19 21:14:37 +03:00
Bjørn Erik Pedersen
405c2f6899 tpl/images: Fix error handling in Config 2017-05-18 23:24:55 +03:00
Cameron Moore
58d4c25e50 tpl/collections: Use Feedback log instead of Error in IsSet
Using the Error log will cause Hugo to exit with an error, which could
break site build workflows.
2017-05-18 21:54:42 +03:00
Cameron Moore
38661c17bb tpl/collections: Log an error on unsupported types in IsSet
Unsupported types are currently silently ignored by IsSet.  An earlier
attempt was made to solve the issue by returning an error.  That attempt
was reverted since it broke some existing themes.

So instead, we'll log an error.  Hopefully, people will stop using IsSet
in this way, and we can eventually return an error outright.

Updates #3092
2017-05-18 21:54:42 +03:00
Cameron Moore
f1c29b017b tpl/collections: Add support for interfaces to intersect
Fixes #1952
2017-05-18 10:13:44 +03:00
Cameron Moore
93b3b13867 tpl/lang: Add NumFmt function
NumFmt formats a number with a given precision using the requested
decimal, grouping, and negative characters.

Fixes #1444
2017-05-18 09:49:20 +03:00
Bjørn Erik Pedersen
b6ea492b7a tmplimpl: Add support for ellipsed paginator
Fixes #3466
2017-05-17 21:47:05 +03:00
Bjørn Erik Pedersen
af72db806f hugolib: Handle shortcode per output format
This commit allows shortcode per output format, a typical use case would be the special AMP media tags.

Note that this will only re-render the "overridden" shortcodes and only  in pages where these are used, so performance in the normal case should not suffer.

Closes #3220
2017-05-13 22:44:15 +03:00
Bjørn Erik Pedersen
cff2f31334 tpl: Add some GoDoc info to template func docs
Closes #3418
2017-05-04 10:46:19 +02:00
Bjørn Erik Pedersen
3dd949d956 tpl/urls: Make urlize return a string
Like it did in 0.20.
2017-05-02 23:46:36 +02:00
Cameron Moore
08c0de5cc3 tpl/data: Clean up data namespace
- Move the main GetCSV and GetJSON into data.go.
- Add error returns to GetCSV and GetJSON.
- Add http client to Namespace for test mocking.
- Send accept headers on remote requests. Fixes #3395
- Return an error on non-2XX HTTP response codes and don't retry.
- Move cache tests to cache_test.go.
2017-05-02 09:18:41 +02:00
Cameron Moore
1cf2f3dc4f tpl/data: Move cache logic to separate file 2017-05-02 09:18:41 +02:00
Cameron Moore
5f095c27ea tpl/data: Shorten some internal func names 2017-05-02 09:18:41 +02:00
Cameron Moore
f604076de1 tpl/images: Fix embedded sync.Mutex 2017-05-02 09:17:14 +02:00
Cameron Moore
f69df916df tpl: Add basic tests for all namespace init funcs 2017-05-02 00:07:33 +02:00
Bjørn Erik Pedersen
690b0f8ff5 tpl: Add docshelper for template funcs
And fix some other minor related issues.

Updates #3418
2017-05-01 21:44:15 +02:00
Bjørn Erik Pedersen
e2b067f050 tpl/partials: Remouve unused method 2017-05-01 15:57:52 +02:00
Bjørn Erik Pedersen
0e2260421e tpl: Fix the remaining template funcs namespace issues
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
4714085a10 tpl/urls: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
55f90a3a0d tpl/transform: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
ee5aa84f2a tpl/time: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
4a3463463f tpl/safe: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
b958c0c109 tpl/os: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
fc77b6303c tpl/inflect: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
a432c90aee tpl/images: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
9aee8ace4e tpl/encoding: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
744dccbea4 tpl/crypto: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
8a49c0b3b8 tpl/collections: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Bjørn Erik Pedersen
a3bf118eaa tpl/compare: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00