<div id="sidebar">
  <nav>
    <h2>Archive</h2>
    <ul>
      <% @posts_by_month.each do |month, posts| %>
        <li><%= link_to month.strftime('%B %Y'), blog_posts_archives_path(month.year, month.month) %></li>
      <% end %>
    </ul>

    <% if @tags.present? %>
      <h2>Category</h2>
      <ul>
        <% @tags.each do |tag| %>
          <li><%= link_to tag.name, tagged_blog_posts_path(tag.name) %></li>
        <% end %>
      </ul>
    <% end %>

    <% if @recent_posts.present? %>
      <h2>Recent Posts</h2>
      <ul>
        <% @recent_posts.each do |post| %>
          <li><%= link_to post.title, post_path(post) %></li>
        <% end %>
      </ul>
    <% end %>
  </nav>

  <%= render 'sidebar_content' %>

</div>

<div id="sidebar">
  <nav>
    <% if @recent_posts.present? %>
      <h2>Recent Posts</h2>
      <ul>
        <% @recent_posts.each do |post| %>
          <li><%= link_to post.title, post_path(post) %></li>
        <% end %>
      </ul>
    <% end %>

    <h2>Archive</h2>
    <ul>
      <% @posts_by_month.each do |month, posts| %>
        <li><%= link_to month.strftime('%B %Y'), blog_posts_archives_path(month.year, month.month) %></li>
      <% end %>
    </ul>

    <% if @tags.present? %>
      <h2>Category</h2>
      <ul>
        <% @tags.each do |tag| %>
          <li><%= link_to tag.name, tagged_blog_posts_path(tag.name) %></li>
        <% end %>
      </ul>
    <% end %>
  </nav>

  <%= render 'sidebar_content' %>

</div>

Reorder sidebar sections into something more logical.
Reorder sidebar sections into something more logical.
