Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Aug 5, 2019
1 parent a44624f commit 4d97a16
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 52 deletions.
16 changes: 15 additions & 1 deletion layout/_macro/post-collapse.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{% macro render(post) %}
{% macro render(posts) %}
{%- for post in posts %}

{# Show year #}
{%- set year %}
{%- set post.year = date(post.date, 'YYYY') %}

{%- if post.year !== year %}
{%- set year = post.year %}
<div class="collection-title">
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="archive-year" id="archive-year-{{ year }}">{{ year }}</{%- if theme.seo %}h2{% else %}h1{%- endif %}>
</div>
{%- endif %}
{# endshow #}

<article class="post post-type-{{ post.type | default('normal') }}" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
Expand Down Expand Up @@ -30,4 +43,5 @@
</header>
</article>

{%- endfor %}
{% endmacro %}
18 changes: 1 addition & 17 deletions layout/archive.swig
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,7 @@
</span>
{%- endif %}

{%- for post in page.posts %}

{# Show year #}
{%- set year %}
{%- set post.year = date(post.date, 'YYYY') %}

{%- if post.year !== year %}
{%- set year = post.year %}
<div class="collection-title">
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="archive-year" id="archive-year-{{ year }}">{{ year }}</{%- if theme.seo %}h2{% else %}h1{%- endif %}>
</div>
{%- endif %}
{# endshow #}

{{ post_template.render(post) }}

{%- endfor %}
{{ post_template.render(page.posts) }}

</div>
</div>
Expand Down
18 changes: 1 addition & 17 deletions layout/category.swig
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,7 @@
</{%- if theme.seo %}h2{% else %}h1{%- endif %}>
</div>

{%- for post in page.posts %}

{# Show year #}
{%- set year %}
{%- set post.year = date(post.date, 'YYYY') %}

{%- if post.year !== year %}
{%- set year = post.year %}
<div class="collection-title">
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="archive-year" id="archive-year-{{ year }}">{{ year }}</{%- if theme.seo %}h2{% else %}h1{%- endif %}>
</div>
{%- endif %}
{# endshow #}

{{ post_template.render(post) }}

{%- endfor %}
{{ post_template.render(page.posts) }}
</div>

</div>
Expand Down
18 changes: 1 addition & 17 deletions layout/tag.swig
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,7 @@
</{%- if theme.seo %}h2{% else %}h1{%- endif %}>
</div>

{%- for post in page.posts %}

{# Show year #}
{%- set year %}
{%- set post.year = date(post.date, 'YYYY') %}

{%- if post.year !== year %}
{%- set year = post.year %}
<div class="collection-title">
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="archive-year" id="archive-year-{{ year }}">{{ year }}</{%- if theme.seo %}h2{% else %}h1{%- endif %}>
</div>
{%- endif %}
{# endshow #}

{{ post_template.render(post) }}

{%- endfor %}
{{ post_template.render(page.posts) }}
</div>

</div>
Expand Down

0 comments on commit 4d97a16

Please sign in to comment.