diff options
author | Phil Pennock <pdp@spodhuis.org> | 2013-11-10 12:04:51 -0800 |
---|---|---|
committer | Noah Campbell <noahcampbell@gmail.com> | 2013-11-12 22:49:54 +0000 |
commit | 40d05f12a7669f349d231448eaefe907b795a35b (patch) | |
tree | 74ae4fbf0fd3c1471043d7dc1117aeaaa1fdd154 /hugolib/config.go | |
parent | 6017599a3c0160d3f4daad671c1d6b1df47a4b3e (diff) |
Truncated; .Site.Params; First function
* Add `.Truncated` bool to each page; will be set true if the
`.Summary` is truncated and it's worth showing a "more" link of some
kind.
* Add `Params` to the site config, defining `.Site.Params` accessible
to each page; this lets the site maintainer associate arbitrary data
with names, on a site-wide basis.
* Provide a `First` function to templates:
* Use-case: `{{range First 5 .Site.Recent}}` or anything else which
is a simple iterable provided by hugolib
* Tests by me for `.Truncated` and `First`
Also @noahcampbell contributed towards this:
* Add UnitTest for `.Site.Params`:
> Digging into this test case a bit more, I'm realizing that we need
> to create a param test case to ensure that for each type we render
> (page, index, homepage, rss, etc.) that the proper fields are
> represented. This will help us refactor without fear in the
> future.
Sample config.yaml:
```yaml
title: "Test site"
params:
Subtitle: "More tests always good"
AuthorName: "John Doe"
SidebarRecentLimit: 5
```
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
Diffstat (limited to 'hugolib/config.go')
-rw-r--r-- | hugolib/config.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hugolib/config.go b/hugolib/config.go index 030a5c945..b9b5d54bd 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -33,6 +33,7 @@ type Config struct { Title string Indexes map[string]string // singular, plural ProcessFilters map[string][]string + Params map[string]interface{} BuildDrafts, UglyUrls, Verbose bool } |