Skip to content

Commit 8563c97

Browse files
Created automatic feed (liquid logic) for the Our Sponsors in the footer.
Need to modify style so that the logos do not overlap on smaller screens.
1 parent a1df245 commit 8563c97

File tree

1 file changed

+88
-17
lines changed

1 file changed

+88
-17
lines changed

_includes/footer.html

Lines changed: 88 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,96 @@ <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-
<div class="row">
13-
<div class="footer__sponsor-col col-lg-12 col-xlg-6">
14-
<a class="footer__sponsor-link" href="https://www.python.org/psf/">
15-
<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/python_software_foundation.png">
16-
</a>
17-
<a class="footer__sponsor-link" href="https://www.linkedin.com/in/hamishpitkeathly/">
18-
<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/harvey_nash.png">
19-
</a>
20-
</div>
21-
<div class="footer__sponsor-col col-lg-12 col-xlg-6">
22-
<a class="footer__sponsor-link" href="https://www.touchsurgery.com/jobs.html">
23-
<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/touch_surgery.png">
24-
</a>
25-
<a class="footer__sponsor-link" href="https://www.bloomberg.com/careers/">
26-
<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/bloomberg.png">
27-
</a>
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+
17+
{% assign num_of_sponsors_even = true %}
18+
{% assign sponsors = "" | split: ',' %}
19+
{% for sponsor in site.sponsors %}
20+
{% assign sponsors = sponsors | push: sponsor %}
21+
{% endfor %}
22+
{% assign num_of_sponsors = sponsors | size %}
23+
{% if num_of_sponsors | modulo: 2 > 0 %}
24+
{% assign num_of_sponsors_even = false %}
25+
{% endif %}
26+
{% assign num_of_rows = num_of_sponsors | divided_by: 2 | floor %}
27+
{% assign items_per_row = 1 %}
28+
29+
{% for row in (0..num_of_rows) %}
30+
{% if forloop.last == true and num_of_sponsors_even == false %}
31+
{% assign items_per_row = 0 %}
32+
{% endif %}
33+
<div class="row">
34+
{% for col in (0..items_per_row) %}
35+
{% assign sponsor_index = row | times: 2 | plus: col %}
36+
{% assign sponsor = sponsors[sponsor_index] %}
37+
<div class="footer__sponsor-col col-md-12 col-lg-6">
38+
<a class="footer__sponsor-link" href="{{ sponsor.sponsor_link }}">
39+
<img class="footer__img" src="{{ site.baseurl }}/{{ sponsor.sponsor_logo }}">
40+
</a>
41+
</div>
42+
{% endfor %}
2843
</div>
29-
</div>
44+
{% endfor %}
45+
46+
<!--<div class="row">-->
47+
<!--<div class="footer__sponsor-col col-lg-12 col-xlg-6">-->
48+
<!--<a class="footer__sponsor-link" href="https://www.python.org/psf/">-->
49+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/python_software_foundation.png">-->
50+
<!--</a>-->
51+
<!--<a class="footer__sponsor-link" href="https://www.linkedin.com/in/hamishpitkeathly/">-->
52+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/harvey_nash.png">-->
53+
<!--</a>-->
54+
<!--</div>-->
55+
<!--<div class="footer__sponsor-col col-lg-12 col-xlg-6">-->
56+
<!--<a class="footer__sponsor-link" href="https://www.touchsurgery.com/jobs.html">-->
57+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/touch_surgery.png">-->
58+
<!--</a>-->
59+
<!--<a class="footer__sponsor-link" href="https://www.bloomberg.com/careers/">-->
60+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/bloomberg.png">-->
61+
<!--</a>-->
62+
<!--</div>-->
63+
<!--</div>-->
64+
65+
66+
67+
68+
69+
70+
71+
<!--<div class="row">-->
72+
<!--<div class="footer__sponsor-col col-lg-12 col-xlg-6">-->
73+
<!--<a class="footer__sponsor-link" href="https://www.python.org/psf/">-->
74+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/python_software_foundation.png">-->
75+
<!--</a>-->
76+
<!--<a class="footer__sponsor-link" href="https://www.linkedin.com/in/hamishpitkeathly/">-->
77+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/harvey_nash.png">-->
78+
<!--</a>-->
79+
<!--</div>-->
80+
<!--<div class="footer__sponsor-col col-lg-12 col-xlg-6">-->
81+
<!--<a class="footer__sponsor-link" href="https://www.touchsurgery.com/jobs.html">-->
82+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/touch_surgery.png">-->
83+
<!--</a>-->
84+
<!--<a class="footer__sponsor-link" href="https://www.bloomberg.com/careers/">-->
85+
<!--<img class="footer__img" src="{{ site.baseurl }}/static/images/sponsors/bloomberg.png">-->
86+
<!--</a>-->
87+
<!--</div>-->
88+
<!--</div>-->
3089
</div>
90+
91+
92+
93+
94+
95+
96+
97+
98+
99+
100+
101+
31102
<div class="col-md-3">
32103
<h2 class="footer__section-title">Python Sprints</h2>
33104
<hr class="footer__divider">

0 commit comments

Comments
 (0)