forked from kitian616/jekyll-TeXt-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharticle-list.html
94 lines (84 loc) · 3.87 KB
/
article-list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{%- assign _excerpt_truncate = include.excerpt_truncate | default: 350 -%}
{%- assign _excerpt_type = include.excerpt_type | default: site.data.variables.default.excerpt_type -%}
{%- assign _sorted_list = include.articles -%}
{%- if include.group_by == 'year' -%}
{%- assign _sorted_list = _sorted_list | sort: 'date' -%}
{%- endif -%}
{%- if include.reverse -%}
{%- assign _sorted_list = _sorted_list | reverse -%}
{%- endif -%}
{%- if include.type == 'common' -%}
<div class="items items--divided">
{%- elsif include.type == 'brief' -%}
<div class="items">
{%- endif -%}
{%- for _article in _sorted_list -%}
{%- include snippets/prepend-baseurl.html path=_article.url -%}
{%- assign _article_url = __return -%}
{%- include snippets/locale-to-string.html locale=site.data.locale.READMORE -%}
{%- assign _locale_readmore = __return -%}
{%- if include.type == 'common' -%}
{%- if include.article_type == 'BlogPosting' -%}
<article class="item" itemscope itemtype="http://schema.org/BlogPosting">
{%- else -%}
<article class="item">
{%- endif -%}
{%- if _article.cover and include.show_cover-%}
{%- include snippets/get-nav-url.html path=_article.cover -%}
{%- assign _article_cover = __return -%}
<div class="item__image">
{%- if include.cover_size == 'lg' -%}
<img class="image image--lg" src="{{ _article_cover }}" />
{%- elsif include.cover_size == 'sm' -%}
<img class="image image--sm" src="{{ _article_cover }}" />
{%- else -%}
<img class="image" src="{{ _article_cover }}" />
{%- endif -%}
</div>
{%- endif -%}
<div class="item__content">
<header><h2 itemprop="headline" class="item__header"><a href="{{ _article_url }}">{{ _article.title }}</a></h2></header>
<div class="item__description">
{%- if _article.excerpt and include.show_excerpt -%}
<div class="article__content" itemprop="description articleBody">
{%- if _excerpt_type == 'html' -%}
{{ _article.excerpt }}
{%- else -%}
{{ _article.excerpt | strip_html | truncate: _excerpt_truncate }}
{%- endif -%}
</div>
{%- endif -%}
{%- if include.show_readmore -%}
<p><a href="{{ _article_url }}">{{ _locale_readmore }}</a></p>
{%- endif -%}
</div>
{%- if include.show_info -%}
{%- include article-info.html article=_article show_pageview=true -%}
{%- endif -%}
</div>
</article>
{%- elsif include.type == 'brief' -%}
{%- assign _tags = '' -%}
{%- for _tag in _article.tags -%}
{%- assign _tag_encode = _tag | strip | url_encode } -%}
{%- if forloop.last -%}
{%- assign _tags = _tags | append: _tag_encode -%}
{%- else -%}
{%- assign _tags = _tags | append: _tag_encode | append: ',' -%}
{%- endif -%}
{%- endfor -%}
{%- if include.group_by == 'year' -%}
{%- assign _currentdate = _article.date | date: '%Y' -%}
{%- if _currentdate != _date -%}
{%- unless forloop.first -%}</ul></section>{%- endunless -%}
<section><h2 class="article-list__group-header">{{ _currentdate }}</h2><ul>
{%- assign _date = _currentdate -%}
{%- endif -%}
{%- endif -%}
{%- include snippets/locale-to-string.html locale=site.data.locale.ARTICLE_LIST_DATE_FORMAT -%}
<li class="item" itemscope itemtype="http://schema.org/BlogPosting" data-tags="{{ _tags }}">
<div class="item__content"><span class="item__meta">{{ _article.date | date: __return }}</span><a itemprop="headline" class="item__header" href="{{ _article_url }}">{{ _article.title }}</a></div>
</li>
{%- endif -%}
{%- endfor -%}
</div>