siteleaf / siteleaf-v1-themes

Siteleaf v1 theme documentation
http://www.siteleaf.com
69 stars 7 forks source link

Building an array of all tags #7

Closed kilmc closed 10 years ago

kilmc commented 10 years ago

Hey guys,

I'm having a bit of trouble building an array of all the categories for blog posts on a site I'm working on.

On the index page it renders the names of the categories for the listed posts but as soon as I click into a post it limits it to just the tags for that post. We use the categories as a nav on the site so I need it to render all tags for all posts no matter the page.

As per usual, I'm sure it's something simple that I'm doing wrong but I went through Jonnie's post on Taxonomy and the docs and I can't seem to figure a way of changing the scope to be global rather than per post.

Thanks

destroytoday commented 10 years ago

Hey Killian,

You need to get the taxonomy from the page. When you call it from the post, it only returns the taxonomy from that post. In your nav, you would do something like: {% for tag in site.pages.blog.taxonomy.tags %}

That way, it's always an absolute reference to your page, rather than relying on a path.

kilmc commented 10 years ago

Fantastic, it looks like I was leaving out the .pages part, forgetting the posts were technically in a subpage. Sorted. Thanks.