Skip to content

Commit d0310c7

Browse files
Created event.html - a loop adding latest 4 post in reverse chronological order to the recent event section.
Created 4 recent events to test. Removed dummy posts. Removed complete recent events section from index.html and used include event.html instead.
1 parent f144230 commit d0310c7

File tree

8 files changed

+83
-140
lines changed

8 files changed

+83
-140
lines changed

_includes/event.html

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
1-
{% for post in site.posts %}
2-
<time>{{ post.date | date: "%b %-d, %Y" }}</time>
3-
<h3><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
4-
{% endfor %}
5-
{% for cupcake in site.cupcakes reversed limit: 3 offset: 3 %}
1+
<section class="events">
2+
<div class="container-fluid">
3+
<div class="row">
4+
<div class="col-md-12">
5+
<h2 class="section-title">Recent Events</h2>
6+
</div>
7+
</div>
68

7-
{% assign my_array = "" | split: ',' %}
8-
Now you can push items into the array inside a for loop in the following way:
9+
{% comment %}
10+
Create an array of last 4 posts (from newest to oldest) to show in recent events section.
11+
{% endcomment %}
912

10-
{% for image in site.static_files %}
11-
{% if image.path contains "assets/images/target-folder" %}
12-
<!-- Push image into array -->
13-
{% assign my_array = my_array | push: image %}
14-
{% endif %}
15-
{% endfor %}
16-
{% for i in (1..5) %}
17-
<!--Create an array of last posts (from newest to oldest) to show in recent events section-->
13+
{% assign last_4_posts = "" | split: ',' %}
14+
{% for post in site.posts reversed limit: 4 %}
15+
{% assign last_4_posts = last_4_posts | push: post %}
16+
{% endfor %}
1817

19-
{% assign last_4_posts = "" | split: ',' %}
20-
{% for post in site.posts reversed limit: 4 %}
21-
{% assign last_4_posts = last_4_posts | push: post %}
22-
{% endfor %}
18+
{% comment %}
19+
Create a 2 row by 2 column structure for 4 recent posts.
20+
{% endcomment %}
2321

24-
{% for i in (0..1) %}
25-
<div class="row">
26-
{% for j in (0..1) %}
27-
<div class="no-gutters__col col-sm-6">
28-
<div class="events__spacer"></div>
29-
<div class="events__img-container">
30-
<div class="events__img-overlay">
31-
<a class="events__link" href="https://www.meetup.com/Python-Sprints/events/244388482/" target="_blank">
32-
<i class="events__icon fas fa-external-link-square-alt"></i>
33-
</a>
34-
<div class="events__title-container">
35-
<h2 class="events__img-title">Project: {{ post.title}}</h2>
36-
<p class="events__img-subtitle">{{ post.venue }}, {{post.date}}</p>
37-
</div>
22+
{% for row in (0..1) %}
23+
<div class="row">
24+
{% for col in (0..1) %}
25+
{% assign post_index = row | times: 2 | plus: col %}
26+
{% assign post = last_4_posts[post_index] %}
27+
<div class="no-gutters__col col-sm-6">
28+
<div class="events__spacer"></div>
29+
<div class="events__img-container">
30+
<div class="events__img-overlay">
31+
<a class="events__link" href="{{ post.link }}" target="_blank">
32+
<i class="events__icon fas fa-external-link-square-alt"></i>
33+
</a>
34+
<div class="events__title-container">
35+
<h2 class="events__img-title">Project: {{ post.title }}</h2>
36+
<p class="events__img-subtitle">{{ post.venue }}, {{ post.date | date: "%e %B %Y" }}</p>
37+
</div>
38+
</div>
39+
<img class="events__img img-fluid" src="{{ site.baseurl }}/{{ post.image }}">
40+
</div>
41+
</div>
42+
{% endfor %}
3843
</div>
39-
<img class="events__img img-fluid" src="static/images/events_past/python_dot_org_part1_bloomberg_960x539px.jpeg">
40-
</div>
44+
{% endfor %}
4145
</div>
42-
43-
</div>
46+
</section>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: default
3+
title: Bokeh as a backend for Pandas
4+
date: 2017-10-04
5+
venue: Harvey Nash
6+
link: https://www.meetup.com/Python-Sprints/events/243422372/
7+
image: static/images/events_past/pandas_bokeh_backend_harvey_nash_960x539px.jpeg
8+
---
9+
10+
We worked on implementing Bokeh as a backend for Pandas.

_posts/2017-10-24-PyMC3.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: default
3+
title: PyMC3
4+
date: 2017-10-24
5+
venue: Zopa
6+
link: https://www.meetup.com/Python-Sprints/events/244062594/
7+
image: static/images/events_past/pymc3_zopa_960x539px.jpeg
8+
---
9+
10+
We worked on PyMC3 project.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: default
3+
title: www.python.org (Part 1)
4+
date: 2017-11-01
5+
venue: Bloomberg
6+
link: https://www.meetup.com/Python-Sprints/events/244388482/
7+
image: static/images/events_past/python_dot_org_part1_bloomberg_960x539px.jpeg
8+
---
9+
10+
We worked on python.org website.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: default
3+
title: python-dateutil
4+
date: 2017-12-06
5+
venue: Bloomberg
6+
link: https://www.meetup.com/Python-Sprints/events/245317647/
7+
image: static/images/events_past/dateutil_bloomberg_960x539px.jpeg
8+
---
9+
10+
We worked on documentation for python-dateutil.

_posts/2018-02-10-test-post.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

_posts/2018-02-11-test-post-2.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

index.html

Lines changed: 3 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ <h2 class="navigation__subtitle"><em>The World Is Waiting For Your Code</em></h2
3131
</div>
3232
</div>
3333
</div>
34+
3435
<!--Mission section-->
3536
<section class="mission">
3637
<div class="mission container-fluid">
@@ -44,89 +45,10 @@ <h2 class="section-title">Our Mission</h2>
4445
</div>
4546
</div>
4647
</section>
47-
<!--Events in the past section-->
48-
<section class="events">
49-
<div class="container-fluid">
50-
<div class="row">
51-
<div class="col-md-12">
52-
<h4>blog</h4>
53-
{% for post in site.posts %}
54-
<time>{{ post.date | date: "%b %-d, %Y" }}</time>
55-
<h3><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
56-
{% endfor %}
57-
<h2 class="section-title">Recent Events</h2>
58-
</div>
59-
</div>
60-
61-
<div class="row">
62-
<div class="no-gutters__col col-sm-6">
63-
<div class="events__spacer"></div>
64-
<div class="events__img-container">
65-
<div class="events__img-overlay">
66-
<a class="events__link" href="https://www.meetup.com/Python-Sprints/events/244388482/" target="_blank">
67-
<i class="events__icon fas fa-external-link-square-alt"></i>
68-
</a>
69-
<div class="events__title-container">
70-
<h2 class="events__img-title">Project: www.python.org (Part 1)</h2>
71-
<p class="events__img-subtitle">Bloomberg, November 1, 2017</p>
72-
</div>
73-
</div>
74-
<img class="events__img img-fluid" src="static/images/events_past/python_dot_org_part1_bloomberg_960x539px.jpeg">
75-
</div>
76-
</div>
7748

78-
<div class="no-gutters__col col-sm-6">
79-
<div class="events__spacer"></div>
80-
<div class="events__img-container">
81-
<div class="events__img-overlay">
82-
<a class="events__link" href="https://www.meetup.com/Python-Sprints/events/244062594/" target="_blank">
83-
<i class="events__icon fas fa-external-link-square-alt"></i>
84-
</a>
85-
<div class="events__title-container">
86-
<h2 class="events__img-title">Project: PyMC3</h2>
87-
<p class="events__img-subtitle">Zopa, October 24, 2017</p>
88-
</div>
89-
</div>
90-
<img class="events__img img-fluid" src="static/images/events_past/pymc3_zopa_960x539px.jpeg">
91-
</div>
92-
</div>
93-
</div>
94-
95-
<div class="row mt-0">
96-
<div class="no-gutters__col col-sm-6">
97-
<div class="events__spacer"></div>
98-
<div class="events__img-container">
99-
<div class="events__img-overlay">
100-
<a class="events__link" href="https://www.meetup.com/Python-Sprints/events/243422372/" target="_blank">
101-
<i class="events__icon fas fa-external-link-square-alt"></i>
102-
</a>
103-
<div class="events__title-container">
104-
<h2 class="events__img-title">Project: Bokeh as a backend for Pandas</h2>
105-
<p class="events__img-subtitle">Harvey Nash, October 4, 2017</p>
106-
</div>
107-
</div>
108-
<img class="events__img img-fluid" src="static/images/events_past/pandas_bokeh_backend_harvey_nash_960x539px.jpeg">
109-
</div>
110-
</div>
49+
<!--Events in the past section-->
50+
{% include event.html %}
11151

112-
<div class="no-gutters__col col-sm-6">
113-
<div class="events__spacer"></div>
114-
<div class="events__img-container">
115-
<div class="events__img-overlay">
116-
<a class="events__link" href="https://www.meetup.com/Python-Sprints/events/245317647/" target="_blank">
117-
<i class="events__icon fas fa-external-link-square-alt"></i>
118-
</a>
119-
<div class="events__title-container">
120-
<h2 class="events__img-title">Project: python-dateutil</h2>
121-
<p class="events__img-subtitle">Bloomberg, December 6, 2017</p>
122-
</div>
123-
</div>
124-
<img class="events__img img-fluid" src="static/images/events_past/dateutil_bloomberg_960x539px.jpeg">
125-
</div>
126-
</div>
127-
</div>
128-
</div>
129-
</section>
13052
<!--Services section-->
13153
<section class="services">
13254
<div class="container-fluid">

0 commit comments

Comments
 (0)