mirror of
https://github.com/calofmijuck/blog.git
synced 2025-12-06 14:53:50 +00:00
fix: update configurations layouts (#84)
* fix: scss path changed * feat: updated blog configs * feat: updated _data section * feat: update _includes * fix: remove unnecessary files * fix: update _includes directory * fix: remove _includes (not needed)
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
<!-- The comments switcher -->
|
||||
{% if page.comments and site.comments.active %}
|
||||
{% capture path %}comments/{{ site.comments.active }}.html{% endcapture %}
|
||||
{% include {{ path }} %}
|
||||
{% endif %}
|
||||
@@ -1,49 +0,0 @@
|
||||
<!-- The Disqus lazy loading. -->
|
||||
<div id="disqus_thread" class="pt-2 pb-2">
|
||||
<p class="text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var disqus_config = function () {
|
||||
this.page.url = '{{ page.url | absolute_url }}';
|
||||
this.page.identifier = '{{ page.url }}';
|
||||
};
|
||||
|
||||
/* Lazy loading */
|
||||
var disqus_observer = new IntersectionObserver(
|
||||
function (entries) {
|
||||
if (entries[0].isIntersecting) {
|
||||
(function () {
|
||||
var d = document,
|
||||
s = d.createElement('script');
|
||||
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
|
||||
disqus_observer.disconnect();
|
||||
}
|
||||
},
|
||||
{ threshold: [0] }
|
||||
);
|
||||
|
||||
disqus_observer.observe(document.querySelector('#disqus_thread'));
|
||||
|
||||
/* Auto switch theme */
|
||||
function reloadDisqus() {
|
||||
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
|
||||
/* Disqus hasn't been loaded */
|
||||
if (typeof DISQUS === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (document.readyState == 'complete') {
|
||||
DISQUS.reset({ reload: true, config: disqus_config });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (document.querySelector('.mode-toggle')) {
|
||||
window.addEventListener('message', reloadDisqus);
|
||||
}
|
||||
</script>
|
||||
@@ -1,64 +0,0 @@
|
||||
<!-- https://giscus.app/ -->
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
const origin = 'https://giscus.app';
|
||||
const iframe = 'iframe.giscus-frame';
|
||||
const lightTheme = 'light';
|
||||
const darkTheme = 'dark_dimmed';
|
||||
|
||||
let initTheme = lightTheme;
|
||||
const html = document.documentElement;
|
||||
|
||||
if (
|
||||
(html.hasAttribute('data-mode') &&
|
||||
html.getAttribute('data-mode') === 'dark') ||
|
||||
(!html.hasAttribute('data-mode') &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||
) {
|
||||
initTheme = darkTheme;
|
||||
}
|
||||
|
||||
let giscusAttributes = {
|
||||
src: 'https://giscus.app/client.js',
|
||||
'data-repo': '{{ site.comments.giscus.repo}}',
|
||||
'data-repo-id': '{{ site.comments.giscus.repo_id }}',
|
||||
'data-category': '{{ site.comments.giscus.category }}',
|
||||
'data-category-id': '{{ site.comments.giscus.category_id }}',
|
||||
'data-mapping': '{{ site.comments.giscus.mapping | default: 'pathname' }}',
|
||||
'data-reactions-enabled': '{{ site.comments.giscus.reactions_enabled | default: '1' }}',
|
||||
'data-emit-metadata': '0',
|
||||
'data-theme': initTheme,
|
||||
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
|
||||
'data-lang': '{{ site.comments.giscus.lang | default: lang }}',
|
||||
crossorigin: 'anonymous',
|
||||
async: ''
|
||||
};
|
||||
|
||||
let giscusScript = document.createElement('script');
|
||||
Object.entries(giscusAttributes).forEach(([key, value]) =>
|
||||
giscusScript.setAttribute(key, value)
|
||||
);
|
||||
document.getElementById('tail-wrapper').appendChild(giscusScript);
|
||||
|
||||
addEventListener('message', (event) => {
|
||||
if (
|
||||
event.source === window &&
|
||||
event.data &&
|
||||
event.data.direction === ModeToggle.ID
|
||||
) {
|
||||
/* global theme mode changed */
|
||||
const mode = event.data.message;
|
||||
const theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
|
||||
|
||||
const message = {
|
||||
setConfig: {
|
||||
theme: theme
|
||||
}
|
||||
};
|
||||
|
||||
const giscus = document.querySelector(iframe).contentWindow;
|
||||
giscus.postMessage({ giscus: message }, origin);
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@@ -1,51 +0,0 @@
|
||||
<!-- https://utteranc.es/ -->
|
||||
<script src="https://utteranc.es/client.js"
|
||||
repo="{{ site.comments.utterances.repo }}"
|
||||
issue-term="{{ site.comments.utterances.issue_term }}"
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
const origin = "https://utteranc.es";
|
||||
const iframe = "iframe.utterances-frame";
|
||||
const lightTheme = "github-light";
|
||||
const darkTheme = "github-dark";
|
||||
let initTheme = lightTheme;
|
||||
|
||||
if ($("html[data-mode=dark]").length > 0
|
||||
|| ($("html[data-mode]").length == 0
|
||||
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
|
||||
initTheme = darkTheme;
|
||||
}
|
||||
|
||||
addEventListener("message", (event) => {
|
||||
let theme;
|
||||
|
||||
/* credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347> */
|
||||
if (event.origin === origin) {
|
||||
/* page initial */
|
||||
theme = initTheme;
|
||||
|
||||
} else if (event.source === window && event.data &&
|
||||
event.data.direction === ModeToggle.ID) {
|
||||
/* global theme mode changed */
|
||||
const mode = event.data.message;
|
||||
theme = (mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme);
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
const message = {
|
||||
type: "set-theme",
|
||||
theme: theme
|
||||
};
|
||||
|
||||
const utterances = document.querySelector(iframe).contentWindow;
|
||||
utterances.postMessage(message, origin);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -1,19 +0,0 @@
|
||||
<!--
|
||||
Date format snippet
|
||||
See: ${JS_ROOT}/utils/locale-dateime.js
|
||||
-->
|
||||
|
||||
{% assign wrap_elem = include.wrap | default: 'em' %}
|
||||
{% assign df_strftime = site.data.locales[include.lang].df.post.strftime | default: '%d/%m/%Y' %}
|
||||
{% assign df_dayjs = site.data.locales[include.lang].df.post.dayjs | default: 'DD/MM/YYYY' %}
|
||||
|
||||
<{{ wrap_elem }}
|
||||
class="{% if include.class %}{{ include.class }}{% endif %}"
|
||||
data-ts="{{ include.date | date: '%s' }}"
|
||||
data-df="{{ df_dayjs }}"
|
||||
{% if include.tooltip %}
|
||||
data-bs-toggle="tooltip" data-bs-placement="bottom"
|
||||
{% endif %}
|
||||
>
|
||||
{{ include.date | date: df_strftime }}
|
||||
</{{ wrap_elem }}>
|
||||
@@ -1,4 +0,0 @@
|
||||
<iframe class="embed-video twitch lazyload"
|
||||
src="https://player.twitch.tv/?video={{ include.id }}&parent={{ site.url | split: '://' | last | remove: '/' }}"
|
||||
frameborder="0" allowfullscreen="true"
|
||||
scrolling="no"></iframe>
|
||||
@@ -1,6 +0,0 @@
|
||||
<iframe class="embed-video youtube lazyload"
|
||||
src="https://www.youtube.com/embed/{{ include.id }}"
|
||||
title="YouTube video player"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen></iframe>
|
||||
@@ -1,17 +0,0 @@
|
||||
<!--
|
||||
The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
|
||||
Generated by: https://realfavicongenerator.net/
|
||||
-->
|
||||
|
||||
{% capture favicon_path %}{{ '/assets/img/favicons' | relative_url }}{% endcapture %}
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ favicon_path }}/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ favicon_path }}/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ favicon_path }}/favicon-16x16.png">
|
||||
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
|
||||
<link rel="shortcut icon" type="image/png" href="{{ favicon_path }}/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-title" content="{{ site.title }}">
|
||||
<meta name="application-name" content="{{ site.title }}">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-config" content="{{ favicon_path }}/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
@@ -1,34 +0,0 @@
|
||||
<!-- The Footer -->
|
||||
|
||||
<footer>
|
||||
<div class="container px-lg-4">
|
||||
<div class="d-flex justify-content-center align-items-center text-muted mx-md-3">
|
||||
<p>
|
||||
{%- capture _platform -%}
|
||||
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
|
||||
{%- endcapture -%}
|
||||
|
||||
{%- capture _theme -%}
|
||||
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
|
||||
{%- endcapture -%}
|
||||
|
||||
{{ site.data.locales[include.lang].meta | replace: ':PLATFORM', _platform | replace: ':THEME', _theme }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{- '©' }}
|
||||
{{ 'now' | date: '%Y' }}
|
||||
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
|
||||
{% if site.data.locales[include.lang].copyright.brief %}
|
||||
<span
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ site.data.locales[include.lang].copyright.verbose }}"
|
||||
>
|
||||
{{- site.data.locales[include.lang].copyright.brief -}}
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!--
|
||||
The GA snippet
|
||||
-->
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ site.google_analytics.id }}');
|
||||
});
|
||||
</script>
|
||||
@@ -1,95 +0,0 @@
|
||||
<!-- The Head -->
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
|
||||
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1b1b1e">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, user-scalable=no initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
|
||||
>
|
||||
|
||||
{% capture seo_tags %}
|
||||
{% seo title=false %}
|
||||
{% endcapture %}
|
||||
|
||||
{% if page.image %}
|
||||
{% assign img = page.image.path | default: page.image %}
|
||||
|
||||
{% unless img contains '://' %}
|
||||
{% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %}
|
||||
{% capture target %}"{{ img | absolute_url }}"{% endcapture %}
|
||||
|
||||
{% if site.img_cdn contains '//' %}
|
||||
<!-- it's a cross-origin URL -->
|
||||
{% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %}
|
||||
{% else %}
|
||||
<!-- it's a local file path -->
|
||||
{%- capture replacement -%}
|
||||
"{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
|
||||
{%- endcapture -%}
|
||||
{% endif %}
|
||||
|
||||
{% assign seo_tags = seo_tags | replace: target, replacement %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
{{ seo_tags }}
|
||||
|
||||
<title>
|
||||
{%- unless page.layout == 'home' -%}
|
||||
{{ page.title | append: ' | ' }}
|
||||
{%- endunless -%}
|
||||
{{ site.title }}
|
||||
</title>
|
||||
|
||||
{% include_cached favicons.html %}
|
||||
|
||||
{% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %}
|
||||
<link href="{{ site.data.origin[type].webfonts | relative_url }}" rel="stylesheet">
|
||||
|
||||
{% else %}
|
||||
{% for cdn in site.data.origin[type].cdns %}
|
||||
<link rel="preconnect" href="{{ cdn.url }}" {{ cdn.args }}>
|
||||
<link rel="dns-prefetch" href="{{ cdn.url }}" {{ cdn.args }}>
|
||||
{% endfor %}
|
||||
|
||||
<link rel="stylesheet" href="{{ site.data.origin[type].webfonts | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
<!-- GA -->
|
||||
{% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.id %}
|
||||
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials">
|
||||
<link rel="dns-prefetch" href="https://www.google-analytics.com">
|
||||
|
||||
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin="anonymous">
|
||||
<link rel="dns-prefetch" href="https://www.googletagmanager.com">
|
||||
{% endif %}
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url}}">
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="{{ site.data.origin[type].fontawesome.css | relative_url }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
|
||||
|
||||
{% if site.toc and page.toc %}
|
||||
<link rel="stylesheet" href="{{ site.data.origin[type].toc.css | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
{% if page.layout == 'page' or page.layout == 'post' %}
|
||||
<!-- Manific Popup -->
|
||||
<link rel="stylesheet" href="{{ site.data.origin[type].magnific-popup.css | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
<!-- JavaScript -->
|
||||
|
||||
{% unless site.theme_mode %}
|
||||
{% include mode-toggle.html %}
|
||||
{% endunless %}
|
||||
|
||||
{% include metadata-hook.html %}
|
||||
</head>
|
||||
@@ -1,106 +0,0 @@
|
||||
<!-- JS selector for site. -->
|
||||
|
||||
<!-- commons -->
|
||||
|
||||
{% assign urls = site.data.origin[type].jquery.js
|
||||
| append: ','
|
||||
| append: site.data.origin[type].bootstrap.js
|
||||
| append: ','
|
||||
| append: site.data.origin[type].search.js
|
||||
%}
|
||||
|
||||
<!-- layout specified -->
|
||||
|
||||
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
|
||||
{% assign urls = urls | append: ',' | append: site.data.origin[type].lazysizes.js %}
|
||||
|
||||
{% unless page.layout == 'home' %}
|
||||
<!-- image lazy-loading & popup & clipboard -->
|
||||
{% assign urls = urls
|
||||
| append: ','
|
||||
| append: site.data.origin[type]['magnific-popup'].js
|
||||
| append: ','
|
||||
| append: site.data.origin[type].clipboard.js
|
||||
%}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.layout == 'home'
|
||||
or page.layout == 'post'
|
||||
or page.layout == 'archives'
|
||||
or page.layout == 'category'
|
||||
or page.layout == 'tag'
|
||||
%}
|
||||
{% assign locale = site.lang | split: '-' | first %}
|
||||
|
||||
{% assign urls = urls
|
||||
| append: ','
|
||||
| append: site.data.origin[type].dayjs.js.common
|
||||
| append: ','
|
||||
| append: site.data.origin[type].dayjs.js.locale
|
||||
| replace: ':LOCALE', locale
|
||||
| append: ','
|
||||
| append: site.data.origin[type].dayjs.js.relativeTime
|
||||
| append: ','
|
||||
| append: site.data.origin[type].dayjs.js.localizedFormat
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
{% if page.content contains '<h2' or page.content contains '<h3' and site.toc and page.toc %}
|
||||
{% assign urls = urls | append: ',' | append: site.data.origin[type].toc.js %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.mermaid %}
|
||||
{% assign urls = urls | append: ',' | append: site.data.origin[type].mermaid.js %}
|
||||
{% endif %}
|
||||
|
||||
{% include jsdelivr-combine.html urls=urls %}
|
||||
|
||||
{% case page.layout %}
|
||||
{% when 'home', 'categories', 'post', 'page' %}
|
||||
{% assign js = page.layout %}
|
||||
{% when 'archives', 'category', 'tag' %}
|
||||
{% assign js = 'misc' %}
|
||||
{% else %}
|
||||
{% assign js = 'commons' %}
|
||||
{% endcase %}
|
||||
|
||||
{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
|
||||
<script defer src="{{ script | relative_url }}"></script>
|
||||
|
||||
{% if page.math %}
|
||||
<!-- MathJax -->
|
||||
<script>
|
||||
/* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
|
||||
MathJax = {
|
||||
tex: {
|
||||
/* start/end delimiter pairs for in-line math */
|
||||
inlineMath: [
|
||||
['$', '$'],
|
||||
['\\(', '\\)']
|
||||
],
|
||||
/* start/end delimiter pairs for display math */
|
||||
displayMath: [
|
||||
['$$', '$$'],
|
||||
['\\[', '\\]']
|
||||
]
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="{{ site.data.origin[type].polyfill.js | relative_url }}"></script>
|
||||
<script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if jekyll.environment == 'production' %}
|
||||
<!-- PWA -->
|
||||
{% if site.pwa.enabled %}
|
||||
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
||||
{% else %}
|
||||
<script defer src="{{ '/unregister.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- GA -->
|
||||
{% if site.google_analytics.id != empty and site.google_analytics.id %}
|
||||
{% include google-analytics.html %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -1,26 +0,0 @@
|
||||
{% assign urls = include.urls | split: ',' %}
|
||||
|
||||
{% assign combined_urls = nil %}
|
||||
|
||||
{% assign domain = 'https://cdn.jsdelivr.net/' %}
|
||||
|
||||
{% for url in urls %}
|
||||
{% if url contains domain %}
|
||||
{% assign url_snippet = url | slice: domain.size, url.size %}
|
||||
|
||||
{% if combined_urls %}
|
||||
{% assign combined_urls = combined_urls | append: ',' | append: url_snippet %}
|
||||
{% else %}
|
||||
{% assign combined_urls = domain | append: 'combine/' | append: url_snippet %}
|
||||
{% endif %}
|
||||
|
||||
{% elsif url contains '//' %}
|
||||
<script src="{{ url }}"></script>
|
||||
{% else %}
|
||||
<script src="{{ url | relative_url }}"></script>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if combined_urls %}
|
||||
<script src="{{ combined_urls }}"></script>
|
||||
{% endif %}
|
||||
@@ -1,8 +0,0 @@
|
||||
{% comment %}
|
||||
Detect appearance language and return it through variable "lang"
|
||||
{% endcomment %}
|
||||
{% if site.data.locales[site.lang] %}
|
||||
{% assign lang = site.lang %}
|
||||
{% else %}
|
||||
{% assign lang = 'en' %}
|
||||
{% endif %}
|
||||
@@ -1,70 +0,0 @@
|
||||
{% comment %}
|
||||
|
||||
Convert the alias of the syntax language to the official name
|
||||
|
||||
See: <https://github.com/rouge-ruby/rouge/wiki/List-of-supported-languages-and-lexers>
|
||||
|
||||
{% endcomment %}
|
||||
|
||||
{% assign _lang = include.language | default: '' %}
|
||||
|
||||
{% case _lang %}
|
||||
{% when 'actionscript', 'as', 'as3' %}
|
||||
{{ 'ActionScript' }}
|
||||
{% when 'applescript' %}
|
||||
{{ 'AppleScript' }}
|
||||
{% when 'brightscript', 'bs', 'brs' %}
|
||||
{{ 'BrightScript' }}
|
||||
{% when 'cfscript', 'cfc' %}
|
||||
{{ 'CFScript' }}
|
||||
{% when 'coffeescript', 'coffee', 'coffee-script' %}
|
||||
{{ 'CoffeeScript' }}
|
||||
{% when 'cs', 'csharp' %}
|
||||
{{ 'C#' }}
|
||||
{% when 'erl' %}
|
||||
{{ 'Erlang' }}
|
||||
{% when 'graphql' %}
|
||||
{{ 'GraphQL' }}
|
||||
{% when 'haskell', 'hs' %}
|
||||
{{ 'Haskell' }}
|
||||
{% when 'javascript', 'js' %}
|
||||
{{ 'JavaScript' }}
|
||||
{% when 'make', 'mf', 'gnumake', 'bsdmake' %}
|
||||
{{ 'Makefile' }}
|
||||
{% when 'md', 'mkd' %}
|
||||
{{ 'Markdown' }}
|
||||
{% when 'm' %}
|
||||
{{ 'Matlab' }}
|
||||
{% when 'objective_c', 'objc', 'obj-c', 'obj_c', 'objectivec' %}
|
||||
{{ 'Objective-C' }}
|
||||
{% when 'perl', 'pl' %}
|
||||
{{ 'Perl' }}
|
||||
{% when 'php','php3','php4','php5' %}
|
||||
{{ 'PHP' }}
|
||||
{% when 'py' %}
|
||||
{{ 'Python' }}
|
||||
{% when 'rb' %}
|
||||
{{ 'Ruby' }}
|
||||
{% when 'rs','no_run','ignore','should_panic' %}
|
||||
{{ 'Rust' }}
|
||||
{% when 'bash', 'zsh', 'ksh', 'sh' %}
|
||||
{{ 'Shell' }}
|
||||
{% when 'st', 'squeak' %}
|
||||
{{ 'Smalltalk' }}
|
||||
{% when 'tex'%}
|
||||
{{ 'TeX' }}
|
||||
{% when 'latex' %}
|
||||
{{ 'LaTex' }}
|
||||
{% when 'ts', 'typescript' %}
|
||||
{{ 'TypeScript' }}
|
||||
{% when 'vb', 'visualbasic' %}
|
||||
{{ 'Visual Basic' }}
|
||||
{% when 'vue', 'vuejs' %}
|
||||
{{ 'Vue.js' }}
|
||||
{% when 'yml' %}
|
||||
{{ 'YAML' }}
|
||||
{% when 'css', 'html', 'scss', 'ssh', 'toml', 'xml', 'yaml', 'json' %}
|
||||
{{ _lang | upcase }}
|
||||
{% else %}
|
||||
{{ _lang | capitalize }}
|
||||
{% endcase %}
|
||||
@@ -1,58 +0,0 @@
|
||||
<!-- mermaid-js loader -->
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
function updateMermaid(event) {
|
||||
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
|
||||
const mode = event.data.message;
|
||||
|
||||
if (typeof mermaid === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
let expectedTheme = mode === ModeToggle.DARK_MODE ? 'dark' : 'default';
|
||||
let config = { theme: expectedTheme };
|
||||
|
||||
/* Re-render the SVG › <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */
|
||||
$('.mermaid').each(function () {
|
||||
let svgCode = $(this).prev().children().html();
|
||||
$(this).removeAttr('data-processed');
|
||||
$(this).html(svgCode);
|
||||
});
|
||||
|
||||
mermaid.initialize(config);
|
||||
mermaid.init(undefined, '.mermaid');
|
||||
}
|
||||
}
|
||||
|
||||
let initTheme = 'default';
|
||||
const html = document.documentElement;
|
||||
|
||||
if (
|
||||
(html.hasAttribute('data-mode') && html.getAttribute('data-mode') === 'dark') ||
|
||||
(!html.hasAttribute('data-mode') && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||
) {
|
||||
initTheme = 'dark';
|
||||
}
|
||||
|
||||
let mermaidConf = {
|
||||
theme: initTheme /* <default|dark|forest|neutral> */
|
||||
};
|
||||
|
||||
/* Create mermaid tag */
|
||||
document.querySelectorAll('pre>code.language-mermaid').forEach((elem) => {
|
||||
const svgCode = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add('unloaded');
|
||||
/* create mermaid node */
|
||||
let mermaid = document.createElement('pre');
|
||||
mermaid.classList.add('mermaid');
|
||||
const text = document.createTextNode(svgCode);
|
||||
mermaid.appendChild(text);
|
||||
backup.after(mermaid);
|
||||
});
|
||||
|
||||
mermaid.initialize(mermaidConf);
|
||||
|
||||
window.addEventListener('message', updateMermaid);
|
||||
})();
|
||||
</script>
|
||||
@@ -1 +0,0 @@
|
||||
<!-- A placeholder to allow defining custom metadata -->
|
||||
@@ -1,143 +0,0 @@
|
||||
<!-- Switch the mode between dark and light. -->
|
||||
|
||||
<script type="text/javascript">
|
||||
class ModeToggle {
|
||||
static get MODE_KEY() {
|
||||
return 'mode';
|
||||
}
|
||||
static get MODE_ATTR() {
|
||||
return 'data-mode';
|
||||
}
|
||||
static get DARK_MODE() {
|
||||
return 'dark';
|
||||
}
|
||||
static get LIGHT_MODE() {
|
||||
return 'light';
|
||||
}
|
||||
static get ID() {
|
||||
return 'mode-toggle';
|
||||
}
|
||||
|
||||
constructor() {
|
||||
if (this.hasMode) {
|
||||
if (this.isDarkMode) {
|
||||
if (!this.isSysDarkPrefer) {
|
||||
this.setDark();
|
||||
}
|
||||
} else {
|
||||
if (this.isSysDarkPrefer) {
|
||||
this.setLight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let self = this;
|
||||
|
||||
/* always follow the system prefers */
|
||||
this.sysDarkPrefers.addEventListener('change', () => {
|
||||
if (self.hasMode) {
|
||||
if (self.isDarkMode) {
|
||||
if (!self.isSysDarkPrefer) {
|
||||
self.setDark();
|
||||
}
|
||||
} else {
|
||||
if (self.isSysDarkPrefer) {
|
||||
self.setLight();
|
||||
}
|
||||
}
|
||||
|
||||
self.clearMode();
|
||||
}
|
||||
|
||||
self.notify();
|
||||
});
|
||||
} /* constructor() */
|
||||
|
||||
get sysDarkPrefers() {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)');
|
||||
}
|
||||
|
||||
get isSysDarkPrefer() {
|
||||
return this.sysDarkPrefers.matches;
|
||||
}
|
||||
|
||||
get isDarkMode() {
|
||||
return this.mode === ModeToggle.DARK_MODE;
|
||||
}
|
||||
|
||||
get isLightMode() {
|
||||
return this.mode === ModeToggle.LIGHT_MODE;
|
||||
}
|
||||
|
||||
get hasMode() {
|
||||
return this.mode != null;
|
||||
}
|
||||
|
||||
get mode() {
|
||||
return sessionStorage.getItem(ModeToggle.MODE_KEY);
|
||||
}
|
||||
|
||||
/* get the current mode on screen */
|
||||
get modeStatus() {
|
||||
if (this.isDarkMode || (!this.hasMode && this.isSysDarkPrefer)) {
|
||||
return ModeToggle.DARK_MODE;
|
||||
} else {
|
||||
return ModeToggle.LIGHT_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
setDark() {
|
||||
document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE);
|
||||
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
|
||||
}
|
||||
|
||||
setLight() {
|
||||
document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE);
|
||||
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
|
||||
}
|
||||
|
||||
clearMode() {
|
||||
document.documentElement.removeAttribute(ModeToggle.MODE_ATTR);
|
||||
sessionStorage.removeItem(ModeToggle.MODE_KEY);
|
||||
}
|
||||
|
||||
/* Notify another plugins that the theme mode has changed */
|
||||
notify() {
|
||||
window.postMessage(
|
||||
{
|
||||
direction: ModeToggle.ID,
|
||||
message: this.modeStatus
|
||||
},
|
||||
'*'
|
||||
);
|
||||
}
|
||||
|
||||
flipMode() {
|
||||
if (this.hasMode) {
|
||||
if (this.isSysDarkPrefer) {
|
||||
if (this.isLightMode) {
|
||||
this.clearMode();
|
||||
} else {
|
||||
this.setLight();
|
||||
}
|
||||
} else {
|
||||
if (this.isDarkMode) {
|
||||
this.clearMode();
|
||||
} else {
|
||||
this.setDark();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.isSysDarkPrefer) {
|
||||
this.setLight();
|
||||
} else {
|
||||
this.setDark();
|
||||
}
|
||||
}
|
||||
|
||||
this.notify();
|
||||
} /* flipMode() */
|
||||
} /* ModeToggle */
|
||||
|
||||
const modeToggle = new ModeToggle();
|
||||
</script>
|
||||
@@ -1,10 +0,0 @@
|
||||
{% comment %}
|
||||
Remove the line number of the code snippet.
|
||||
{% endcomment %}
|
||||
|
||||
{% assign content = include.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 %}
|
||||
@@ -1,13 +0,0 @@
|
||||
{% comment %} Site static assets origin type {% endcomment %}
|
||||
|
||||
{% assign type = 'cors' %}
|
||||
|
||||
{% if site.assets.self_host.enabled %}
|
||||
{% if site.assets.self_host.env %}
|
||||
{% if site.assets.self_host.env == jekyll.environment %}
|
||||
{% assign type = 'basic' %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% assign type = 'basic' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -1,37 +0,0 @@
|
||||
<!-- Navigation buttons at the bottom of the post. -->
|
||||
|
||||
<div class="post-navigation d-flex justify-content-between">
|
||||
{% if page.previous.url %}
|
||||
<a
|
||||
href="{{ site.baseurl }}{{ page.previous.url }}"
|
||||
class="btn btn-outline-primary"
|
||||
prompt="{{ site.data.locales[include.lang].post.button.previous }}"
|
||||
>
|
||||
<p>{{ page.previous.title }}</p>
|
||||
</a>
|
||||
{% else %}
|
||||
<div
|
||||
class="btn btn-outline-primary disabled"
|
||||
prompt="{{ site.data.locales[include.lang].post.button.previous }}"
|
||||
>
|
||||
<p>-</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if page.next.url %}
|
||||
<a
|
||||
href="{{ site.baseurl }}{{page.next.url}}"
|
||||
class="btn btn-outline-primary"
|
||||
prompt="{{ site.data.locales[include.lang].post.button.next }}"
|
||||
>
|
||||
<p>{{ page.next.title }}</p>
|
||||
</a>
|
||||
{% else %}
|
||||
<div
|
||||
class="btn btn-outline-primary disabled"
|
||||
prompt="{{ site.data.locales[include.lang].post.button.next }}"
|
||||
>
|
||||
<p>-</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -1,89 +0,0 @@
|
||||
<!-- The paginator for post list on HomgPage. -->
|
||||
|
||||
<ul class="pagination align-items-center mt-4 mb-5 ps-lg-2">
|
||||
<!-- left arrow -->
|
||||
{% if paginator.previous_page %}
|
||||
{% assign prev_url = paginator.previous_page_path | relative_url %}
|
||||
{% else %}
|
||||
{% assign prev_url = '#' %}
|
||||
{% endif %}
|
||||
|
||||
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
|
||||
<a class="page-link btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page">
|
||||
<i class="fas fa-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- page numbers -->
|
||||
{% assign left_ellipsis = false %}
|
||||
{% assign right_ellipsis = false %}
|
||||
|
||||
{% for i in (1..paginator.total_pages) %}
|
||||
{% assign pre = paginator.page | minus: 1 %}
|
||||
{% assign next = paginator.page | plus: 1 %}
|
||||
{% assign pre_less = pre | minus: 1 %}
|
||||
{% assign next_more = next | plus: 1 %}
|
||||
{% assign show = false %}
|
||||
|
||||
{% if paginator.page == 1 %}
|
||||
{% if i <= 3 or i == paginator.total_pages %}
|
||||
{% assign show = true %}
|
||||
{% endif %}
|
||||
{% elsif paginator.page == paginator.total_pages %}
|
||||
{% if i == 1 or i >= pre_less %}
|
||||
{% assign show = true %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if i == 1 or i == paginator.total_pages %}
|
||||
{% assign show = true %}
|
||||
{% elsif i >= pre and i <= next %}
|
||||
{% assign show = true %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if show %}
|
||||
<!-- show number -->
|
||||
<li class="page-item {% if i == paginator.page %} active{% endif %}">
|
||||
<a
|
||||
class="page-link btn-box-shadow"
|
||||
href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}"
|
||||
>
|
||||
{{- i -}}
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<!-- hide number -->
|
||||
{% if i < pre and left_ellipsis == false %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link btn-box-shadow">...</span>
|
||||
</li>
|
||||
{% assign left_ellipsis = true %}
|
||||
{% elsif i > next and right_ellipsis == false %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link btn-box-shadow">...</span>
|
||||
</li>
|
||||
{% assign right_ellipsis = true %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- mobile pagination -->
|
||||
<li class="page-index align-middle">
|
||||
<span>{{ paginator.page }}</span>
|
||||
<span class="text-muted">/ {{ paginator.total_pages }}</span>
|
||||
</li>
|
||||
|
||||
<!-- right arrow -->
|
||||
{% if paginator.next_page_path %}
|
||||
{% assign next_url = paginator.next_page_path | relative_url %}
|
||||
{% else %}
|
||||
{% assign next_url = '#' %}
|
||||
{% endif %}
|
||||
|
||||
<li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}">
|
||||
<a class="page-link btn-box-shadow" href="{{ next_url }}" aria-label="next-page">
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- .pagination -->
|
||||
@@ -1,35 +0,0 @@
|
||||
<!-- Post sharing snippet -->
|
||||
|
||||
<div class="share-wrapper">
|
||||
<span class="share-label text-muted me-1">{{ site.data.locales[include.lang].post.share }}</span>
|
||||
<span class="share-icons">
|
||||
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
|
||||
{% assign title = title | uri_escape %}
|
||||
{% assign url = page.url | absolute_url | url_encode %}
|
||||
|
||||
{% for share in site.data.share.platforms %}
|
||||
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
|
||||
<a
|
||||
href="{{ link }}"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ share.type }}"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
aria-label="{{ share.type }}"
|
||||
>
|
||||
<i class="fa-fw {{ share.icon }}"></i>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
<i
|
||||
id="copy-link"
|
||||
class="fa-fw fas fa-link small"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ site.data.locales[include.lang].post.button.share_link.title }}"
|
||||
data-title-succeed="{{ site.data.locales[include.lang].post.button.share_link.succeed }}"
|
||||
>
|
||||
</i>
|
||||
</span>
|
||||
</div>
|
||||
@@ -1,37 +0,0 @@
|
||||
<!-- Calculate the post's reading time, and display the word count in tooltip -->
|
||||
|
||||
{% assign words = include.content | strip_html | number_of_words: 'auto' %}
|
||||
|
||||
<!-- words per minute -->
|
||||
|
||||
{% assign wpm = 250 %}
|
||||
{% assign min_time = 1 %}
|
||||
|
||||
{% assign read_time = words | divided_by: wpm %}
|
||||
|
||||
{% unless read_time > 0 %}
|
||||
{% assign read_time = min_time %}
|
||||
{% endunless %}
|
||||
|
||||
{% capture read_prompt %}
|
||||
{{- site.data.locales[include.lang].post.read_time.prompt -}}
|
||||
{% endcapture %}
|
||||
|
||||
<!-- return element -->
|
||||
<span
|
||||
class="readtime"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="bottom"
|
||||
title="{{ words }} {{ site.data.locales[include.lang].post.words }}"
|
||||
>
|
||||
<em>
|
||||
{{- read_time -}}
|
||||
{{ ' ' }}
|
||||
{{- site.data.locales[include.lang].post.read_time.unit -}}
|
||||
</em>
|
||||
{%- if include.prompt -%}
|
||||
{%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
|
||||
{%- unless _prompt_words > 1 -%}{{ ' ' }}{%- endunless -%}
|
||||
{{ read_prompt }}
|
||||
{%- endif -%}
|
||||
</span>
|
||||
@@ -1,286 +0,0 @@
|
||||
<!-- Refactor the HTML structure -->
|
||||
|
||||
{% assign _content = include.content %}
|
||||
|
||||
<!--
|
||||
In order to allow a wide table to scroll horizontally,
|
||||
we suround the markdown table with `<div class="table-wrapper">` and `</div>`
|
||||
-->
|
||||
|
||||
{% if _content contains '<table' %}
|
||||
{% assign _content = _content
|
||||
| replace: '<table', '<div class="table-wrapper"><table'
|
||||
| replace: '</table>', '</table></div>'
|
||||
| replace: '<code><div class="table-wrapper">', '<code>'
|
||||
| replace: '</table></div></code>', '</table></code>'
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
<!--
|
||||
Fixed kramdown code highlight rendering:
|
||||
https://github.com/penibelst/jekyll-compress-html/issues/101
|
||||
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
|
||||
-->
|
||||
|
||||
{% if _content contains '<pre class="highlight">' %}
|
||||
{% assign _content = _content
|
||||
| replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
|
||||
| replace: '</code></pre></div>', '</code></div>'
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
<!-- Change the icon of checkbox -->
|
||||
{% if _content contains '<input type="checkbox"' %}
|
||||
{% assign _content = _content
|
||||
| replace:
|
||||
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />',
|
||||
'<i class="fas fa-check-circle fa-fw checked"></i>'
|
||||
| replace:
|
||||
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
|
||||
'<i class="far fa-circle fa-fw"></i>'
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
<!-- images -->
|
||||
{% assign IMG_TAG = '<img ' %}
|
||||
|
||||
{% if _content contains IMG_TAG %}
|
||||
{% assign _img_content = nil %}
|
||||
{% assign _img_snippets = _content | split: IMG_TAG %}
|
||||
|
||||
<!-- CDN URL -->
|
||||
{% if site.img_cdn %}
|
||||
{% if site.img_cdn contains '//' %}
|
||||
{% assign _path_prefix = site.img_cdn %}
|
||||
{% else %}
|
||||
{% assign _path_prefix = site.img_cdn | relative_url %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% assign _path_prefix = site.baseurl %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Add image path -->
|
||||
{% if page.img_path %}
|
||||
{% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
|
||||
{% assign _path_prefix = _path_prefix | append: _path %}
|
||||
{% endif %}
|
||||
|
||||
{% for _img_snippet in _img_snippets %}
|
||||
{% if forloop.first %}
|
||||
{% assign _img_content = _img_snippet %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _left = _img_snippet | split: '>' | first %}
|
||||
{% assign _right = _img_snippet | remove: _left %}
|
||||
|
||||
{% unless _left contains 'src=' %}
|
||||
{% continue %}
|
||||
{% endunless %}
|
||||
|
||||
{% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
||||
{% assign _attrs = _left | split: '" ' %}
|
||||
|
||||
{% assign _width = nil %}
|
||||
{% assign _height = nil %}
|
||||
{% assign _lqip = nil %}
|
||||
{% assign _class = nil %}
|
||||
|
||||
{% for _attr in _attrs %}
|
||||
{% unless _attr contains '=' %}
|
||||
{% continue %}
|
||||
{% endunless %}
|
||||
|
||||
{% assign _pair = _attr | split: '="' %}
|
||||
{% capture _key %}{{ _pair | first }}{% endcapture %}
|
||||
{% capture _value %}{{ _pair | last | remove: '"' }}{% endcapture %}
|
||||
|
||||
{% case _key %}
|
||||
{% when 'width' %}
|
||||
{% assign _width = _value %}
|
||||
{% when 'height' %}
|
||||
{% assign _height = _value %}
|
||||
{% when 'src' %}
|
||||
{% assign _src = _value %}
|
||||
{% when 'lqip' %}
|
||||
{% assign _lqip = _value %}
|
||||
{% when 'class' %}
|
||||
{% assign _class = _value %}
|
||||
{% endcase %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- take out classes -->
|
||||
{% if _class %}
|
||||
{% capture _old_class %}class="{{ _class }}"{% endcapture %}
|
||||
{% assign _left = _left | remove: _old_class %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _final_src = nil %}
|
||||
|
||||
{% unless _src contains '//' %}
|
||||
{% assign _final_src = _path_prefix | append: _src %}
|
||||
{% capture _src_from %}"{{ _src }}"{% endcapture %}
|
||||
{% capture _src_to %}"{{ _final_src }}"{% endcapture %}
|
||||
{% assign _left = _left | replace: _src_from, _src_to %}
|
||||
{% endunless %}
|
||||
|
||||
{% if _lqip %}
|
||||
{% unless _lqip contains ':' %}
|
||||
{% assign _final_lqip = _path_prefix | append: _lqip %}
|
||||
{% capture _lqip_from %}"{{ _lqip }}"{% endcapture %}
|
||||
{% capture _lqip_to %}"{{ _final_lqip }}"{% endcapture %}
|
||||
{% assign _left = _left | replace: _lqip_from, _lqip_to %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
<!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
|
||||
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
||||
{% if _left contains 'class=' %}
|
||||
{% assign _left = _left | replace: 'class="', 'class="lazyload '%}
|
||||
{% else %}
|
||||
{% assign _left = _left | append: ' class="lazyload"' %}
|
||||
{% endif %}
|
||||
|
||||
<!-- add image placeholder -->
|
||||
{% if _lqip %}
|
||||
{% assign _left = _left | replace: ' lqip=', ' data-lqip="true" src=' %}
|
||||
{% else %}
|
||||
{% if _width and _height %}
|
||||
<!-- add SVG placehoder -->
|
||||
{%- capture _svg -%}
|
||||
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
||||
{%- endcapture -%}
|
||||
{% assign _left = _svg | append: ' ' | append: _left %}
|
||||
{% assign _class = _class | append: ' shimmer' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Bypass the HTML-proofer test -->
|
||||
{% assign _left = _left | append: ' data-proofer-ignore' %}
|
||||
|
||||
{% if page.layout == 'home' %}
|
||||
<!-- create the image wrapper -->
|
||||
{%- capture _wrapper_start -%}
|
||||
<div class="preview-img {{ _class | strip }}">
|
||||
{%- endcapture -%}
|
||||
{% assign _img_content = _img_content | append: _wrapper_start %}
|
||||
{% assign _right = _right | prepend: '></div' %}
|
||||
|
||||
{% else %}
|
||||
<!-- make sure the `<img>` is wrapped by `<a>` -->
|
||||
{% assign _parent = _right | slice: 1, 4 %}
|
||||
|
||||
{% if _parent == '</a>' %}
|
||||
<!-- add class to exist <a> tag -->
|
||||
{% assign _size = _img_content | size | minus: 1 %}
|
||||
{% capture _class %}
|
||||
class="img-link{% unless _lqip %} shimmer{% endunless %}"
|
||||
{% endcapture %}
|
||||
{% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
|
||||
{% else %}
|
||||
<!-- create the image wrapper -->
|
||||
{%- capture _wrapper_start -%}
|
||||
<a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
|
||||
{%- endcapture -%}
|
||||
{% assign _img_content = _img_content | append: _wrapper_start %}
|
||||
{% assign _right = _right | prepend: '></a' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- combine -->
|
||||
{% assign _img_content = _img_content | append: debug | append: IMG_TAG | append: _left | append: _right %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% if _img_content %}
|
||||
{% assign _content = _img_content %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
<!-- Add header for code snippets -->
|
||||
|
||||
{% if _content contains '<div class="highlight"><code>' %}
|
||||
{% assign _code_spippets = _content | split: '<div class="highlight"><code>' %}
|
||||
{% assign _new_content = '' %}
|
||||
|
||||
{% for _snippet in _code_spippets %}
|
||||
|
||||
{% if forloop.last %}
|
||||
{% assign _new_content = _new_content | append: _snippet %}
|
||||
|
||||
{% else %}
|
||||
|
||||
{% assign _left = _snippet | split: '><' | last%}
|
||||
|
||||
{% if _left contains 'file="' %}
|
||||
{% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
|
||||
{% assign _label_icon = 'far fa-file-code fa-fw' %}
|
||||
{% else %}
|
||||
{% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
|
||||
{% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
|
||||
{% assign _label_icon = 'fas fa-code fa-fw small' %}
|
||||
{% endif %}
|
||||
|
||||
{% capture _label %}
|
||||
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
|
||||
{% endcapture %}
|
||||
|
||||
{% assign _new_content = _new_content | append: _snippet
|
||||
| append: '<div class="code-header">'
|
||||
| append: _label
|
||||
| append: '<button aria-label="copy" data-title-succeed="'
|
||||
| append: site.data.locales[include.lang].post.button.copy_code.succeed
|
||||
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
||||
| append: '<div class="highlight"><code>'
|
||||
%}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% assign _content = _new_content %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
<!-- Create heading anchors -->
|
||||
|
||||
{% assign heading_levels = '2,3,4,5' | split: ',' %}
|
||||
{% assign _heading_content = _content %}
|
||||
|
||||
{% for level in heading_levels %}
|
||||
{% capture mark_start %}<h{{ level }} id="{% endcapture %}
|
||||
{% capture mark_end %}</h{{ level }}>{% endcapture %}
|
||||
|
||||
{% if _heading_content contains mark_start %}
|
||||
{% assign _new_content = nil %}
|
||||
{% assign heading_snippets = _heading_content | split: mark_start %}
|
||||
|
||||
{% for snippet in heading_snippets %}
|
||||
{% if forloop.first %}
|
||||
{% assign _new_content = snippet %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign id = snippet | split: '"' | first %}
|
||||
{% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
|
||||
|
||||
{% assign left = snippet | split: mark_end | first %}
|
||||
{% assign right = snippet | slice: left.size, snippet.size %}
|
||||
{% assign left = left | replace_first: '">', '"><span class="me-2">' | append: '</span>' %}
|
||||
|
||||
{% assign _new_content = _new_content | append: mark_start
|
||||
| append: left | append: anchor | append: right
|
||||
%}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% assign _heading_content = _new_content %}
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign _content = _heading_content %}
|
||||
|
||||
<!-- return -->
|
||||
{{ _content }}
|
||||
@@ -1,104 +0,0 @@
|
||||
<!--
|
||||
Recommend the other 3 posts according to the tags and categories of the current post,
|
||||
if the number is not enough, use the other latest posts to supplement.
|
||||
-->
|
||||
|
||||
<!-- The total size of related posts -->
|
||||
{% assign TOTAL_SIZE = 3 %}
|
||||
|
||||
<!-- An random integer that bigger than 0 -->
|
||||
{% assign TAG_SCORE = 1 %}
|
||||
|
||||
<!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
|
||||
{% assign CATEGORY_SCORE = 0.5 %}
|
||||
|
||||
{% assign SEPARATOR = ':' %}
|
||||
|
||||
{% assign score_list = '' | split: '' %}
|
||||
{% assign last_index = site.posts.size | minus: 1 %}
|
||||
|
||||
{% for i in (0..last_index) %}
|
||||
{% assign post = site.posts[i] %}
|
||||
|
||||
{% if post.url == page.url %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign score = 0 %}
|
||||
|
||||
{% for tag in post.tags %}
|
||||
{% if page.tags contains tag %}
|
||||
{% assign score = score | plus: TAG_SCORE %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% for category in post.categories %}
|
||||
{% if page.categories contains category %}
|
||||
{% assign score = score | plus: CATEGORY_SCORE %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if score > 0 %}
|
||||
{% capture score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %}
|
||||
{% assign score_list = score_list | push: score_item %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign index_list = '' | split: '' %}
|
||||
|
||||
{% if score_list.size > 0 %}
|
||||
{% assign score_list = score_list | sort | reverse %}
|
||||
{% for entry in score_list limit: TOTAL_SIZE %}
|
||||
{% assign index = entry | split: SEPARATOR | last %}
|
||||
{% assign index_list = index_list | push: index %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Fill with the other newlest posts -->
|
||||
{% assign less = TOTAL_SIZE | minus: index_list.size %}
|
||||
|
||||
{% if less > 0 %}
|
||||
{% for i in (0..last_index) %}
|
||||
{% assign post = site.posts[i] %}
|
||||
{% if post.url != page.url %}
|
||||
{% capture cur_index %}{{ i }}{% endcapture %}
|
||||
{% unless index_list contains cur_index %}
|
||||
{% assign index_list = index_list | push: cur_index %}
|
||||
{% assign less = less | minus: 1 %}
|
||||
{% if less <= 0 %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if index_list.size > 0 %}
|
||||
<div id="related-posts" class="mb-2 mb-sm-4">
|
||||
<h3 class="pt-2 mb-4 ms-1" data-toc-skip>
|
||||
{{ site.data.locales[include.lang].post.relate_posts }}
|
||||
</h3>
|
||||
<div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4 mb-4">
|
||||
{% for entry in index_list %}
|
||||
{% assign index = entry | plus: 0 %}
|
||||
{% assign post = site.posts[index] %}
|
||||
<div class="col">
|
||||
<a href="{{ post.url | relative_url }}" class="card post-preview h-100">
|
||||
<div class="card-body">
|
||||
{% include datetime.html date=post.date class="small" lang=include.lang %}
|
||||
<h4 class="pt-0 my-2" data-toc-skip>{{ post.title }}</h4>
|
||||
<div class="text-muted small">
|
||||
<p>
|
||||
{% include no-linenos.html content=post.content %}
|
||||
{{ content | markdownify | strip_html | truncate: 200 | escape }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- .card-deck -->
|
||||
</div>
|
||||
<!-- #related-posts -->
|
||||
{% endif %}
|
||||
@@ -1,45 +0,0 @@
|
||||
<!--
|
||||
Jekyll Simple Search loader
|
||||
See: <https://github.com/christian-fei/Simple-Jekyll-Search>
|
||||
-->
|
||||
|
||||
{% capture result_elem %}
|
||||
<div class="px-1 px-sm-2 px-lg-4 px-xl-0">
|
||||
<a href="{url}">{title}</a>
|
||||
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
|
||||
{categories}
|
||||
{tags}
|
||||
</div>
|
||||
<p>{snippet}</p>
|
||||
</div>
|
||||
{% endcapture %}
|
||||
|
||||
{% capture not_found %}<p class="mt-5">{{ site.data.locales[include.lang].search.no_results }}</p>{% endcapture %}
|
||||
|
||||
<script>
|
||||
/* Note: dependent library will be loaded in `js-selector.html` */
|
||||
SimpleJekyllSearch({
|
||||
searchInput: document.getElementById('search-input'),
|
||||
resultsContainer: document.getElementById('search-results'),
|
||||
json: '{{ '/assets/js/data/search.json' | relative_url }}',
|
||||
searchResultTemplate: '{{ result_elem | strip_newlines }}',
|
||||
noResultsText: '{{ not_found }}',
|
||||
templateMiddleware: function(prop, value, template) {
|
||||
if (prop === 'categories') {
|
||||
if (value === '') {
|
||||
return `${value}`;
|
||||
} else {
|
||||
return `<div class="me-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
if (prop === 'tags') {
|
||||
if (value === '') {
|
||||
return `${value}`;
|
||||
} else {
|
||||
return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,10 +0,0 @@
|
||||
<!-- The Search results -->
|
||||
|
||||
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
|
||||
<div class="col-11 post-content">
|
||||
<div id="search-hints">
|
||||
{% include_cached trending-tags.html %}
|
||||
</div>
|
||||
<div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,104 +0,0 @@
|
||||
<!-- The Side Bar -->
|
||||
|
||||
<div id="sidebar" class="d-flex flex-column align-items-end">
|
||||
<div class="profile-wrapper">
|
||||
<a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
|
||||
{% if site.avatar != empty and site.avatar %}
|
||||
{% capture avatar_url %}
|
||||
{% if site.avatar contains '://' %}
|
||||
{{ site.avatar }}
|
||||
{% elsif site.img_cdn != empty and site.img_cdn %}
|
||||
{{ site.avatar | prepend: site.img_cdn }}
|
||||
{% else %}
|
||||
{{ site.avatar | relative_url }}
|
||||
{% endif %}
|
||||
{% endcapture %}
|
||||
<img src="{{ avatar_url | strip }}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
<div class="site-title">
|
||||
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
|
||||
</div>
|
||||
<div class="site-subtitle fst-italic">{{ site.tagline }}</div>
|
||||
</div>
|
||||
<!-- .profile-wrapper -->
|
||||
|
||||
<ul class="nav flex-column flex-grow-1 w-100 ps-0">
|
||||
<!-- home -->
|
||||
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
|
||||
<a href="{{ '/' | relative_url }}" class="nav-link">
|
||||
<i class="fa-fw fas fa-home"></i>
|
||||
<span>{{ site.data.locales[include.lang].tabs.home | upcase }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- the real tabs -->
|
||||
{% 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>
|
||||
<!-- ul.nav.flex-column -->
|
||||
|
||||
<div class="sidebar-bottom d-flex flex-wrap align-items-center w-100">
|
||||
{% unless site.theme_mode %}
|
||||
<button class="mode-toggle btn" aria-label="Switch Mode">
|
||||
<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 %}
|
||||
{% case entry.type %}
|
||||
{% when 'github', 'twitter' %}
|
||||
{%- capture url -%}
|
||||
https://{{ entry.type }}.com/{{ site[entry.type].username }}
|
||||
{%- endcapture -%}
|
||||
{% when 'email' %}
|
||||
{% 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 -->
|
||||
</div>
|
||||
<!-- #sidebar -->
|
||||
@@ -1,13 +0,0 @@
|
||||
{% assign enable_toc = false %}
|
||||
{% if site.toc and page.toc %}
|
||||
{% if page.content contains '<h2' or page.content contains '<h3' %}
|
||||
{% assign enable_toc = true %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if enable_toc %}
|
||||
<div id="toc-wrapper" class="ps-0 pe-4 mb-5">
|
||||
<div class="panel-heading ps-3 pt-2 mb-2">{{- site.data.locales[include.lang].panel.toc -}}</div>
|
||||
<nav id="toc"></nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -1,70 +0,0 @@
|
||||
<!-- The Top Bar -->
|
||||
|
||||
<div id="topbar-wrapper">
|
||||
<div
|
||||
id="topbar"
|
||||
class="container d-flex align-items-center justify-content-between h-100"
|
||||
>
|
||||
<span id="breadcrumb">
|
||||
{% assign paths = page.url | split: '/' %}
|
||||
|
||||
{% if paths.size == 0 or page.layout == 'home' %}
|
||||
<!-- index page -->
|
||||
<span>{{ site.data.locales[include.lang].tabs.home | capitalize }}</span>
|
||||
|
||||
{% else %}
|
||||
{% for item in paths %}
|
||||
{% if forloop.first %}
|
||||
<span>
|
||||
<a href="{{ '/' | relative_url }}">
|
||||
{{ site.data.locales[include.lang].tabs.home | capitalize }}
|
||||
</a>
|
||||
</span>
|
||||
|
||||
{% elsif forloop.last %}
|
||||
{% if page.collection == 'tabs' %}
|
||||
<span>{{ site.data.locales[include.lang].tabs[item] | default: page.title }}</span>
|
||||
{% else %}
|
||||
<span>{{ page.title }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% elsif page.layout == 'category' or page.layout == 'tag' %}
|
||||
<span>
|
||||
<a href="{{ item | relative_url }}">
|
||||
{{ site.data.locales[include.lang].tabs[item] | default: page.title }}
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</span>
|
||||
<!-- endof #breadcrumb -->
|
||||
|
||||
<i id="sidebar-trigger" class="fas fa-bars fa-fw"></i>
|
||||
|
||||
<div id="topbar-title">
|
||||
{% if page.layout == 'home' %}
|
||||
{{- site.data.locales[include.lang].title | default: site.title -}}
|
||||
{% elsif page.collection == 'tabs' or page.layout == 'page' %}
|
||||
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
|
||||
{{- site.data.locales[include.lang].tabs[tab_key] | default: page.title -}}
|
||||
{% else %}
|
||||
{{- site.data.locales[include.lang].layout[page.layout] | default: page.layout | capitalize -}}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<i id="search-trigger" class="fas fa-search fa-fw"></i>
|
||||
<span id="search-wrapper" class="align-items-center">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
<input
|
||||
class="form-control"
|
||||
id="search-input"
|
||||
type="search"
|
||||
aria-label="search"
|
||||
autocomplete="off"
|
||||
placeholder="{{ site.data.locales[include.lang].search.hint | capitalize }}..."
|
||||
>
|
||||
</span>
|
||||
<span id="search-cancel">{{ site.data.locales[include.lang].search.cancel }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!-- The trending tags list -->
|
||||
|
||||
{% assign MAX = 10 %}
|
||||
|
||||
{% assign size_list = '' | split: '' %}
|
||||
{% assign tag_list = '' | split: '' %}
|
||||
|
||||
{% for tag in site.tags %}
|
||||
{% assign size = tag | last | size %}
|
||||
{% assign size_list = size_list | push: size %}
|
||||
|
||||
{% assign tag_str = tag | first | append: '::' | append: size %}
|
||||
{% assign tag_list = tag_list | push: tag_str %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign size_list = size_list | sort | reverse %}
|
||||
|
||||
{% assign tag_list = tag_list | sort_natural %}
|
||||
|
||||
{% assign trending_tags = '' | split: '' %}
|
||||
|
||||
{% for size in size_list limit: MAX %}
|
||||
{% for tag_str in tag_list %}
|
||||
{% assign tag = tag_str | split: '::' %}
|
||||
{% assign tag_name = tag | first %}
|
||||
{% assign tag_size = tag | last | plus: 0 %}
|
||||
{% if tag_size == size %}
|
||||
{% unless trending_tags contains tag_name %}
|
||||
{% assign trending_tags = trending_tags | push: tag_name %}
|
||||
{% break %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% if trending_tags.size > 0 %}
|
||||
<div id="access-tags">
|
||||
<div class="panel-heading">{{- site.data.locales[include.lang].panel.trending_tags -}}</div>
|
||||
<div class="d-flex flex-wrap mt-3 mb-1 me-3">
|
||||
{% for tag_name in trending_tags %}
|
||||
{% assign url = tag_name | slugify | url_encode | prepend: '/tags/' | append: '/' %}
|
||||
<a class="post-tag btn btn-outline-primary" href="{{ url | relative_url }}">{{ tag_name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -1,39 +0,0 @@
|
||||
<!-- Get the last 5 posts from lastmod list. -->
|
||||
|
||||
{% assign MAX_SIZE = 5 %}
|
||||
|
||||
{% assign all_list = '' | split: '' %}
|
||||
|
||||
{% for post in site.posts %}
|
||||
{% if post.last_modified_at and post.last_modified_at != post.date %}
|
||||
{% capture elem %}
|
||||
{{- post.last_modified_at | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
|
||||
{% endcapture %}
|
||||
{% assign all_list = all_list | push: elem %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign all_list = all_list | sort | reverse %}
|
||||
|
||||
{% assign update_list = '' | split: '' %}
|
||||
|
||||
{% for entry in all_list limit: MAX_SIZE %}
|
||||
{% assign update_list = update_list | push: entry %}
|
||||
{% endfor %}
|
||||
|
||||
{% if update_list.size > 0 %}
|
||||
<div id="access-lastmod" class="post">
|
||||
<div class="panel-heading">{{- site.data.locales[include.lang].panel.lastmod -}}</div>
|
||||
<ul class="post-content list-unstyled ps-0 pb-1 ms-1 mt-2">
|
||||
{% for item in update_list %}
|
||||
{% assign index = item | split: '::' | last | plus: 0 %}
|
||||
{% assign post = site.posts[index] %}
|
||||
{% assign url = post.url | relative_url %}
|
||||
<li class="text-truncate lh-lg">
|
||||
<a href="{{ url }}">{{ post.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<!-- #access-lastmod -->
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user