hugo/hugolib
Bjørn Erik Pedersen e27fd4c1b8 tpl/collections: Add collections.Append
Before this commit you would typically use `.Scratch.Add` to manually create slices in a loop.

With variable overwrite in Go 1.11, we can do better. This commit adds the `append` template func.

A made-up example:

```bash
{{ $p1 := index .Site.RegularPages 0 }}{{ $p2 := index .Site.RegularPages 1 }}
{{ $pages := slice }}
{{ if true }}
  {{ $pages = $pages | append $p2 $p1 }}
{{ end }}
```

Note that with 2 slices as arguments, the two examples below will give the same result:

```bash
{{ $s1 := slice "a" "b" | append (slice "c" "d") }}
{{ $s2 := slice "a" "b" | append "c" "d" }}
```

Both of the above will give `[]string{a, b, c, d}`.

This commit also improves the type handling in the `slice` template function. Now `slice "a" "b"` will give a `[]string` slice. The old behaviour was to return a `[]interface{}`.

Fixes #5190
2018-09-14 10:12:08 +02:00
..
filesystems hugolib: Add missing error checks 2018-08-30 22:31:29 +02:00
pagemeta hugolib: Simplify some code 2018-08-30 22:31:29 +02:00
paths hugolib: Fix typo in private func name 2018-08-30 22:31:29 +02:00
testdata
testsite hugolib: Add multiple content dirs to GitInfo test site 2018-08-11 19:51:19 +02:00
404_test.go
alias.go Update alias.go 2018-08-07 09:42:49 +02:00
alias_test.go
author.go
case_insensitive_test.go
collections.go tpl/collections: Add collections.Append 2018-09-14 10:12:08 +02:00
collections_test.go tpl/collections: Add collections.Append 2018-09-14 10:12:08 +02:00
config.go
config_test.go Improve minifier MIME type resolution 2018-08-28 17:00:53 +02:00
datafiles_test.go
disableKinds_test.go Simplify .Site.GetPage etc. 2018-07-18 00:07:20 +02:00
embedded_shortcodes_test.go Fix broken tests 2018-08-09 20:58:31 +02:00
embedded_templates_test.go
fileInfo.go
gitinfo.go hugolib: Fix GitInfo when multiple content dirs 2018-08-11 19:51:19 +02:00
hugo_info.go
hugo_info_test.go
hugo_sites.go Fix handling of taxonomy terms containing slashes 2018-08-22 07:18:37 +02:00
hugo_sites_build.go
hugo_sites_build_failures_test.go
hugo_sites_build_test.go Simplify .Site.GetPage etc. 2018-07-18 00:07:20 +02:00
hugo_sites_multihost_test.go Fix Resource output in multihost setups 2018-08-13 19:00:51 +02:00
hugo_themes_test.go
language_content_dir_test.go Add optional lang as argument to rel/relref 2018-07-18 00:07:20 +02:00
media.go
menu.go
menu_test.go
minify_publisher_test.go Add support for minification of final output 2018-08-06 19:58:41 +02:00
multilingual.go
orderedMap.go
orderedMap_test.go
page.go tpl/collections: Improve type handling in collections.Slice 2018-09-10 09:19:01 +02:00
page_bundler.go hugolib: Force render of any changed page, even in Fast Render Mode 2018-08-16 12:54:59 +02:00
page_bundler_capture.go hugoblib: Fix "adding a bundle" in server mode 2018-08-16 12:54:59 +02:00
page_bundler_capture_test.go resource/scss: Add IncludePaths config option 2018-07-20 17:50:44 +02:00
page_bundler_handlers.go Fix Resource output in multihost setups 2018-08-13 19:00:51 +02:00
page_bundler_test.go Improve minifier MIME type resolution 2018-08-28 17:00:53 +02:00
page_collections.go hugolib: Fix image cache-clearing for sub-languages 2018-08-16 12:54:59 +02:00
page_collections_test.go Enable test case fixed by commit 501543d4 2018-07-19 20:40:50 +02:00
page_output.go
page_paths.go Fix handling of taxonomy terms containing slashes 2018-08-22 07:18:37 +02:00
page_paths_test.go Fix handling of taxonomy terms containing slashes 2018-08-22 07:18:37 +02:00
page_permalink_test.go
page_resource.go
page_taxonomy_test.go Fix handling of taxonomy terms containing slashes 2018-08-22 07:18:37 +02:00
page_test.go hugolib: Simplify some code 2018-08-30 22:31:29 +02:00
page_time_integration_test.go
page_without_content.go
pageCache.go
pageCache_test.go
pageGroup.go tpl/collections: Improve type handling in collections.Slice 2018-09-10 09:19:01 +02:00
pageGroup_test.go tpl/collections: Improve type handling in collections.Slice 2018-09-10 09:19:01 +02:00
pages_language_merge.go hugolib: Allow untyped nil to be merged in lang.Merge 2018-07-21 11:41:23 +02:00
pages_language_merge_test.go hugolib: Allow untyped nil to be merged in lang.Merge 2018-07-21 11:41:23 +02:00
pages_related.go hugolib: Use the interface value when doing Related search 2018-08-14 18:19:45 +02:00
pages_related_test.go
pageSort.go
pageSort_test.go
pagesPrevNext.go
pagesPrevNext_test.go
pagination.go tpl/collections: Improve type handling in collections.Slice 2018-09-10 09:19:01 +02:00
pagination_test.go
path_separators_test.go
permalinker.go
permalinks.go
permalinks_test.go
prune_resources.go
resource_chain_test.go hugolib: Only run variable variable overwrite test on Go 1.11 2018-08-28 18:00:19 +02:00
robotstxt_test.go
rss_test.go
shortcode.go hugolib: Fix shortcode output wrapped in p 2018-08-17 09:13:30 +02:00
shortcode_test.go hugolib: Adjust tests for shortcode p-issue 2018-08-17 09:13:39 +02:00
shortcodeparser.go
shortcodeparser_test.go
site.go hugolib: Do not FirstUpper taxonomy titles 2018-09-06 20:29:21 +02:00
site_benchmark_test.go
site_output.go hugolib: Simplify some code 2018-08-30 22:31:29 +02:00
site_output_test.go Improve minifier MIME type resolution 2018-08-28 17:00:53 +02:00
site_render.go Add support for minification of final output 2018-08-06 19:58:41 +02:00
site_sections.go hugolib: Fix Related when called from shortcode 2018-08-14 18:11:36 +02:00
site_sections_test.go hugolib: Fix .Site.GetPage regression 2018-07-24 11:37:59 +02:00
site_stats_test.go
site_test.go Increase refLinker test coverage 2018-07-20 07:02:41 +02:00
site_url_test.go Simplify .Site.GetPage etc. 2018-07-18 00:07:20 +02:00
siteJSONEncode_test.go
sitemap.go
sitemap_test.go
taxonomy.go
taxonomy_test.go hugolib: Do not FirstUpper taxonomy titles 2018-09-06 20:29:21 +02:00
template_engines_test.go
template_test.go
testhelpers_test.go hugolib: Only run variable variable overwrite test on Go 1.11 2018-08-28 18:00:19 +02:00
translations.go