@@ -9,47 +9,19 @@ <h2 class="footer__section-title">Find Us Online</h2>
99 < div class ="col-md-6 ">
1010 < h2 class ="footer__section-title "> Our Sponsors</ h2 >
1111 < hr class ="footer__divider ">
12- {% comment %}
13- Assume number of sponsors is even. We are going to create rows of 2 sponsors in each.
14- If not even the last row must contain 1 sponsor and be terminated with appropriate tags.
15- {% endcomment %}
16-
12+ <!--Create an array of permanent sponsors-->
1713 {% assign sponsors = "" | split: ',' %}
1814 {% for sponsor in site.sponsors %}
1915 {% if sponsor.permanent %}
2016 {% assign sponsors = sponsors | push: sponsor %}
2117 {% endif %}
2218 {% endfor %}
23- {% assign num_of_sponsors = sponsors | size %}
24- {% assign sponsors_remainder = num_of_sponsors | modulo: 2 %}
25-
26- {% if sponsors_remainder == 0 %}
27- {% assign num_of_sponsors_even = true %}
28- {% assign row_num_modifier = 1 %}
29- {% else %}
30- {% assign num_of_sponsors_even = false %}
31- {% assign row_num_modifier = 0 %}
32- {% endif %}
33-
34- {% assign num_of_rows = num_of_sponsors | divided_by: 2 | floor | minus: row_num_modifier %}
35- {% assign items_per_row = 1 %}
3619
37- {% for row in (0..num_of_rows) %}
38- {% if forloop.last and num_of_sponsors_even == false %}
39- {% assign items_per_row = 0 %}
40- {% endif %}
41- < div class ="row ">
42- {% for col in (0..items_per_row) %}
43- {% assign sponsor_index = row | times: 2 | plus: col %}
44- {% assign sponsor = sponsors[sponsor_index] %}
45- < div class ="footer__sponsor-col col-md-12 col-lg-6 ">
46- < a class ="footer__sponsor-link " href ="{{ sponsor.sponsor_link }} ">
47- < img class ="footer__img " src ="{{ site.baseurl }}/{{ sponsor.sponsor_logo }} ">
48- </ a >
49- </ div >
50- {% endfor %}
51- </ div >
52- {% endfor %}
20+ {%
21+ include row_display_outer_loop.html
22+ items_array = sponsors
23+ inner_layout = "footer_sponsors_inner_layout.html"
24+ %}
5325 </ div >
5426 < div class ="col-md-3 ">
5527 < h2 class ="footer__section-title "> Python Sprints</ h2 >
0 commit comments