Skip to content

Commit b8cb3e4

Browse files
authored
Merge pull request #18 from MaP-science/addingNews
Making the news on the homepage clickable
2 parents 4332623 + 81c750c commit b8cb3e4

File tree

4 files changed

+62
-44
lines changed

4 files changed

+62
-44
lines changed

_layouts/homelay.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,18 @@
66
{{ content }}
77
</div>
88
<div id="newsid" class="col-sm-4" >
9-
{% include news.html%}
9+
<h2>News</h2>
10+
<hr style="border-top: 3px solid #e1e3e3;"> <!-- Add a faint horizontal line here -->
11+
<ul class="list-unstyled">
12+
{% for article in site.data.news %}
13+
{% assign anchor_id = article.date | replace: '/', '-' | append: '-' | append: article.headline | slugify %}
14+
<li>
15+
<a href="/news.html#{{ anchor_id }}" style="color: inherit; text-decoration: none;">
16+
<strong>{{ article.date }}</strong><br>
17+
{{ article.headline }}
18+
</a>
19+
<hr>
20+
</li>
21+
{% endfor %}
22+
</ul>
1023
</div>

_pages/allnews.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "News"
3+
layout: textlay
4+
excerpt: "Microstructure and Plasticity"
5+
sitemap: false
6+
permalink: /allnews.html
7+
---
8+
9+
# News
10+
---
11+
12+
<ul class="list-unstyled">
13+
{% for article in site.data.news %}
14+
{% assign anchor_id = article.date | replace: '/', '-' | append: '-' | append: article.headline | slugify %}
15+
<li>
16+
<a href="/news.html#{{ anchor_id }}" style="text-decoration: none; color: inherit;">
17+
<strong>{{ article.date }}</strong><br>
18+
{{ article.headline }}
19+
</a>
20+
<hr>
21+
</li>
22+
{% endfor %}
23+
</ul>

_pages/allnews.md

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

_pages/news.html

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,31 @@
55
sitemap: false
66
permalink: /news.html
77
---
8-
<h1>{{page.title}}</h1>
98

10-
<hr style="border-top: 3px solid #e1e3e3;"> <!-- Add a faint horizontal line here -->
9+
<h1>{{ page.title }}</h1>
10+
<hr style="border-top: 3px solid #e1e3e3;">
1111

12-
<ul class="list-unstyled">
13-
{% for article in site.data.news %}
14-
<li class="media">
15-
<div class="media-body">
16-
<h3 class="mt-0 mb-1">
17-
{% assign logo_lowercase = article.logo | downcase %}
18-
{% if logo_lowercase contains 'dtu' %}
19-
<img src="{{ site.url }}{{ site.baseurl }}/images/logo/{{ logo_lowercase }}_logo.png" style="width: 100px; height: 50px; margin-right: 10px;">
20-
{% else %}
21-
<img src="{{ site.url }}{{ site.baseurl }}/images/logo/{{ logo_lowercase }}_logo.png" style="width: 130px; height: 40px; margin-right: 10px;">
22-
{% endif %}
23-
{{ article.title }}
24-
</h3>
25-
<p><small>{{ article.date }}</small></p>
26-
{{ article.content }}
27-
</div>
28-
</li>
29-
<hr style="border-top: 1px solid #f2f2f2;"> <!-- Add a faint horizontal line here -->
30-
{% endfor %}
12+
<div class="news-items">
13+
{% for article in site.data.news %}
14+
{% assign anchor_id = article.date | replace: '/', '-' | append: '-' | append: article.headline | slugify %}
15+
<section id="{{ anchor_id }}">
16+
<div class="media">
17+
<div class="media-body">
18+
<h3 class="mt-0 mb-1">
19+
{% assign logo_lowercase = article.logo | downcase %}
20+
{% if logo_lowercase %}
21+
<img src="{{ site.url }}{{ site.baseurl }}/images/logo/{{ logo_lowercase }}_logo.png"
22+
alt="{{ article.logo }} logo"
23+
style="width: 130px; height: 40px; margin-right: 10px;">
24+
{% endif %}
25+
{{ article.title }}
26+
</h3>
27+
<p><small>{{ article.date }}</small></p>
28+
{{ article.content }}
29+
</div>
30+
</div>
31+
<hr style="border-top: 1px solid #f2f2f2;">
32+
</section>
3133
<br>
32-
</ul>
33-
34-
<br>
34+
{% endfor %}
35+
</div>

0 commit comments

Comments
 (0)