Created
October 10, 2013 11:47
-
-
Save echaozh/6917115 to your computer and use it in GitHub Desktop.
jade template for tag page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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