Skip to content

Commit cec6f18

Browse files
Chaitanya-Shaharevgvassilev
authored andcommitted
Add tags to posts
- add tags to blog landing page - add tags to each post footer - each tag link to the tags page to the part where that tag is
1 parent 373a1fb commit cec6f18

File tree

5 files changed

+108
-8
lines changed

5 files changed

+108
-8
lines changed

_layouts/blog.html

+14-4
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ <h3>{{ post.title }}</h3>
1212
<p>
1313
{% assign author = site.data.contributors | where: "name", post.author | first %}
1414
{% if author %}
15-
<a href="{{ author.name | replace: " ", "" | prepend: " /team/" }}">
15+
<a href="{{ author.name | replace: " ", "" | prepend: "/team/" }}">
1616
<img
1717
src="{% if author.photo %}{{ site.baseurl }}/images/team/{{ author.photo }}{% else %}{{ site.baseurl }}/images/team/defaultDP.png{% endif %}"
1818
alt="{{ author.name }}" style="
1919
width: 30px;
2020
height: 30px;
2121
border-radius: 50%;
2222
/* vertical-align: middle; */
23-
margin: 0;
24-
margin-top: 4px;
25-
margin-bottom: 4px;
23+
margin: 0;
24+
margin-top: 4px;
25+
margin-bottom: 4px;
2626
" />
2727
{{ author.name }}
2828
</a>
@@ -34,6 +34,16 @@ <h3>{{ post.title }}</h3>
3434
</span>
3535
</p>
3636
<p>{{ post.excerpt | truncatewords: 50 }}</p>
37+
38+
39+
{% if post.tags and post.tags.size > 0 %}
40+
<p>
41+
{% for tag in post.tags %}
42+
<a href="{{ site.baseurl }}/tags#{{ tag | downcase | slugify }}" class="badge" style="background-color: #999999; padding: 0.5rem">{{ tag }}</a>
43+
{% endfor %}
44+
</p>
45+
{% endif %}
46+
3747
<p>
3848
<button class="btn btn-primary" onclick="window.location.href='{{ post.url }}'">Read More</button>
3949
</p>

_layouts/post.html

+17
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,21 @@ <h1 class="post-title" itemprop="name headline">{{ page.title }}</h1>
3333
</header>
3434

3535
<div class="post-content" itemprop="articleBody">{{ content }}</div>
36+
37+
{% if page.tags and page.tags.size > 0 %}
38+
<hr />
39+
<footer class="post-footer">
40+
<p>
41+
<h4>Tags:</h4>
42+
{% for tag in page.tags %}
43+
<a
44+
href="{{ site.baseurl }}/tag#{{ tag | downcase | slugify }}"
45+
class="badge badge-secondary"
46+
style="background-color: #999999; padding: 0.5rem"
47+
>{{ tag }}</a
48+
>
49+
{% endfor %}
50+
</p>
51+
</footer>
52+
{% endif %}
3653
</article>

_layouts/tags.html

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
layout: default
3+
title: Tags
4+
---
5+
6+
<h2>Tags</h2>
7+
8+
<div>
9+
{% for tag in site.tags %} {% assign t = tag | first %} {% assign posts = tag
10+
| last %}
11+
12+
<h3 id={{t | downcase}}>
13+
{{ t | downcase }}
14+
</h3>
15+
<div>
16+
{% for post in posts %} {% if post.tags contains t %}
17+
<div class="well">
18+
<h3>{{ post.title }}</h3>
19+
<p>
20+
{% assign author = site.data.contributors | where: "name", post.author | first %}
21+
{% if author %}
22+
<a href="{{ author.name | replace: " ", "" | prepend: " /team/" }}">
23+
<img
24+
src="{% if author.photo %}{{ site.baseurl }}/images/team/{{ author.photo }}{% else %}{{ site.baseurl }}/images/team/defaultDP.png{% endif %}"
25+
alt="{{ author.name }}" style="
26+
width: 30px;
27+
height: 30px;
28+
border-radius: 50%;
29+
/* vertical-align: middle; */
30+
margin: 0;
31+
margin-top: 4px;
32+
margin-bottom: 4px;
33+
" />
34+
{{ author.name }}
35+
</a>
36+
{% else %}
37+
{{ post.author }}
38+
{% endif %}
39+
<span class="text-muted">
40+
• {{ post.date | date: "%b %d, %Y" }} • {{ post.content | number_of_words | divided_by: 200 | ceil }} min read
41+
</span>
42+
</p>
43+
<p>{{ post.excerpt | truncatewords: 50 }}</p>
44+
45+
{% if post.tags and post.tags.size > 0 %}
46+
<p>
47+
{% for tag in post.tags %}
48+
<a href="{{ site.baseurl }}/tags#{{ tag | downcase | slugify }}" class="badge" style="background-color: #999999; padding: 0.5rem">{{ tag }}</a>
49+
{% endfor %}
50+
</p>
51+
{% endif %}
52+
53+
54+
<p>
55+
<button class="btn btn-primary" onclick="window.location.href='{{ post.url }}'">Read More</button>
56+
</p>
57+
</div>
58+
{% endif %} {% endfor %}
59+
</div>
60+
{% endfor %}
61+
</div>

_pages/tags.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: "Tags"
3+
layout: tags
4+
excerpt: "Tags"
5+
sitemap: false
6+
permalink: /tags/
7+
---
8+
9+
<div id="textid" class="col-sm-12">
10+
{{ content }}
11+
</div>

_posts/2024-05-11-llvm-org-website-redesign-project.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ sitemap: false
99
author: Chaitanya Shahare
1010
permalink: blogs/gsoc24_chaitanya_shahare_introduction_blog/
1111
date: 2024-05-11
12+
tags: gsoc llvm website
1213
---
1314

1415
### Introduction
1516

1617
I’m Chaitanya Shahare, a passionate full-stack web developer and a pre-final-year
1718
Mechanical Engineering student at the National Institute of Technology
18-
Srinagar, India. This summer, I'm delighted to embark on an exciting journey with LLVM as
19+
Srinagar, India. This summer, I'm delighted to embark on an exciting journey with LLVM as
1920
Google Summer of Code 2024 contributor, where I'll be contributing to the LLVM project by
2021
improving the look and feel of its central hub, the LLVM.org website.
2122

@@ -64,7 +65,7 @@ breakdown of how I plan to achieve this:
6465
which is essential for a website like LLVM.org that is frequently updated
6566
with new information. This choice ensures that the website can be easily
6667
maintained and updated by the community, long after the project's
67-
completion also ensuring that this project is reusable for other sub-projects
68+
completion also ensuring that this project is reusable for other sub-projects
6869
websites in the LLVM ecosystem.
6970

7071
3. **Interactive Design Process**: Designing an engaging and user-friendly
@@ -93,13 +94,13 @@ breakdown of how I plan to achieve this:
9394

9495
Through detailed planning, collaborative design, and careful execution, this
9596
project aims to not only revamp the LLVM.org website but also enhance how the
96-
LLVM community interacts with it.
97+
LLVM community interacts with it.
9798

9899
### Conclusion
99100

100101
As we start this journey to improve the LLVM.org website, I am excited and
101102
ready for the challenges ahead. I'm confident we can create a website that
102-
everyone will find easy to use and helpful.
103+
everyone will find easy to use and helpful.
103104

104105
### Related Links
105106

0 commit comments

Comments
 (0)