Sort tags by tag count

I am trying to find a way to sort my list of tags by post count. As it stands this is what I have so far:
- blog.tags.sort.each do |tag, articles| = partial "components/builders/writing/tags", locals: { tag: tag, tag_count: articles.count }
and the partial
div[class="w-tags-item"] a[class="w-tags-item-link text-lowercase" href="#{locals[:tag_path]}"] = locals[:tag].downcase - if locals[:tag_count] => |[#{locals[:tag_count]}] span[class="w-tags-item-separator"] |,
Has anyone tried this before?

In case anyone is looking, here is how I solved this!

Partial
div[class="w-tags-item"] a[class="w-tags-item-link text-lowercase" href="#{locals[:tag_path]}"] = locals[:tag].downcase - if locals[:tag_count] && locals[:tag_count] > 1 => |- => span[class="text-emphasis"] = locals[:tag_count] span[class="w-tags-item-separator"] |,

Caller
- blog.tags.sort_by{ |t| t[1].count }.reverse.each do |tag, articles| = partial "components/builders/writing/tags", locals: { tag: tag, tag_count: articles.count }