How to list all posts for any given tag?


This is my code from post.html in the _layouts directory

<ul class="tags">

	{% for tag in page.tags %}
		<li><a href="/tags#{{ tag }}" class="tag">{{ tag }}</a></li>

		{% for post in site.tags.tag %}

			<ul class="taglinks">

				<li><a href="{{ post.url }}">{{ post.title }}</a></li>


		{% endfor %}

	{% endfor %}

But it doesn’t work - the post links aren’t written to each post.

Thanks in advance!



you want a list of each tag, with that tags posts below it?
here is what I have to do that, there is some other stuff going on but I’ll leave it in there. I haven’t built this site in quite a while but it should still work.

this is this page:

{% assign sorted_tags = site.tags | sort %}
{% for tag in sorted_tags %}
{% assign vids = tag[1] | sort %}

{% if vids != empty %}

  <h2 id="{{tag[0] | uri_escape | downcase}}">{{tag[0]}}</H2>
      {% for p in vids %}
     <a href="/{{p.type | downcase}}/"><img src="/assets/img/{{p.type | downcase}}.png" alt="{{p.type}}" title="{{p.type}}"/></a> <a href="{{ p.url }}">{{ p.title }}</a> ({{p.type}}/{{p.category}}) &raquo;  <span class="entry-date"><time datetime="{{ | date_to_xmlschema }}" itemprop="datePublished">{{ | date: "%B %d, %Y" }}</time></span>
     <br />
      {% endfor %}
{% endif %}

{% endfor %}


Thank you rdyar.

I have a tags page already.

I would like each post (example) to list site posts for each of those tags it contains.

Thanks again,