This website requires JavaScript.
Explore
Help
Sign in
github
/
hugo
Watch
1
Star
0
Fork
You've already forked hugo
0
mirror of
https://github.com/gohugoio/hugo.git
synced
2024-11-21 20:46:30 -05:00
Code
Issues
Projects
Releases
Packages
Wiki
Activity
be540f5b8f
hugo
/
tpl
/
template_test.go
4 lines
34 B
Go
Raw
Normal View
History
Unescape
Escape
Move template library into it's own package (tpl). No longer dependent on hugolib. Can be used externally.
2014-11-20 12:32:21 -05:00
package
tpl
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>
2013-11-10 15:04:51 -05:00
tpl: split template.go The template funcs get their own file. This prevents having to scroll miles to get to the template infrastructure.
2015-04-05 15:03:16 -04:00
// TODO(bep) test it
Reference in a new issue
Copy permalink