Skip to content

Instantly share code, notes, and snippets.

@echaozh
Created October 10, 2013 11:47
Show Gist options
  • Save echaozh/6917115 to your computer and use it in GitHub Desktop.
Save echaozh/6917115 to your computer and use it in GitHub Desktop.
jade template for tag page
- var tagsForPosts = function() {
- var data = public.posts.data;
- var tags = {};
- for (var name in data) {
- if (name[0] != '_') {
- var ts = data[name].tags;
- for (var i in ts) {
- tag = ts[i];
- tags[tag] = tags[tag] || []
- tags[tag].push (name);
- }
- }
- }
- return tags;
- }
h1 Posts tagged with 
span#tagName
each posts, tag in tagsForPosts()
ul.posts(id=tag, style="display: none")
each name in posts
li
- var teaser = teaserForPost(name);
+postTeaser(teaser)
script.
var tag = window.location.hash.substr (1);
document.getElementById ("tagName").innerText = tag;
document.getElementById (tag).style.display = "block";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment