Skip to content

Commit

Permalink
feat(INIT): init theme
Browse files Browse the repository at this point in the history
this is my blog new style
  • Loading branch information
KeJunMao committed May 27, 2017
0 parents commit 9b638d6
Show file tree
Hide file tree
Showing 73 changed files with 20,022 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
*.gem
.bundle
.sass-cache
_site
Gemfile.lock
node_modules
.jekyll-metadata
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source "https://rubygems.org"
gem 'jekyll-paginate'
gem 'jekyll-sitemap'
gemspec
21 changes: 21 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
46 changes: 46 additions & 0 deletions README.md
@@ -0,0 +1,46 @@
# jekyll-theme-mdui

A Jekyll theme based on mdui

## Installation

Add this line to your Jekyll site's `Gemfile`:

```ruby
gem "jekyll-theme-mdui"
```

And add this line to your Jekyll site's `_config.yml`:

```yaml
theme: jekyll-theme-mdui
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install jekyll-theme-mdui

## Usage

TODO: Write usage instructions here. Describe your available layouts, includes, and/or sass.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hello. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## Development

To set up your environment to develop this theme, run `bundle install`.

Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.

When your theme is released, only the files in `_layouts`, `_includes`, and `_sass` tracked with Git will be released.

## License

The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

23 changes: 23 additions & 0 deletions _config.yml
@@ -0,0 +1,23 @@
title: "KeJun blog"
description: "A Jekyll theme based on MDUI"
url:
baseurl:
author: "KeJun"
avatar: "https://ooo.0o0.ooo/2017/05/26/5928368d409dd.png"
lang: "zh-CN"
paginate: 5
paginate_path: "/blog/page:num/"

gems:
- jekyll-sitemap
- jekyll-paginate

exclude:
- package.json
- node_modules
- gulpfile.js
- Gemfile
- Gemfile.lock
- jekyll-theme-mdui.gemspec
- LICENSE.txt
- README.md
6 changes: 6 additions & 0 deletions _data/languages.yml
@@ -0,0 +1,6 @@
en:
sidebar:
homepage:
archive:
test:
zh-CN:
9 changes: 9 additions & 0 deletions _data/menus.yml
@@ -0,0 +1,9 @@
- name: HOME
url: /
icon: home
- name: TODO
url: /pages/menus/todo.html
icon: ""
- name: ABOUT
url: /pages/menus/about.html
icon: ""
Empty file added _includes/footer.html
Empty file.
23 changes: 23 additions & 0 deletions _includes/head.html
@@ -0,0 +1,23 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="{{site.author}}">
<link href="https://ooo.0o0.ooo/2017/05/20/59203d43aec1a.png" rel="shortcut icon">
<title>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
<link rel="manifest" href="{{ "/manifest.json" | prepend: site.baseurl }}">
<link rel="preload" href="{{ "/assets/css/mdui.min.css" | prepend: site.baseurl }}" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="{{ "/assets/css/main.css" | prepend: site.baseurl }}" as="style" onload="this.rel='stylesheet'">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/default.min.css">
<noscript><link rel="stylesheet" href="{{ "/assets/css/mdui.min.css" | prepend: site.baseurl }}"></noscript>
<noscript><link rel="stylesheet" href="{{ "/assets/css/main.css" | prepend: site.baseurl }}"></noscript>
<script>
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(a){"use strict";var b=function(b,c,d){function e(a){return h.body?a():void setTimeout(function(){e(a)})}function f(){i.addEventListener&&i.removeEventListener("load",f),i.media=d||"all"}var g,h=a.document,i=h.createElement("link");if(c)g=c;else{var j=(h.body||h.getElementsByTagName("head")[0]).childNodes;g=j[j.length-1]}var k=h.styleSheets;i.rel="stylesheet",i.href=b,i.media="only x",e(function(){g.parentNode.insertBefore(i,c?g:g.nextSibling)});var l=function(a){for(var b=i.href,c=k.length;c--;)if(k[c].href===b)return a();setTimeout(function(){l(a)})};return i.addEventListener&&i.addEventListener("load",f),i.onloadcssdefined=l,l(f),i};"undefined"!=typeof exports?exports.loadCSS=b:a.loadCSS=b}("undefined"!=typeof global?global:this);
/*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */
!function(a){if(a.loadCSS){var b=loadCSS.relpreload={};if(b.support=function(){try{return a.document.createElement("link").relList.supports("preload")}catch(b){return!1}},b.poly=function(){for(var b=a.document.getElementsByTagName("link"),c=0;c<b.length;c++){var d=b[c];"preload"===d.rel&&"style"===d.getAttribute("as")&&(a.loadCSS(d.href,d,d.getAttribute("media")),d.rel=null)}},!b.support()){b.poly();var c=a.setInterval(b.poly,300);a.addEventListener&&a.addEventListener("load",function(){b.poly(),a.clearInterval(c)}),a.attachEvent&&a.attachEvent("onload",function(){a.clearInterval(c)})}}}(this);
</script>
</head>
22 changes: 22 additions & 0 deletions _includes/header.html
@@ -0,0 +1,22 @@
<header mdui-headroom class="mdui-appbar mdui-shadow-0 mdui-appbar-fixed mdui-color-white">
<div class="mdui-toolbar">
<a href="javascript:;" class="mdui-btn mdui-btn-icon mdui-hidden-sm-up" mdui-drawer="{target: '#k-menu'}"><i class="mdui-icon material-icons">&#xe5d2;</i></a>
<a href="{{site.url}}" class="mdui-typo-title">{{site.title |upcase }}</a>
<div class="mdui-toolbar-spacer"></div>
<div class="mdui-hidden-xs-down">
{% for menu in site.data.menus %}
<a href="{{menu.url}}" class="mdui-btn {% if menu.url == page.url %}mdui-list-item-active{% endif %}">{{menu.name}}</a>
{% endfor %}
</div>
</div>
</header>
<div class="mdui-drawer mdui-drawer-close" id="k-menu">
<ul class="mdui-list">
{% for menu in site.data.menus %}
<a href="{{menu.url}}" class="mdui-list-item mdui-ripple {% if menu.url == page.url %}mdui-list-item-active{% endif %}">
<i class="mdui-list-item-icon mdui-icon material-icons">{{menu.icon}}</i>
<div class="mdui-list-item-content">{{menu.name}}</div>
</a>
{% endfor %}
</ul>
</div>
2 changes: 2 additions & 0 deletions _includes/main.html
@@ -0,0 +1,2 @@
{{content}}
<button id="toTop" style="display:none;" mdui-headroom="{unpinnedClass:'k-mdui-headroom-unpinned-top'}" class="mdui-fab mdui-color-white mdui-fab-fixed mdui-ripple"><i class="mdui-icon material-icons">expand_less</i></button>
55 changes: 55 additions & 0 deletions _includes/script.html
@@ -0,0 +1,55 @@
<script src="{{ "/assets/js/main.js" | prepend: site.baseurl }}"></script>
<script src="{{ "/assets/js/mdui.min.js" | prepend: site.baseurl }}"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="{{ "/assets/js/jquery.scrollToTop.js" | prepend: site.baseurl }}"></script>

<script>
$(function(){
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register("{{ "/sw.js" | relative_url }}").then(function() {
console.log("Service Worker Registered");
});
}
Array.prototype.forEach.call(document.querySelectorAll(".mdui-card-media"), function(a) {
var b = a.querySelector("a");
if (!b) {
return
}
var c = b.getAttribute("href");
if (!c) {
return
}
a.addEventListener("click", function() {
location.href = c
})
});
$("#toTop").scrollToTop();
})
</script>

{% if page.layout == "post" %}
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/highlight.min.js"></script>
<script src="{{ "/assets/js/toc.min.js" | prepend: site.baseurl }}"></script>
<script src="{{ "/assets/js/pushpin.js" | prepend: site.baseurl }}"></script>
<script>
$(function(){
$("div.k-page-col").css('margin',0);
hljs.initHighlightingOnLoad();
$('#toc').toc({
'selectors': 'h2',
'prefix': 'toc',
'highlightOffset': 64
});
$("#toc").find("ul").fadeIn(1000);
var tocBottom = $('.mdui-card-content').offset().top + $('.mdui-card-content').height() - $('#toc-card').height();
var tocOffset = $('.k-post-media').offset().top;
var tocTop = $('.mdui-card-header').offset().top;
$('#toc-card').pushpin({
top: tocTop,
bottom: 99999,
offset: tocOffset
});
})

</script>
{% endif %}
3 changes: 3 additions & 0 deletions _includes/toc.html
@@ -0,0 +1,3 @@
<div id="toc-card" class="mdui-card mdui-shadow-0">
<div id="toc"></div>
</div>
10 changes: 10 additions & 0 deletions _layouts/compress.html
@@ -0,0 +1,10 @@
---
# Jekyll layout that compresses HTML
# v3.0.2
# http://jch.penibelst.de/
# © 2014–2015 Anatol Broder
# MIT License
---

{% capture _LINE_FEED %}
{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd p rt rp optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}</{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "<!-- -->" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "<pre" %}{% assign _content = "" %}{% for _pre_before in _pre_befores %}{% assign _pres = _pre_before | split: "</pre>" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "</pre>" %}<pre{{ _pres.first }}</pre>{% endif %}{% unless _pre_before contains "</pre>" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " <e;<e; </e>;</e>;</e> ;</e>" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %} <table id="compress_html_profile_{{ site.time | date: "%Y%m%d" }}" class="compress_html_profile"> <thead> <tr> <td>Step <td>Bytes <tbody> <tr> <td>raw <td>{{ content | size }}{% if _profile_endings %} <tr> <td>endings <td>{{ _profile_endings }}{% endif %}{% if _profile_startings %} <tr> <td>startings <td>{{ _profile_startings }}{% endif %}{% if _profile_comments %} <tr> <td>comments <td>{{ _profile_comments }}{% endif %}{% if _profile_collapse %} <tr> <td>collapse <td>{{ _profile_collapse }}{% endif %}{% if _profile_clippings %} <tr> <td>clippings <td>{{ _profile_clippings }}{% endif %} </table>{% endif %}{% endif %}
13 changes: 13 additions & 0 deletions _layouts/default.html
@@ -0,0 +1,13 @@
---
layout: compress
---
<!DOCTYPE html>
<html lang="{{site.lang}}">
{% include head.html %}
<body class="mdui-appbar-with-toolbar mdui-theme-primary-white mdui-theme-accent-blue">
{% include header.html %}
{% include main.html %}
{% include footer.html %}
{% include script.html %}
</body>
</html>
51 changes: 51 additions & 0 deletions _layouts/home.html
@@ -0,0 +1,51 @@
---
layout: default
---
<div class="k-container">
<div class="k-posts-list">
{% for post in paginator.posts %}
<div class="mdui-card k-list-card mdui-shadow-1">
<div class="mdui-card-media k-post-media" style="background-image: url({{post.img}});">
<div class="mdui-card-media-covered mdui-card-media-covered-gradient">
<div class="mdui-card-primary">
<div class="mdui-card-primary-title"><a class="mdui-text-color-white-text" href="{{post.url}}">{{post.title}}</a></div>
</div>
</div>
</div>
<div class="mdui-card-content mdui-text-color-black-secondary">
{{ post.excerpt | strip_html}} <a class="mdui-typo" href="{{post.url}}">阅读更多</a>
</div>
<div class="mdui-divider"></div>
<div class="mdui-card-header">
<img class="mdui-card-header-avatar" src="{{site.avatar}}" />
<div class="mdui-card-header-title">{{site.author}}</div>
<div class="mdui-card-header-subtitle">{{ post.date | date: "%b %-d, %Y" }}</div>
</div>
</div>
{% endfor %}
</div>
{% if paginator.total_pages > 1 %}
<div class="mdui-row-xs-3">
<div class="mdui-col">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}" class="mdui-btn mdui-btn-icon "><i class="mdui-icon material-icons">arrow_back</i></a>
{% else %}
<button disabled class="mdui-btn mdui-btn-icon "><i class="mdui-icon material-icons">arrow_back</i></button>
{% endif%}
</div>

<div class="mdui-col mdui-text-center">
<p style="width:100%">{{paginator.page}}/{{paginator.total_pages}}</p>
</div>

<div class="mdui-col">
{% if paginator.next_page %}
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}" class="mdui-btn mdui-btn-icon mdui-float-right"><i class="mdui-icon material-icons">arrow_forward</i></a>
{% else %}
<button disabled class="mdui-btn mdui-btn-icon mdui-float-right"><i class="mdui-icon material-icons">arrow_forward</i></button>
{% endif %}
</div>

</div>
</div>
{% endif %}
5 changes: 5 additions & 0 deletions _layouts/page.html
@@ -0,0 +1,5 @@
---
layout: default
---

{{ content }}
31 changes: 31 additions & 0 deletions _layouts/post.html
@@ -0,0 +1,31 @@
---
layout: default
---
<div class="mdui-container">
<div class="k-posts-list"></div>
<div class="mdui-row">
<div class="mdui-col-sm-12 k-page-col mdui-col-md-9">
<div class="mdui-card">
<div class="mdui-card-media k-post-media" style="background-image: url({{page.img}});">
<div class="mdui-card-media-covered mdui-card-media-covered-gradient">
<div class="mdui-card-primary">
<div class="mdui-card-primary-title"><a class="mdui-text-color-white-text" href="{{post.url}}">{{page.title}}</a></div>
</div>
</div>
</div>
<div class="mdui-card-header">
<img class="mdui-card-header-avatar" src="{{site.avatar}}" />
<div class="mdui-card-header-title">{{site.author}}</div>
<div class="mdui-card-header-subtitle">{{ page.date | date: "%b %-d, %Y" }}</div>
</div>
<div class="mdui-card-content mdui-typo">
{{ content }}
</div>
</div>
</div>
<div class="mdui-col-md-3 mdui-hidden-sm-down">
{% include toc.html %}
</div>
</div>
<br>
</div>

0 comments on commit 9b638d6

Please sign in to comment.