1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Import the framework.

This commit is contained in:
Cotes Chung
2019-09-30 20:38:41 +08:00
parent 5d0e72d5da
commit b845c829f6
103 changed files with 4640 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<!--
Define the liquid date formats.
© 2019 Cotes Chung
Published under the MIT License
-->
{% assign TOOLTIP_DATE = "%a, %b %e, %Y, %l:%M %p %z" %}
{% assign POST_DATE = "%b %e, %Y" %}

24
_includes/disqus.html Normal file
View File

@@ -0,0 +1,24 @@
<!--
The Disqus lazy loading.
Powered by: https://osvaldas.info/lazy-loading-disqus-comments
© 2019 Cotes Chung
MIT License
-->
<div id="disqus" class="pt-2 pb-4">
<p class="font-italic text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
</div>
<script src="{{ site.baseurl }}/assets/lib/jquery.disqusloader.min.js"></script>
<script>
var options = {
scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js',
disqusConfig: function() {
this.page.url = '{{ site.url | append: site.baseurl | append: page.url }}';
this.page.identifier = '{{ page.url }}';
}
};
$.disqusLoader('#disqus', options);
</script>

34
_includes/favicons.html Normal file
View File

@@ -0,0 +1,34 @@
<!--
The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
Generated by: https://www.favicon-generator.org/
© 2019 Cotes Chung
Published under the MIT license
-->
{% capture icon_url %}{{ site.baseurl }}/assets/img/favicons{% endcapture %}
<link rel="shortcut icon" href="{{ icon_url }}/favicon.ico" type="image/x-icon">
<link rel="icon" href="{{ icon_url }}/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="{{ icon_url }}/apple-icon.png">
<link rel="apple-touch-icon" href="{{ icon_url }}/apple-icon-precomposed.png">
<link rel="apple-touch-icon" sizes="57x57" href="{{ icon_url }}/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="{{ icon_url }}/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="{{ icon_url }}/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="{{ icon_url }}/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="{{ icon_url }}/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="{{ icon_url }}/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="{{ icon_url }}/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="{{ icon_url }}/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="{{ icon_url }}/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="{{ icon_url }}/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{ icon_url }}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="{{ icon_url }}/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ icon_url }}/favicon-16x16.png">
<link rel="manifest" href="{{ icon_url }}/manifest.json">
<meta name='msapplication-config' content='{{ icon_url }}/browserconfig.xml'>
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="{{ icon_url }}/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">

View File

@@ -0,0 +1,9 @@
<!--
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: '<pre class="highlight"><code', '<code' %}
{% assign _content = _content | replace: '</code></pre>', '</code>' %}
{% endif %}

24
_includes/footer.html Normal file
View File

@@ -0,0 +1,24 @@
<!--
The Footer
© 2017-2019 Cotes Chung
MIT License
-->
<footer class="d-flex w-100 justify-content-center">
<div class="d-flex justify-content-between align-items-center">
<div class="copyright">
{% assign first = site.first_run | plus: 0 %}
{% assign last = 'now' | date: "%Y" | plus: 0 %}
<p class="mb-0">
© {% if last > first %}{{ first }}-{% endif %}{{-last-}}
<a href="{{ site.social.links[0] }}" class="ml-1">{{ site.social.name }}</a>.
<br>Powered by <a href="https://jekyllrb.com" target="_blank">Jekyll</a> & <a href="https://github.com/cotes2020/jekyll-theme-chirpy/">Chirpy</a>, hosted on <a href="https://pages.github.com/" target="_blank">GitHub Pages</a>.
</p>
</div>
<div class="license">
<p class="mb-0">
The blog posts on this site are licensed under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
</p>
</div>
</div> <!-- div.d-flex -->
</footer>

View File

@@ -0,0 +1,14 @@
<!--
The GA snippet
© 2017-2019 Cotes Chung
MIT License
-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics.id }}', 'auto');
ga('send', 'pageview');
</script>

53
_includes/head.html Normal file
View File

@@ -0,0 +1,53 @@
<!--
The Head
© 2017-2019 Cotes Chung
MIT License
-->
<head>
<title>
{%- if page.layout == "home" -%}
{{- site.title -}}
{%- else -%}
{{ page.title }} | {{ site.title }}
{%- endif -%}
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% seo title=false %}
{% include favicons.html %}
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
crossorigin="anonymous">
<link rel="stylesheet"
href="{{ site.baseurl }}/assets/css/styles.css">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script>
document.jQuery || document.write('<script src="{{ site.baseurl }}/assets/lib/jquery-3.4.1.min.js"><\/script>');
</script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.15.0/dist/umd/popper.min.js"
integrity="sha256-fTuUgtT7O2rqoImwjrhDgbXTKUwyxxujIMRIK7TbuNU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"
integrity="sha256-5+02zu5UULQkO7w1GIr6vftCgMfFdZcAHeDtFnKZsBs=" crossorigin="anonymous"></script>
<script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script>
{% if jekyll.environment == 'production' %}
{% include google-analytics.html %}
{% endif %}
</head>

72
_includes/panel.html Normal file
View File

@@ -0,0 +1,72 @@
<!--
The Pannel on right side (Desktop views)
© 2017-2019 Cotes Chung
MIT License
-->
<div class="panel-group">
{% assign lastmod_list = "" | split: "" %}
{% for post in site.posts %}
{% if post.date >= post.seo.date_modified or post.seo.date_modified == nil %}
{% continue %}
{% endif%}
{% capture item %}
{{ post.seo.date_modified }}::{{ post.title }}::{{ post.url }}
{% endcapture %}
{% assign lastmod_list = lastmod_list | push: item %}
{% endfor %}
{% if lastmod_list.size > 0 %}
<div id="panel-update" class="post mb-4"">
<h3 data-toc-skip>
{{ site.data.label.panel.lastmod }}
</h3>
<ul class="post-content pl-0 mt-2 pb-1">
{% assign MAX_SIZE = 5 %}
{% assign sum = 0 %}
{% assign sorted_posts = lastmod_list | sort | reverse %}
{% for post in sorted_posts %}
{% assign meta = post | split: "::" %}
<li><a href="{{ meta[2] | prepend: site.baseurl }}">{{ meta[1] }}</a></li>
{% assign sum = sum | plus: 1 %}
{% if sum >= MAX_SIZE %}
{% break %}
{% endif %}
{% endfor %}
</ul>
</div><!-- #panel-update -->
{% endif %}
<div id="panel-tags">
<h3 data-toc-skip>
{{ site.data.label.panel.trending_tags }}
</h3>
<div class="d-flex flex-wrap mt-2 pb-1 pr-3">
{% capture tags_array %}
{% for tag in site.tags %}
{{ tag[1] | size }}:{{ tag[0] | replace: ' ', '-' }}
{% endfor %}
{% endcapture %}
{% assign MAX = 10 %}
{% assign count = 0 %}
{% assign trends = tags_array | split: " " | sort | reverse %}
<div>
<!-- <p>tags_array->{{ tags_array }}</p> -->
{% for trend in trends %}
{% assign count = count | plus: 1 %}
{% assign tag = trend | split: ":" | last %}
<a class="post-tag" href="{{ site.baseurl }}/tags/{{ tag | downcase }}/">{{ tag | replace: '-', ' ' }}</a>
{% if count >= MAX %}
{% break %}
{% endif %}
{% endfor %}
</div>
</div>
</div><!-- #panel-tags -->
</div>

View File

@@ -0,0 +1,15 @@
<!--
The Search results
© 2017-2019 Cotes Chung
MIT License
-->
<div id="search-result-wrap">
<div class="row justify-content-center bg-white">
<div class="col-12 col-md-12 col-lg-11 col-xl-9 pl-xl-5 pr-xl-5 pb-5 mt-3 mb-3">
<h2 class="mt-3 pt-3 ml-3 ml-md-5 ml-lg-0" data-toc-skip>Search Results</h2>
<div class="post-content ml-1 ml-md-5 ml-lg-0">
<ul id="search-results" ></ul>
</div>
</div>
</div>
</div>

13
_includes/search.html Normal file
View File

@@ -0,0 +1,13 @@
<!--
The Search
© 2017-2019 Cotes Chung
MIT License
-->
<script src="{{ site.baseurl }}/assets/lib/simple-jekyll-search-1.7.1.min.js"></script>
<script>
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('search-results'),
json: '{{ site.baseurl }}/search.json'
})
</script>

65
_includes/sidebar.html Normal file
View File

@@ -0,0 +1,65 @@
<!--
The Side Bar
© 2017-2019 Cotes Chung
MIT License
-->
<div id="nav-wrap">
<div id="profile-wrap" class="d-flex justify-content-center">
<div id="profile">
<a href="{{ site.baseurl }}/" alt="profile-photo">
{% assign profile_img = site.logo %}
{% if profile_img | slice: 0 == '/' %}
{% assign profile_img = profile_img | prepend: site.baseurl %}
{% endif %}
<img src="{{ profile_img }}"></img>
</a>
</div>
</div>
<div id="site-title" class="d-flex justify-content-center align-items-center">
<a href="{{ site.baseurl }}/">{{- site.title -}}</a>
</div>
<div id="site-subtitle" class="font-italic">{{ site.description }}</div>
<ul class="nav flex-column">
{% assign page_urls = page.url | split: "/" %}
{% for item in site.data.label.tabs %}
{% assign ref = site.baseurl | append: "/" %}
{% if item.path %}
{% assign ref = ref | append: item.path | append: "/" %}
{% if item.url %}
{% assign ref = ref | append: item.url | append: "/" %}
{% endif %}
{% endif %}
<li class="nav-item d-flex justify-content-center
{% if item.url == page_urls.last or
item.name == "Home" and page.layout == "home" %}active{% endif %}">
<a href="{{ ref }}" class="nav-link d-flex justify-content-center align-items-center w-100"><!-- <i class="{{ item.icon }}"></i> -->
{{ item.name | upcase }}
</a>
</li> <!-- .nav-item -->
{% endfor %}
<span class="cursor"></span>
</ul> <!-- ul.nav.flex-column -->
</div><!-- #nav-wrap -->
<div class="contact d-flex justify-content-around mt-3">
<a href="https://github.com/{{ site.github.username }}" target="_blank">
<i class="fab fa-github"></i>
</a>
<a href="https://twitter.com/{{ site.twitter.username }}" target="_blank">
<i class="fab fa-twitter"></i>
</a>
{% assign email = site.social.email | split: '@' %}
<a href="javascript:window.open('mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@'))">
<i class="fas fa-envelope"></i>
</a>
<a href="{{ site.baseurl }}/feed.xml" target="_blank">
<i class="fas fa-rss"></i>
</a>
</div>

49
_includes/topbar.html Normal file
View File

@@ -0,0 +1,49 @@
<!--
The Top Bar
© 2017-2019 Cotes Chung
MIT License
-->
<div id="topbar" class="bg-white row justify-content-center topbar-down">
<div id="topbar-main" class="d-flex h-100 align-items-center justify-content-between col-12 col-md-12 col-lg-11 col-xl-11 pl-md-2 pr-md-2 pl-lg-2 pr-lg-2">
<span id="breadcrumb">
{% for item in page.breadcrumb %}
{% if item.url %}
<span>
<a href="{{ site.baseurl }}{{ item.url | remove: '.html'}}">
{{ item.label }}
</a>
</span>
{% else %}
<span>{{ item.label }}</span>
{% endif %}
{% endfor %}
{% unless page.layout == "home" %}
<span>{{ page.title }}</span>
{% endunless %}
</span><!-- endof #breadcrumb -->
<i id="sidebar-trigger" class="fas fa-bars fa-fw"></i>
<div id="topbar-title">
{% if page.location %}
{{- page.location -}}
{% elsif page.layout == "home" %}
{{- site.title -}}
{% else %}
{{- page.title -}}
{% endif %}
</div>
<i id="search-trigger" class="fas fa-search fa-fw"></i>
<span id="search-wrap">
<i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search" placeholder="{{ site.data.label.search_hint }}...">
</span>
<a href="javascript:;">Cancel</a>
</div>
</div>