Display list of posts by tag, BUT ONLY if in a specific category

So i use this today for a tag list and it works fine, but i’d like to layer on an additional filter to show me that exact list but for only posts of a specific category. Here’s the mess i have so far:

<div class="p-3 border rounded-1 bg-light mt-2">
			
			
			{% assign sorted_tags = site.tags | sort %}
			{% for tag in sorted_tags %}
			
			{% assign zz = tag[1] | sort %}
			{% if zz != empty %}
			
			<a href="#" class="tagpagescroll" id="{{ tag[0] | replace: " ","-" | downcase }}" style="text-decoration: none; cursor:default; color: black; font-weight: 600;">{{ tag[0] | downcase }}</a>
			<ul class="taglist">
				
				
				{% for p in zz %}
				
				
				{% assign category_name = site.categories | sort %}
				{% for category in category_name %}
				
				{% assign yy = category[1] | sort %}
				{% if yy != empty %}
				
				{% if categories == "posts" %}
				POSTS
				{% endif %}
				
				{% if category[0] == "photos" %}
				PHOTOS
				{% endif %}
				
				{% if category[1] == "writing" %}
				WRITING
				{% endif %}
				
				{% endif %}



				
				<li class="taglist"><a href="{{ p.url }}" class="as-menu-link">{{ p.title }}</a> <span class="tag-index-meta">{% include tag-index-meta.html %}</span></li>
				
				
				{% endfor %}
				
				
			</ul>
			
			{% endif %}
			{% endfor %}
			{% endfor %}
		</div>	
	</div>

Thanks for taking a look… Andre

lol, I’d recognize my code any where, this is from a post on stackoverflow right?? naming things is hard.

are you trying to do this once for only one category?

what did you get with the code now? does POSTS output?

You might want to output the value of zz and yy to better understand what they contain.