mirror of
https://github.com/calofmijuck/blog.git
synced 2025-12-06 14:53:50 +00:00
Compare commits
2 Commits
3b632697b0
...
e2ede1cdb6
| Author | SHA1 | Date | |
|---|---|---|---|
|
e2ede1cdb6
|
|||
|
56e14d045f
|
39
_includes/post-summary.html
Normal file
39
_includes/post-summary.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{%- comment -%}
|
||||||
|
Get the post's description or body content.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
full_text: If true, return the full content. Default is false.
|
||||||
|
max_length: The maximum length of the returned content. Default is 200.
|
||||||
|
{%- endcomment -%}
|
||||||
|
|
||||||
|
{%- if post.description and include.full_text != true -%}
|
||||||
|
{{- post.description -}}
|
||||||
|
{%- else -%}
|
||||||
|
{%- comment -%} Remove the line numbers from the code snippet. {%- endcomment -%}
|
||||||
|
|
||||||
|
{%- assign content = post.content -%}
|
||||||
|
|
||||||
|
{%- if content contains '<td class="rouge-gutter gl"><pre class="lineno">' -%}
|
||||||
|
{%- assign content = content
|
||||||
|
| replace: '<td class="rouge-gutter gl"><pre class="lineno">',
|
||||||
|
'<!-- <td class="rouge-gutter gl"><pre class="lineno">'
|
||||||
|
-%}
|
||||||
|
{%- assign content = content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- assign content = content
|
||||||
|
| markdownify
|
||||||
|
| strip_html
|
||||||
|
| newline_to_br
|
||||||
|
| replace: '<br />', ' '
|
||||||
|
| strip_newlines
|
||||||
|
| strip
|
||||||
|
-%}
|
||||||
|
|
||||||
|
{%- unless include.full_text -%}
|
||||||
|
{%- assign max_length = include.max_length | default: 200 -%}
|
||||||
|
{%- assign content = content | truncate: max_length -%}
|
||||||
|
{%- endunless -%}
|
||||||
|
|
||||||
|
{{- content -}}
|
||||||
|
{%- endif -%}
|
||||||
97
_includes/sidebar.html
Normal file
97
_includes/sidebar.html
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<!-- The Side Bar -->
|
||||||
|
|
||||||
|
<aside aria-label="Sidebar" id="sidebar" class="d-flex flex-column align-items-end">
|
||||||
|
<header class="profile-wrapper">
|
||||||
|
<a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
|
||||||
|
{%- if site.avatar != empty and site.avatar -%}
|
||||||
|
{%- capture avatar_url -%}
|
||||||
|
{% include media-url.html src=site.avatar %}
|
||||||
|
{%- endcapture -%}
|
||||||
|
<img src="{{- avatar_url -}}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
|
||||||
|
{%- endif -%}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<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 -->
|
||||||
|
|
||||||
|
<nav class="flex-column flex-grow-1 w-100 ps-0">
|
||||||
|
<ul class="nav">
|
||||||
|
{% for tab in site.tabs %}
|
||||||
|
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
|
||||||
|
<a href="{{ tab.url | relative_url }}" class="nav-link">
|
||||||
|
<i class="fa-fw {{ tab.icon }}"></i>
|
||||||
|
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
|
||||||
|
|
||||||
|
<span>{{ site.data.locales[include.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<!-- .nav-item -->
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="sidebar-bottom d-flex flex-wrap align-items-center w-100">
|
||||||
|
{% unless site.theme_mode %}
|
||||||
|
<button type="button" class="btn btn-link nav-link" aria-label="Switch Mode" id="mode-toggle">
|
||||||
|
<i class="fas fa-adjust"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{% if site.data.contact.size > 0 %}
|
||||||
|
<span class="icon-border"></span>
|
||||||
|
{% endif %}
|
||||||
|
{% endunless %}
|
||||||
|
|
||||||
|
{% for entry in site.data.contact %}
|
||||||
|
{%- assign url = null -%}
|
||||||
|
|
||||||
|
{% case entry.type %}
|
||||||
|
{% when 'github', 'twitter' %}
|
||||||
|
{%- unless site[entry.type].username -%}
|
||||||
|
{%- continue -%}
|
||||||
|
{%- endunless -%}
|
||||||
|
{%- capture url -%}
|
||||||
|
https://{{ entry.type }}.com/{{ site[entry.type].username }}
|
||||||
|
{%- endcapture -%}
|
||||||
|
{% when 'email' %}
|
||||||
|
{%- unless site.social.email -%}
|
||||||
|
{%- continue -%}
|
||||||
|
{%- endunless -%}
|
||||||
|
{%- assign email = site.social.email | split: '@' -%}
|
||||||
|
{%- capture url -%}
|
||||||
|
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
|
||||||
|
{%- endcapture -%}
|
||||||
|
{% when 'rss' %}
|
||||||
|
{% assign url = '/feed.xml' | relative_url %}
|
||||||
|
{% else %}
|
||||||
|
{% assign url = entry.url %}
|
||||||
|
{% endcase %}
|
||||||
|
|
||||||
|
{% if url %}
|
||||||
|
<a
|
||||||
|
href="{{ url }}"
|
||||||
|
aria-label="{{ entry.type }}"
|
||||||
|
{% assign link_types = '' %}
|
||||||
|
|
||||||
|
{% unless entry.noblank %}
|
||||||
|
target="_blank"
|
||||||
|
{% assign link_types = 'noopener noreferrer' %}
|
||||||
|
{% endunless %}
|
||||||
|
|
||||||
|
{% if entry.type == 'mastodon' %}
|
||||||
|
{% assign link_types = link_types | append: ' me' | strip %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% unless link_types == empty %}
|
||||||
|
rel="{{ link_types }}"
|
||||||
|
{% endunless %}
|
||||||
|
>
|
||||||
|
<i class="{{ entry.icon }}"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<!-- .sidebar-bottom -->
|
||||||
|
</aside>
|
||||||
|
<!-- #sidebar -->
|
||||||
150
_layouts/home.html
Normal file
150
_layouts/home.html
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
---
|
||||||
|
layout: default
|
||||||
|
---
|
||||||
|
|
||||||
|
{% include lang.html %}
|
||||||
|
|
||||||
|
{% 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: '' %}
|
||||||
|
|
||||||
|
<!-- Pagination fallbacks -->
|
||||||
|
{% assign per_page = paginator.per_page | default: site.paginate | default: 10 %}
|
||||||
|
{% assign page_num = paginator.page | default: 1 %}
|
||||||
|
|
||||||
|
<!-- Get pinned posts on current page -->
|
||||||
|
|
||||||
|
{% assign visible_start = page_num | minus: 1 | times: per_page %}
|
||||||
|
{% assign visible_end = visible_start | plus: per_page %}
|
||||||
|
|
||||||
|
{% 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_size = 0 %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Get normal posts on current page -->
|
||||||
|
|
||||||
|
{% assign paginator_posts = paginator.posts | default: site.posts %}
|
||||||
|
{% assign normal_size = paginator_posts | size | minus: pinned_size %}
|
||||||
|
|
||||||
|
{% if normal_size > 0 %}
|
||||||
|
{% if pinned_size > 0 %}
|
||||||
|
{% assign normal_start = 0 %}
|
||||||
|
{% else %}
|
||||||
|
{% assign normal_start = visible_start | minus: all_pinned.size %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% assign normal_end = normal_start | plus: normal_size | minus: 1 %}
|
||||||
|
|
||||||
|
{% assign normal_end = 10 %}
|
||||||
|
|
||||||
|
{% for i in (normal_start..normal_end) %}
|
||||||
|
{% assign posts = posts | push: all_normal[i] %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="post-list" class="flex-grow-1 px-xl-1">
|
||||||
|
{% for post in posts %}
|
||||||
|
<article class="card-wrapper card">
|
||||||
|
<a href="{{ post.url | relative_url }}" class="post-preview row g-0 flex-md-row-reverse">
|
||||||
|
{% assign card_body_col = '12' %}
|
||||||
|
|
||||||
|
{% if post.image %}
|
||||||
|
{% assign src = post.image.path | default: post.image %}
|
||||||
|
|
||||||
|
{% if post.media_subpath %}
|
||||||
|
{% unless src contains '://' %}
|
||||||
|
{% assign src = post.media_subpath
|
||||||
|
| append: '/'
|
||||||
|
| append: src
|
||||||
|
| replace: '///', '/'
|
||||||
|
| replace: '//', '/'
|
||||||
|
%}
|
||||||
|
{% endunless %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if post.image.lqip %}
|
||||||
|
{% assign lqip = post.image.lqip %}
|
||||||
|
|
||||||
|
{% if post.media_subpath %}
|
||||||
|
{% unless lqip contains 'data:' %}
|
||||||
|
{% assign lqip = post.media_subpath
|
||||||
|
| append: '/'
|
||||||
|
| append: lqip
|
||||||
|
| replace: '///', '/'
|
||||||
|
| replace: '//', '/'
|
||||||
|
%}
|
||||||
|
{% endunless %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% assign lqip_attr = 'lqip="' | append: lqip | append: '"' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %}
|
||||||
|
|
||||||
|
<div class="col-md-5">
|
||||||
|
<img src="{{ src }}" alt="{{ alt }}" {{ lqip_attr }}>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% assign card_body_col = '7' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="col-md-{{ card_body_col }}">
|
||||||
|
<div class="card-body d-flex flex-column">
|
||||||
|
<h1 class="card-title my-2 mt-md-0">{{ post.title }}</h1>
|
||||||
|
|
||||||
|
<div class="card-text content mt-0 mb-3">
|
||||||
|
<p>{% include post-summary.html %}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="post-meta flex-grow-1 d-flex align-items-end">
|
||||||
|
<div class="me-auto">
|
||||||
|
<!-- posted date -->
|
||||||
|
<i class="far fa-calendar fa-fw me-1"></i>
|
||||||
|
{% include datetime.html date=post.date lang=lang %}
|
||||||
|
|
||||||
|
<!-- categories -->
|
||||||
|
{% if post.categories.size > 0 %}
|
||||||
|
<i class="far fa-folder-open fa-fw me-1"></i>
|
||||||
|
<span class="categories">
|
||||||
|
{% for category in post.categories %}
|
||||||
|
{{ category }}
|
||||||
|
{%- unless forloop.last -%},{%- endunless -%}
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if post.pin %}
|
||||||
|
<div class="pin ms-1">
|
||||||
|
<i class="fas fa-thumbtack fa-fw"></i>
|
||||||
|
<span>{{ site.data.locales[lang].post.pin_prompt }}</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<!-- .post-meta -->
|
||||||
|
</div>
|
||||||
|
<!-- .card-body -->
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</article>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<!-- #post-list -->
|
||||||
|
|
||||||
|
{% assign total_pages = paginator.total_pages | default: 2 %}
|
||||||
|
{% if total_pages > 1 and paginator %}
|
||||||
|
{% include post-paginator.html %}
|
||||||
|
{% endif %}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
# the default layout is 'page'
|
# the default layout is 'page'
|
||||||
icon: fas fa-info-circle
|
icon: fas fa-info-circle
|
||||||
order: 4
|
order: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
# Sungchan Yi
|
# Sungchan Yi
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
layout: archives
|
layout: archives
|
||||||
icon: fas fa-archive
|
icon: fas fa-archive
|
||||||
order: 3
|
order: 4
|
||||||
---
|
---
|
||||||
|
|||||||
13
_tabs/blog.md
Normal file
13
_tabs/blog.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: Blog
|
||||||
|
layout: home
|
||||||
|
icon: fas fa-pencil
|
||||||
|
order: 1
|
||||||
|
# pagination:
|
||||||
|
# enabled: true
|
||||||
|
# per_page: 10
|
||||||
|
# collection: posts
|
||||||
|
# permalink: '/page/:num/'
|
||||||
|
---
|
||||||
|
|
||||||
|
This page serves as the site "Home" (posts listing). It is now a tab in the sidebar.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
layout: categories
|
layout: categories
|
||||||
icon: fas fa-stream
|
icon: fas fa-stream
|
||||||
order: 1
|
order: 2
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
layout: tags
|
layout: tags
|
||||||
icon: fas fa-tags
|
icon: fas fa-tags
|
||||||
order: 2
|
order: 3
|
||||||
---
|
---
|
||||||
|
|||||||
13
index.html
13
index.html
@@ -1,4 +1,13 @@
|
|||||||
---
|
---
|
||||||
layout: home
|
layout: page
|
||||||
# Index page
|
title: About
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{%- assign about_tab = site.tabs | where: "url", "/about/" | first -%}
|
||||||
|
|
||||||
|
{%- if about_tab -%}
|
||||||
|
{{ about_tab.content }}
|
||||||
|
{%- else -%}
|
||||||
|
<!-- Fallback: no about tab found -->
|
||||||
|
<h1>About</h1>
|
||||||
|
{%- endif -%}
|
||||||
|
|||||||
Reference in New Issue
Block a user