summaryrefslogtreecommitdiff
path: root/_layouts/articles.html
blob: 00738a1044649c3b674336688a8ebcd99bc1a8f5 (plain)
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
---
layout: page
---

{%- assign _page_articles_data_source = page.articles.data_source | default: layout.articles.data_source -%}

{%- if _page_articles_data_source -%}
{%- assign _keys = _page_articles_data_source | split: '.' -%}
{%- endif -%}

{%- assign _articles = nil -%}
{%- for _key in _keys -%}
  {%- if forloop.first -%}
    {%- case _key -%}
      {%- when 'site' -%}
        {%- assign _articles = site -%}
      {%- when 'page' -%}
        {%- assign _articles = page -%}
      {%- when 'layout' -%}
        {%- assign _articles = layout -%}
      {%- when 'paginator' -%}
        {%- assign _articles = paginator -%}
      {%- else -%}
        {%- assign _articles = site[_key] -%}
      {%- else -%}
    {%- endcase -%}
  {%- else -%}
    {%- assign _articles = _articles[_key] -%}
  {%- endif -%}
{%- endfor -%}

{%- assign _type = page.articles.type | default: layout.articles.type -%}

{%- if _articles -%}

  <div class="layout--articles">

    {%- if _type == 'grid' -%}
      {%- if page.articles.size == 'sm' -%}
        {%- include article-list.html articles=_articles type='grid' size='sm' -%}
      {%- else -%}
        {%- include article-list.html articles=_articles type='grid' -%}
      {%- endif -%}

    {%- elsif _type == 'brief' -%}
      {%- include snippets/assign.html
        target=site.data.variables.default.page.articles.show_info
        source0=layout.articles.show_info source1=page.articles.show_info -%}
      {%- assign _show_info = __return -%}

      {%- include article-list.html articles=_articles type='brief' show_info=_show_info -%}

    {%- else -%}
      {%- include snippets/assign.html
        target=site.data.variables.default.page.articles.show_cover
        source0=layout.articles.show_cover source1=page.articles.show_cover -%}
      {%- assign _show_cover = __return -%}

      {%- include snippets/assign.html
        target=site.data.variables.default.page.articles.show_excerpt
        source0=layout.articles.show_excerpt source1=page.articles.show_excerpt -%}
      {%- assign _show_excerpt = __return -%}

      {%- include snippets/assign.html
        target=site.data.variables.default.page.articles.show_readmore
        source0=layout.articles.show_readmore source1=page.articles.show_readmore -%}
      {%- assign _show_readmore = __return -%}

      {%- include snippets/assign.html
        target=site.data.variables.default.page.articles.show_info
        source0=layout.articles.show_info source1=page.articles.show_info -%}
      {%- assign _show_info = __return -%}

      {%- assign _article_type = page.articles.article_type | default: layout.articles.article_type -%}
      {%- assign _cover_size = page.articles.cover_size | default: layout.articles.cover_size -%}
      {%- assign _excerpt_type = page.articles.excerpt_type | default: layout.articles.excerpt_type -%}

      {%- include article-list.html articles=_articles type='item'
        article_type=_article_type
        show_cover=_show_cover cover_size=_cover_size
        show_excerpt=_show_excerpt excerpt_type=_excerpt_type
        show_readmore=_show_readmore show_info=_show_info -%}

    {%- endif -%}

  </div>
{%- endif -%}

{{ content }}