Skip to content

Commit

Permalink
refactor: update share.yml and sidebar.html
Browse files Browse the repository at this point in the history
Update the share.yml file to add a new platform for Reddit sharing. Also, modify the sidebar.html file to change the site title element to a clickable link.

Closes cotes2020#1955
  • Loading branch information
aishukander committed Sep 27, 2024
2 parents 1d8f54f + b3b7188 commit d8d817a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 33 deletions.
8 changes: 4 additions & 4 deletions _data/share.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ platforms:
icon: "fab fa-telegram"
link: "https://t.me/share/url?url=URL&text=TITLE"

- type: Reddit
icon: "fa-brands fa-square-reddit"
link: "https://www.reddit.com/submit?url=URL&title=TITLE"

# Uncomment below if you need to.
#
# - type: Linkedin
Expand Down Expand Up @@ -41,10 +45,6 @@ platforms:
# icon: "fa-brands fa-bluesky"
# link: "https://bsky.app/intent/compose?text=TITLE%20URL"
#
# - type: Reddit
# icon: "fa-brands fa-square-reddit"
# link: "https://www.reddit.com/submit?url=URL&title=TITLE"
#
# - type: Threads
# icon: "fa-brands fa-square-threads"
# link: "https://www.threads.net/intent/post?text=TITLE%20URL"
4 changes: 1 addition & 3 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
{%- endif -%}
</a>

<h1 class="site-title">
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
</h1>
<a class="site-title d-block" href="{{ '/' | relative_url }}">{{ site.title }}</a>
<p class="site-subtitle fst-italic mb-0">{{ site.tagline }}</p>
</header>
<!-- .profile-wrapper -->
Expand Down
45 changes: 26 additions & 19 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,45 @@

{% include lang.html %}

{% assign pinned = site.posts | where: 'pin', 'true' %}
{% assign default = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %}
{% assign all_pinned = site.posts | where: 'pin', 'true' %}
{% assign all_normal = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %}

{% assign posts = '' | split: '' %}

<!-- Get pinned posts -->
<!-- Get pinned posts on current page -->

{% assign offset = paginator.page | minus: 1 | times: paginator.per_page %}
{% assign pinned_num = pinned.size | minus: offset %}
{% assign visible_start = paginator.page | minus: 1 | times: paginator.per_page %}
{% assign visible_end = visible_start | plus: paginator.per_page %}

{% if pinned_num > 0 %}
{% for i in (offset..pinned.size) limit: pinned_num %}
{% assign posts = posts | push: pinned[i] %}
{% if all_pinned.size > visible_start %}
{% if all_pinned.size > visible_end %}
{% assign pinned_size = paginator.per_page %}
{% else %}
{% assign pinned_size = all_pinned.size | minus: visible_start %}
{% endif %}

{% for i in (visible_start..all_pinned.size) limit: pinned_size %}
{% assign posts = posts | push: all_pinned[i] %}
{% endfor %}
{% else %}
{% assign pinned_num = 0 %}
{% assign pinned_size = 0 %}
{% endif %}

<!-- Get default posts -->
<!-- Get normal posts on current page -->

{% assign default_beg = offset | minus: pinned.size %}
{% assign normal_size = paginator.posts | size | minus: pinned_size %}

{% if default_beg < 0 %}
{% assign default_beg = 0 %}
{% endif %}
{% if normal_size > 0 %}
{% if pinned_size > 0 %}
{% assign normal_start = 0 %}
{% else %}
{% assign normal_start = visible_start | minus: all_pinned.size %}
{% endif %}

{% assign default_num = paginator.posts | size | minus: pinned_num %}
{% assign default_end = default_beg | plus: default_num | minus: 1 %}
{% assign normal_end = normal_start | plus: normal_size | minus: 1 %}

{% if default_num > 0 %}
{% for i in (default_beg..default_end) %}
{% assign posts = posts | push: default[i] %}
{% for i in (normal_start..normal_end) %}
{% assign posts = posts | push: all_normal[i] %}
{% endfor %}
{% endif %}

Expand Down
12 changes: 5 additions & 7 deletions _sass/addon/commons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -738,20 +738,18 @@ $btn-mb: 0.5rem;
}

.site-title {
@extend %clickable-transition;
@extend %sidebar-link-hover;

font-family: inherit;
font-weight: 900;
font-size: 1.75rem;
line-height: 1.2;
letter-spacing: 0.25px;
margin-top: 1.25rem;
margin-bottom: 0.5rem;

a {
@extend %clickable-transition;
@extend %sidebar-link-hover;

color: var(--site-title-color);
}
width: fit-content;
color: var(--site-title-color);
}

.site-subtitle {
Expand Down

0 comments on commit d8d817a

Please sign in to comment.