Skip to content

Commit 9d1e1c6

Browse files
MUmarShahbazM. Umar Shahbaz
andauthored
1 parent 0af4aec commit 9d1e1c6

File tree

5 files changed

+171
-2
lines changed

5 files changed

+171
-2
lines changed

_includes/head.liquid

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@
121121
>
122122
{% endif %}
123123

124+
<!-- GitHub Project Introduction Section -->
125+
{% if page.project_intro %}
126+
<link
127+
defer
128+
rel="stylesheet"
129+
href="{{ '/assets/css/project-intro.css' | relative_url | bust_file_cache }}"
130+
>
131+
{% endif %}
132+
124133
{% if page.images %}
125134
<!-- Image comparison slider -->
126135
{% if page.images.compare %}

_includes/project_intro.liquid

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<div class="Intro">
2+
{% if include.img %}
3+
<div class="Icon">
4+
{% include figure.liquid path=include.img max-height="300px" max-width="300px" width="auto" %}
5+
</div>
6+
{% endif %}
7+
8+
<div class="Info">
9+
<h1 class="Title">{{ include.title }}</h1>
10+
<div class="TechIconsBox">
11+
{% for icon in include.icons %}
12+
<img
13+
{% if icon.site %}
14+
{% if icon.site == 'devicons' %}
15+
src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/{{ icon.file }}"
16+
{% elsif icon.site == 'skillicons' %}
17+
src="https://skillicons.dev/icons?i={{ icon.file }}"
18+
{% endif %}
19+
{% else %}
20+
src="{% if icon.file contains "https://" %}{{ icon.file }}{% else %}{{ icon.file | relative_url }}{% endif %}"
21+
{% endif %}
22+
width="auto"
23+
height="40"
24+
>
25+
{% endfor %}
26+
</div>
27+
<p>{{ include.description }}</p>
28+
</div>
29+
</div>

_layouts/page.liquid

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,21 @@ layout: default
1010

1111
<div class="post">
1212
<header class="post-header">
13-
<h1 class="post-title">{{ page.title }}</h1>
14-
<p class="post-description">{{ page.description }}</p>
13+
{% if page.project_intro %}
14+
{% include project_intro.liquid img=page.img title=page.title icons=page.icons description=page.description %}
15+
<hr>
16+
{% if page.repository %}
17+
<div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
18+
{% for repo in page.repository %}
19+
{% include repository/repo.liquid repository=repo %}
20+
{% endfor %}
21+
</div>
22+
<hr>
23+
{% endif %}
24+
{% else %}
25+
<h1 class="post-title">{{ page.title }}</h1>
26+
<p class="post-description">{{ page.description }}</p>
27+
{% endif %}
1528
</header>
1629

1730
<article>

_projects/10_project.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
layout: page
3+
title: project 10
4+
description: A project with an introduction section
5+
img: assets/img/5.jpg
6+
importance: 5
7+
category: work
8+
project_intro: true
9+
icons:
10+
- file: javascript/javascript-original.svg
11+
site: devicons
12+
- file: processing
13+
site: skillicons
14+
- file: https://www.espressif.com/sites/all/themes/espressif/images/logo-guidelines/primary-vertical-logo.png
15+
repository:
16+
- alshedivat/al-folio
17+
---
18+
19+
# Project Intros
20+
21+
A simple way to efficiently display your github project, or any other project as well!
22+
23+
To add a project intro just set `project_intro` to `true` in the front matter. Also add icons to display the tech-stacks used in the project. Finally add relevant repositories to be displayed right below the intro.
24+
25+
```yml
26+
---
27+
project_intro: true
28+
icons:
29+
- file: javascript/javascript-original.svg
30+
site: devicons
31+
- file: processing
32+
site: skillicons
33+
- file: https://www.espressif.com/sites/all/themes/espressif/images/logo-guidelines/primary-vertical-logo.png
34+
repository:
35+
- alshedivat/al-folio
36+
---
37+
```
38+
39+
# Icons
40+
41+
Adding more icons is very simple. `icon` is a list, and each item on the list has a `file` and a `site`. The `file` is the icon file which will be displayed, `site` is the directory from where this file will be displayed.
42+
43+
However, using `site` is optional. If the item doesn't contain a value for site, al-folio will automatically detect and decide whether the link is an absolute URL to some icon on a different website, or a relative URL to an image inside the repository.
44+
45+
Right now, the only eligible options for `site` is `devicons` and `skillicons`
46+
47+
# Repository
48+
49+
`repository` is also a list of all the repositories that can be displayed. Each item needs to be written in the following format: `owner/repository`.
50+
51+
After this, al-folio will automatically generate a card with the proper theme. It will also create a link that will redirect viewers to the repository whenever they click the card.

assets/css/project-intro.css

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.Intro {
2+
display: flex;
3+
margin: 0 auto;
4+
}
5+
6+
.Intro .Icon {
7+
margin: auto;
8+
padding-right: 20px;
9+
display: flex;
10+
justify-content: center;
11+
align-items: center;
12+
}
13+
14+
.Intro .Info {
15+
width: 100%;
16+
}
17+
18+
.Intro .Info .Title {
19+
display: inline;
20+
}
21+
22+
.Intro .Info .TechIconsBox {
23+
display: flex;
24+
justify-content: center;
25+
align-items: center;
26+
gap: 10px;
27+
margin-bottom: 10px;
28+
float: right;
29+
}
30+
31+
.Intro .Info .Description {
32+
margin-top: 20px;
33+
text-align: left;
34+
}
35+
36+
@media (max-width: 1000px) {
37+
.Intro {
38+
display: block;
39+
}
40+
41+
.Intro .Icon {
42+
padding-right: 0px;
43+
margin: auto auto 20px auto;
44+
}
45+
46+
.Intro .Info .Title {
47+
display: block;
48+
text-align: center;
49+
}
50+
51+
.Intro .Info .TechIconsBox {
52+
float: none;
53+
margin: 20px 0;
54+
}
55+
56+
.Intro .Info .Description {
57+
margin-top: 50px;
58+
text-align: center;
59+
}
60+
}
61+
62+
@media (max-width: 500px) {
63+
.Intro .Info .TechIconsBox {
64+
display: grid;
65+
grid-template-columns: repeat(5, 1fr);
66+
}
67+
}

0 commit comments

Comments
 (0)