resources/feed.gtl
1 {{# Copyright 2017 Google Inc. }}
2 _feed((
3 {{# with a uid parameter, get one user's snippets
4 returns [name, snippet, ...]
5 The first entry is the user's name and the remaining entries are
6 the user's snippets, in order from most recent to least recent.
7 }}
8 [[if:uid]]
9 [
10 "[[if:_db.*uid]]{{_db.*uid.name}}[[/if:_db.*uid]][[if:!_db.*uid]]{{uid.0}}[[/if:!_db.*uid]]"
11 [[if:_db.*uid.snippets.0]][[for:_db.*uid.snippets]]
12 ,"{{_this:html}}"
13 [[/for:_db.*uid.snippets]][[/if:_db.*uid.snippets.0]]
14 ]
15 [[/if:uid]]
16 {{# without a uid parameter, get one snippet from each user
17 returns {'private_snippet':snippet, user:snippet, ...}
18 The first entry is the logged in user's private snippet.
19 The rest of the entries are all the other users' most recent snippet.
20 }}
21 [[if:!uid]]
22 {
23 "private_snippet":
24 "{{_profile.private_snippet:html}}"
25 [[for:_db]]
26 [[if:is_author]][[if:snippets.0]],"{{_key}}":
27 "{{snippets.0:html}}"[[/if:snippets.0]][[/if:is_author]][[/for:_db]]
28 }
29 [[/if:!uid]]
30 ))