@@ -130,11 +130,15 @@ class TaggerPlugin(Plugin): | |||||
text = "{%% extends \"%s\" %%}" % template | text = "{%% extends \"%s\" %%}" % template | ||||
for tag, resources in self.site.tagger.tags.to_dict().iteritems(): | 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, | site=self.site, | ||||
node=source, | node=source, | ||||
tag=tag, | |||||
walker=getattr(source, | walker=getattr(source, | ||||
"walk_resources_tagged_with_%s" % tag) | "walk_resources_tagged_with_%s" % tag) | ||||
)) | )) | ||||
archive_text = self.template.render(text, context) | |||||
archive_file = File(target.child("%s.%s" % (tag, extension))) | archive_file = File(target.child("%s.%s" % (tag, extension))) | ||||
archive_file.write(archive_text) | archive_file.write(archive_text) |
@@ -43,9 +43,9 @@ class Generator(object): | |||||
""" | """ | ||||
# TODO: update metadata and other resource | # TODO: update metadata and other resource | ||||
# specific properties here. | # specific properties here. | ||||
self.__context__.update(resource=resource) | |||||
self.__context__.update(resource=resource, node=resource.node) | |||||
yield self.__context__ | yield self.__context__ | ||||
self.__context__.update(resource=None) | |||||
self.__context__.update(resource=None, node=None) | |||||
def context_for_path(self, path): | def context_for_path(self, path): | ||||
resource = self.site.resource_from_path(path) | resource = self.site.resource_from_path(path) | ||||
@@ -42,8 +42,9 @@ table { | |||||
} | } | ||||
a { | a { | ||||
color: #666; | |||||
color: #37e; | |||||
text-decoration: underline; | text-decoration: underline; | ||||
text-shadow: 0px 2px 0px #fff; | |||||
} | } | ||||
a:hover{ | a:hover{ | ||||
@@ -317,10 +318,12 @@ ul.tags li a{ | |||||
text-decoration: none; | text-decoration: none; | ||||
} | } | ||||
h1.tag:before, | |||||
ul.tags li a:before{ | ul.tags li a:before{ | ||||
content: '\00AB'; | content: '\00AB'; | ||||
} | } | ||||
h1.tag:after, | |||||
ul.tags li a:after{ | ul.tags li a:after{ | ||||
content: '\00BB'; | content: '\00BB'; | ||||
} | } | ||||
@@ -404,4 +407,33 @@ a.backlink:hover, a.prev:hover, a.next:hover{ | |||||
#facebook_like{ | #facebook_like{ | ||||
margin-top: 1px; | margin-top: 1px; | ||||
} | |||||
} | |||||
.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; | |||||
} |
@@ -48,7 +48,9 @@ | |||||
<ul class="tags clear"> | <ul class="tags clear"> | ||||
{% for tag in resource.meta.tags %} | {% for tag in resource.meta.tags %} | ||||
<li> | <li> | ||||
<a class="small">{{ tag }}</a> | |||||
<a class="small" href="{{ content_url('blog/tags/'~tag~'.html') }}"> | |||||
{{ tag }} | |||||
</a> | |||||
</li> | </li> | ||||
{% endfor %} | {% endfor %} | ||||
</ul> | </ul> | ||||
@@ -20,7 +20,7 @@ | |||||
{% set active = (resource.url == | {% set active = (resource.url == | ||||
site.content.resource_from_relative_path(item.url).url) -%} | site.content.resource_from_relative_path(item.url).url) -%} | ||||
{% else -%} | {% else -%} | ||||
{% set active = (resource.node == | |||||
{% set active = (node == | |||||
site.content.node_from_relative_path(item.url)) -%} | site.content.node_from_relative_path(item.url)) -%} | ||||
{%- endif %} | {%- endif %} | ||||
{% set classes = ['button', 'white'] -%} | {% set classes = ['button', 'white'] -%} | ||||
@@ -0,0 +1,28 @@ | |||||
{% extends "base.j2" %} | |||||
{% block main %} | |||||
<section class="archives"> | |||||
<h1 class="tag title">{{ tag }}</h1> | |||||
<ul class="posts clear"> | |||||
{% for resource in walker() -%} | |||||
<li class="post clear"> | |||||
<time datetime="{{ resource.meta.created.strftime('%Y-%m-%d') }}"> | |||||
{{ resource.meta.created.strftime('%a, %d %b %Y') }} | |||||
</time> | |||||
<a href="{{ content_url(resource.url) }}">{{ resource.meta.title }}</a> | |||||
{% if resource.meta.tags %} | |||||
<ul class="tags"> | |||||
{% for tag in resource.meta.tags %} | |||||
<li> | |||||
<a class="small" href="{{ content_url('blog/tags/'~tag~'.html') }}"> | |||||
{{ tag }} | |||||
</a> | |||||
</li> | |||||
{% endfor %} | |||||
</ul> | |||||
{% endif %} | |||||
</li> | |||||
{%- endfor %} | |||||
</ul> | |||||
</section> | |||||
{% endblock %} |
@@ -6,7 +6,7 @@ plugins: | |||||
- hyde.ext.plugins.meta.MetaPlugin | - hyde.ext.plugins.meta.MetaPlugin | ||||
- hyde.ext.plugins.auto_extend.AutoExtendPlugin | - hyde.ext.plugins.auto_extend.AutoExtendPlugin | ||||
- hyde.ext.plugins.sorter.SorterPlugin | - hyde.ext.plugins.sorter.SorterPlugin | ||||
- hyde.ext.plugins.grouper.GrouperPlugin | |||||
- hyde.ext.plugins.tagger.TaggerPlugin | |||||
- hyde.ext.plugins.syntext.SyntextPlugin | - hyde.ext.plugins.syntext.SyntextPlugin | ||||
- hyde.ext.plugins.textlinks.TextlinksPlugin | - hyde.ext.plugins.textlinks.TextlinksPlugin | ||||
context: | context: | ||||
@@ -47,4 +47,12 @@ sorter: | |||||
reverse: true | reverse: true | ||||
filters: | filters: | ||||
source.kind: html | source.kind: html | ||||
meta.listable: true | |||||
meta.listable: true | |||||
tagger: | |||||
sorter: time | |||||
archives: | |||||
blog: | |||||
source: blog | |||||
target: blog/tags | |||||
template: tagged_posts.j2 | |||||
archive_extension: html |
@@ -27,4 +27,4 @@ tagger: | |||||
template: tagged_posts.j2 | template: tagged_posts.j2 | ||||
source: blog | source: blog | ||||
target: blog/tags | target: blog/tags | ||||
archive_extension: html | |||||
extension: html |