Fixing up category page template
This commit is contained in:
		
							parent
							
								
									6cfa082ce7
								
							
						
					
					
						commit
						6bce3e3465
					
				
					 2 changed files with 53 additions and 93 deletions
				
			
		| 
						 | 
					@ -1,55 +0,0 @@
 | 
				
			||||||
---
 | 
					 | 
				
			||||||
layout: default
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% assign post = page %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<article class="post">
 | 
					 | 
				
			||||||
  <h1>{{page.title}}</h1>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <p class='info'>      
 | 
					 | 
				
			||||||
    {% if post.category %}
 | 
					 | 
				
			||||||
      {% for site_category in site.data.categories %}
 | 
					 | 
				
			||||||
        {% if site_category.slug == post.category %}
 | 
					 | 
				
			||||||
          {% assign category = site_category %}
 | 
					 | 
				
			||||||
        {% endif %}
 | 
					 | 
				
			||||||
      {% endfor %}
 | 
					 | 
				
			||||||
      {% if category %}
 | 
					 | 
				
			||||||
        {% capture category_content %} in <a href="/meta/category/{{ category.slug }}/">{{ category.name }}</a>{% endcapture %}
 | 
					 | 
				
			||||||
      {% endif %}
 | 
					 | 
				
			||||||
    {% else %}
 | 
					 | 
				
			||||||
      {% assign category_content = '' %}
 | 
					 | 
				
			||||||
    {% endif %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    {% if post.tags.size > 0 %}
 | 
					 | 
				
			||||||
      {% capture tags_content %} with tags {% endcapture %}
 | 
					 | 
				
			||||||
      {% for post_tag in post.tags %}
 | 
					 | 
				
			||||||
          {% for data_tag in site.data.tags %}
 | 
					 | 
				
			||||||
            {% if data_tag.slug == post_tag %}
 | 
					 | 
				
			||||||
              {% assign tag = data_tag %}
 | 
					 | 
				
			||||||
            {% endif %}
 | 
					 | 
				
			||||||
          {% endfor %}
 | 
					 | 
				
			||||||
          {% if tag %}
 | 
					 | 
				
			||||||
            {% capture tags_content_temp %}{{ tags_content }}<a href="/meta/tag/{{ tag.slug }}/">{{ tag.name }}</a>{% if forloop.last == false %}, {% endif %}{% endcapture %}
 | 
					 | 
				
			||||||
            {% assign tags_content = tags_content_temp %}
 | 
					 | 
				
			||||||
          {% endif %}
 | 
					 | 
				
			||||||
      {% endfor %}
 | 
					 | 
				
			||||||
    {% else %}
 | 
					 | 
				
			||||||
      {% assign tags_content = '' %}
 | 
					 | 
				
			||||||
    {% endif %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <span>{{page.date | date: "%B %d, %Y" }}</span>
 | 
					 | 
				
			||||||
    /
 | 
					 | 
				
			||||||
    <span>by {{page.author}}</span>    
 | 
					 | 
				
			||||||
    <br/>
 | 
					 | 
				
			||||||
    <span>Posted {{ category_content }}{{ tags_content }}</span>
 | 
					 | 
				
			||||||
  </p>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <hr/>
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  <div class="entry">
 | 
					 | 
				
			||||||
    {{ content }}
 | 
					 | 
				
			||||||
  </div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  {% include disqus.html %}
 | 
					 | 
				
			||||||
</article>
 | 
					 | 
				
			||||||
| 
						 | 
					@ -2,43 +2,58 @@
 | 
				
			||||||
layout: default
 | 
					layout: default
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<article class="page">
 | 
					<!-- Post Header -->
 | 
				
			||||||
    <h1>{{page.title}}</h1>
 | 
					<header class="intro-header" style="background-image: url('{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}')">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <p class='info'>
 | 
					    <div class="container">
 | 
				
			||||||
        <span>Articles by category</span>
 | 
					        <div class="row">
 | 
				
			||||||
    </p>
 | 
					            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
 | 
				
			||||||
 | 
					                <div class="post-heading">
 | 
				
			||||||
    <hr/>
 | 
					                    <h1>{{ page.title }}</h1>
 | 
				
			||||||
  
 | 
					                    <h2 class="subheading">Articles posted in {{ page.title }}</h2>
 | 
				
			||||||
    <div id="post-content">
 | 
					                </div>
 | 
				
			||||||
        {% if site.categories[page.category] %}
 | 
					            </div>
 | 
				
			||||||
            {% for post in site.categories[page.category] %}
 | 
					        </div>
 | 
				
			||||||
                {% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
 | 
					 | 
				
			||||||
                {% if forloop.first %}
 | 
					 | 
				
			||||||
                    <h3>{{ post_year }}</h3><ul>
 | 
					 | 
				
			||||||
                {% endif %}
 | 
					 | 
				
			||||||
          
 | 
					 | 
				
			||||||
                {% if forloop.first == false %}
 | 
					 | 
				
			||||||
                    {% assign previous_index = forloop.index0 | minus: 1 %}
 | 
					 | 
				
			||||||
                    {% capture previous_post_year %}{{ site.categories[page.category][previous_index].date | date: '%Y' }}{% endcapture %}
 | 
					 | 
				
			||||||
                    {% if post_year != previous_post_year %}
 | 
					 | 
				
			||||||
                        </div><h3>{{ post_year }}</h3><ul>
 | 
					 | 
				
			||||||
                    {% endif %}
 | 
					 | 
				
			||||||
                {% endif %}
 | 
					 | 
				
			||||||
          
 | 
					 | 
				
			||||||
                <li>
 | 
					 | 
				
			||||||
                    <a href="{{ post.url }}/" class="read-more">
 | 
					 | 
				
			||||||
                        {{ post.title }}
 | 
					 | 
				
			||||||
                    </a>
 | 
					 | 
				
			||||||
                </li>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                {% if forloop.last %}
 | 
					 | 
				
			||||||
                    </ul>
 | 
					 | 
				
			||||||
                {% endif %}
 | 
					 | 
				
			||||||
            {% endfor %}
 | 
					 | 
				
			||||||
        {% else %}
 | 
					 | 
				
			||||||
            <p>There are no posts in this category.</p>
 | 
					 | 
				
			||||||
        {% endif %}
 | 
					 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</article>
 | 
					</header>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<article class="page">
 | 
				
			||||||
 | 
					    <div class="container">
 | 
				
			||||||
 | 
					        <div class="row">
 | 
				
			||||||
 | 
					            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                {% if site.categories[page.category] %}
 | 
				
			||||||
 | 
					                    {% for post in site.categories[page.category] %}
 | 
				
			||||||
 | 
					                        {% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
 | 
				
			||||||
 | 
					                        {% if forloop.first %}
 | 
				
			||||||
 | 
					                            <h3>{{ post_year }}</h3><ul>
 | 
				
			||||||
 | 
					                        {% endif %}
 | 
				
			||||||
 | 
					                  
 | 
				
			||||||
 | 
					                        {% if forloop.first == false %}
 | 
				
			||||||
 | 
					                            {% assign previous_index = forloop.index0 | minus: 1 %}
 | 
				
			||||||
 | 
					                            {% capture previous_post_year %}{{ site.categories[page.category][previous_index].date | date: '%Y' }}{% endcapture %}
 | 
				
			||||||
 | 
					                            {% if post_year != previous_post_year %}
 | 
				
			||||||
 | 
					                                </div><h3>{{ post_year }}</h3><ul>
 | 
				
			||||||
 | 
					                            {% endif %}
 | 
				
			||||||
 | 
					                        {% endif %}
 | 
				
			||||||
 | 
					                  
 | 
				
			||||||
 | 
					                        <li>
 | 
				
			||||||
 | 
					                            <a href="{{ post.url }}/" class="read-more">
 | 
				
			||||||
 | 
					                                {{ post.title }}
 | 
				
			||||||
 | 
					                            </a>
 | 
				
			||||||
 | 
					                        </li>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        {% if forloop.last %}
 | 
				
			||||||
 | 
					                            </ul>
 | 
				
			||||||
 | 
					                        {% endif %}
 | 
				
			||||||
 | 
					                    {% endfor %}
 | 
				
			||||||
 | 
					                {% else %}
 | 
				
			||||||
 | 
					                    <p>There are no posts in this category.</p>
 | 
				
			||||||
 | 
					                {% endif %}
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					           </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</article>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<hr>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue