Skip to content

Commit

Permalink
Add some features
Browse files Browse the repository at this point in the history
I add the projects and math sections.
  • Loading branch information
infernosalex committed Oct 8, 2024
1 parent b62f121 commit 7fcb3da
Show file tree
Hide file tree
Showing 14 changed files with 503 additions and 151 deletions.
20 changes: 20 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ kramdown:
start_line: 1

collections:
posts_math:
output: true
sort_by: order
projects:
output: true
sort_by: order
tabs:
output: true
sort_by: order
Expand All @@ -182,6 +188,20 @@ defaults:
# DO NOT modify the following parameter unless you are confident enough
# to update the code of all other post links in this project.
permalink: /posts/:title/
- scope:
path: "" # An empty string here means all files in the project
type: posts_math
values:
layout: math-post
toc: true
permalink: /math_posts/:title/
- scope:
path: "" # An empty string here means all files in the project
type: projects
values:
layout: projects-post
toc: true
permalink: /projects/:title/
- scope:
path: _drafts
values:
Expand Down
10 changes: 7 additions & 3 deletions _data/contact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
# - type: twitter
# icon: "fa-brands fa-x-twitter"

- type: email
icon: "fas fa-envelope"
noblank: true # open link in current tab
# - type: email
# icon: "fas fa-envelope"
# noblank: true # open link in current tab

- type: linkedin
icon: 'fab fa-linkedin'
url: 'https://www.linkedin.com/in/alexandru-scanteie/'

- type: mastodon
icon: "fab fa-mastodon"
Expand Down
38 changes: 38 additions & 0 deletions _layouts/archives.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
layout: page
# The Archives of posts.
---

{% include lang.html %}

{% assign df_strftime_m = site.data.locales[lang].df.archives.strftime | default: '/ %m' %}
{% assign df_dayjs_m = site.data.locales[lang].df.archives.dayjs | default: '/ MM' %}

<div id="archives" class="pl-xl-3">
{% assign all_posts = site.posts | concat: site.posts_math | concat: site.projects %}
{% assign sorted_posts = all_posts | sort: 'date' | reverse %}

{% for post in sorted_posts %}
{% assign cur_year = post.date | date: '%Y' %}

{% if cur_year != last_year %}
{% unless forloop.first %}</ul>{% endunless %}

<time class="year lead d-block">{{ cur_year }}</time>
{{ '<ul class="list-unstyled">' }}

{% assign last_year = cur_year %}
{% endif %}

<li>
{% assign ts = post.date | date: '%s' %}
<span class="date day" data-ts="{{ ts }}" data-df="DD">{{ post.date | date: '%d' }}</span>
<span class="date month small text-muted ms-1" data-ts="{{ ts }}" data-df="{{ df_dayjs_m }}">
{{ post.date | date: df_strftime_m }}
</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</li>

{% if forloop.last %}</ul>{% endif %}
{% endfor %}
</div>
138 changes: 138 additions & 0 deletions _layouts/categories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
layout: page
# All the Categories of posts
---

{% include lang.html %}

{% assign HEAD_PREFIX = 'h_' %}
{% assign LIST_PREFIX = 'l_' %}

{% assign group_index = 0 %}

{% assign sort_categories = site.categories | sort %}

{% for category in sort_categories %}
{% assign category_name = category | first %}
{% assign posts_of_category = category | last %}
{% assign first_post = posts_of_category | first %}

{% if category_name == first_post.categories[0] %}
{% assign sub_categories = '' | split: '' %}

{% for post in posts_of_category %}
{% assign second_category = post.categories[1] %}
{% if second_category %}
{% unless sub_categories contains second_category %}
{% assign sub_categories = sub_categories | push: second_category %}
{% endunless %}
{% endif %}
{% endfor %}

{% assign sub_categories = sub_categories | sort %}
{% assign sub_categories_size = sub_categories | size %}

<div class="card categories">
<!-- top-category -->
<div
id="{{ HEAD_PREFIX }}{{ group_index }}"
class="card-header d-flex justify-content-between hide-border-bottom"
>
<span class="ms-2">
<i class="far fa-folder{% if sub_categories_size > 0 %}-open{% endif %} fa-fw"></i>

{% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %}
<a href="{{ _category_url | relative_url }}" class="mx-2">{{ category_name }}</a>

<!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %}
{{ sub_categories_size }}
{% if sub_categories_size > 1 %}
{{
site.data.locales[lang].categories.category_measure.plural
| default: site.data.locales[lang].categories.category_measure
}}
{% else %}
{{
site.data.locales[lang].categories.category_measure.singular
| default: site.data.locales[lang].categories.category_measure
}}
{% endif -%}
,
{% endif %}

{{ top_posts_size }}

{% if top_posts_size > 1 %}
{{
site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure
}}
{% else %}
{{
site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure
}}
{% endif %}
</span>
</span>

<!-- arrow -->
{% if sub_categories_size > 0 %}
<a
href="#{{ LIST_PREFIX }}{{ group_index }}"
data-bs-toggle="collapse"
aria-expanded="true"
aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom"
>
<i class="fas fa-fw fa-angle-down"></i>
</a>
{% else %}
<span data-bs-toggle="collapse" class="category-trigger hide-border-bottom disabled">
<i class="fas fa-fw fa-angle-right"></i>
</span>
{% endif %}
</div>
<!-- .card-header -->

<!-- Sub-categories -->
{% if sub_categories_size > 0 %}
<div id="{{ LIST_PREFIX }}{{ group_index }}" class="collapse show" aria-expanded="true">
<ul class="list-group">
{% for sub_category in sub_categories %}
<li class="list-group-item">
<i class="far fa-folder fa-fw"></i>

{% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | url_encode }}/{% endcapture %}
<a href="{{ _sub_ctg_url | relative_url }}" class="mx-2">{{ sub_category }}</a>

{% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light">
{{ posts_size }}

{% if posts_size > 1 %}
{{
site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure
}}
{% else %}
{{
site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure
}}
{% endif %}
</span>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
<!-- .card -->

{% assign group_index = group_index | plus: 1 %}
{% endif %}
{% endfor %}
24 changes: 24 additions & 0 deletions _layouts/category.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
layout: page
# The Category layout
---

{% include lang.html %}

<div id="page-category">
<h1 class="ps-lg-2">
<i class="far fa-folder-open fa-fw text-muted"></i>
{{ page.title }}
<span class="lead text-muted ps-2">{{ page.posts | size }}</span>
</h1>

<ul class="content ps-0">
{% for post in page.posts %}
<li class="d-flex justify-content-between px-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
{% include datetime.html date=post.date class='text-muted small text-nowrap' lang=lang %}
</li>
{% endfor %}
</ul>
</div>
Loading

0 comments on commit 7fcb3da

Please sign in to comment.