diff --git a/hyde/ext/plugins/tagger.py b/hyde/ext/plugins/tagger.py index ac6d2aa..db1574a 100644 --- a/hyde/ext/plugins/tagger.py +++ b/hyde/ext/plugins/tagger.py @@ -130,11 +130,15 @@ class TaggerPlugin(Plugin): text = "{%% extends \"%s\" %%}" % template for tag, resources in self.site.tagger.tags.to_dict().iteritems(): - archive_text = self.template.render(text, dict( + context = {} + context.update(self.site.context) + context.update(dict( site=self.site, node=source, + tag=tag, walker=getattr(source, "walk_resources_tagged_with_%s" % tag) )) + archive_text = self.template.render(text, context) archive_file = File(target.child("%s.%s" % (tag, extension))) archive_file.write(archive_text) diff --git a/hyde/generator.py b/hyde/generator.py index d28d436..255c42f 100644 --- a/hyde/generator.py +++ b/hyde/generator.py @@ -43,9 +43,9 @@ class Generator(object): """ # TODO: update metadata and other resource # specific properties here. - self.__context__.update(resource=resource) + self.__context__.update(resource=resource, node=resource.node) yield self.__context__ - self.__context__.update(resource=None) + self.__context__.update(resource=None, node=None) def context_for_path(self, path): resource = self.site.resource_from_path(path) diff --git a/hyde/layouts/basic/content/media/css/site.css b/hyde/layouts/basic/content/media/css/site.css index ec05cf1..14165a9 100644 --- a/hyde/layouts/basic/content/media/css/site.css +++ b/hyde/layouts/basic/content/media/css/site.css @@ -42,8 +42,9 @@ table { } a { - color: #666; + color: #37e; text-decoration: underline; + text-shadow: 0px 2px 0px #fff; } a:hover{ @@ -317,10 +318,12 @@ ul.tags li a{ text-decoration: none; } +h1.tag:before, ul.tags li a:before{ content: '\00AB'; } +h1.tag:after, ul.tags li a:after{ content: '\00BB'; } @@ -404,4 +407,33 @@ a.backlink:hover, a.prev:hover, a.next:hover{ #facebook_like{ margin-top: 1px; -} \ No newline at end of file +} + +.archives ul.posts{ + margin-top: 24px; +} + +.archives li.post{ + list-style-type: none; + border-bottom: 1px dotted #ccc; + padding: 12px 0; + +} + +.archives li.post time{ + color: #999; + text-shadow: 0px 2px 0px #fff; + margin-right: 24px; + display:block; + float: left; + width: 120px; +} + +.archives li.post a{ + float: left; +} + +.archives ul.tags{ + float: right; + margin-bottom:0; +} diff --git a/hyde/layouts/basic/layout/blog.j2 b/hyde/layouts/basic/layout/blog.j2 index 1cdefbc..bf187ec 100644 --- a/hyde/layouts/basic/layout/blog.j2 +++ b/hyde/layouts/basic/layout/blog.j2 @@ -48,7 +48,9 @@ diff --git a/hyde/layouts/basic/layout/macros.j2 b/hyde/layouts/basic/layout/macros.j2 index 1b09ca5..d60c8d3 100644 --- a/hyde/layouts/basic/layout/macros.j2 +++ b/hyde/layouts/basic/layout/macros.j2 @@ -20,7 +20,7 @@ {% set active = (resource.url == site.content.resource_from_relative_path(item.url).url) -%} {% else -%} - {% set active = (resource.node == + {% set active = (node == site.content.node_from_relative_path(item.url)) -%} {%- endif %} {% set classes = ['button', 'white'] -%} diff --git a/hyde/layouts/basic/layout/tagged_posts.j2 b/hyde/layouts/basic/layout/tagged_posts.j2 new file mode 100644 index 0000000..530d6f1 --- /dev/null +++ b/hyde/layouts/basic/layout/tagged_posts.j2 @@ -0,0 +1,28 @@ +{% extends "base.j2" %} + +{% block main %} +
+

{{ tag }}

+ +
+{% endblock %} diff --git a/hyde/layouts/basic/site.yaml b/hyde/layouts/basic/site.yaml index d02c34a..2c48bd1 100644 --- a/hyde/layouts/basic/site.yaml +++ b/hyde/layouts/basic/site.yaml @@ -6,7 +6,7 @@ plugins: - hyde.ext.plugins.meta.MetaPlugin - hyde.ext.plugins.auto_extend.AutoExtendPlugin - hyde.ext.plugins.sorter.SorterPlugin - - hyde.ext.plugins.grouper.GrouperPlugin + - hyde.ext.plugins.tagger.TaggerPlugin - hyde.ext.plugins.syntext.SyntextPlugin - hyde.ext.plugins.textlinks.TextlinksPlugin context: @@ -47,4 +47,12 @@ sorter: reverse: true filters: source.kind: html - meta.listable: true \ No newline at end of file + meta.listable: true +tagger: + sorter: time + archives: + blog: + source: blog + target: blog/tags + template: tagged_posts.j2 + archive_extension: html \ No newline at end of file diff --git a/hyde/tests/sites/test_tagger/site.yaml b/hyde/tests/sites/test_tagger/site.yaml index 78d85a7..a2c21c7 100644 --- a/hyde/tests/sites/test_tagger/site.yaml +++ b/hyde/tests/sites/test_tagger/site.yaml @@ -27,4 +27,4 @@ tagger: template: tagged_posts.j2 source: blog target: blog/tags - archive_extension: html \ No newline at end of file + extension: html \ No newline at end of file