Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Commit

Permalink
put v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YuYanDev committed Oct 29, 2016
1 parent f5f88b8 commit 9668c78
Show file tree
Hide file tree
Showing 17 changed files with 265 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# hexo-theme-mbxo
A hexo moblie theme base on mobi.css

A hexo mobile theme base on mobi.css

[Demo](https://alleysakura.github.io/hexo-theme-mbxo)

# Install
---
```
npm install --save hexo-renderer-jade hexo-generator-feed hexo-generator-sitemap hexo-browsersync
git clone https://github.com/pinggod/hexo-theme-mbxo.git themes/mbxo
```

# Tips
---
If you dislike the font color.You can fix the font color in `themes/mbxo/source/mobi.min.css` the`a{color:#00bcd4;`.

If you want directed to the mobile version.You can try device.js [https://github.com/matthewhudson/device.js](https://github.com/matthewhudson/device.js)

# License
---
MIT
20 changes: 20 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
menu:
Home: /
Links: /Links
GitHub: https://github.com/
About: /About
Rss: /atom.xml

favicon: /favicon.icon
logo: /favicon.icon

# Comment
disqus:
duoshuo:

# Analytics
# google-analytics:
ga:

# Copyright Infomation
startyear: 2016
3 changes: 3 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');

5 changes: 5 additions & 0 deletions languages/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
prev: 上一页
next: 下一页
prev_post: 上一篇
next_post: 下一篇
more: 更多
12 changes: 12 additions & 0 deletions layout/archive.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends partial/layout

block container
include mixins/post
+postList()

block pagination
include mixins/paginator
+home()

block copyright
include partial/copyright
12 changes: 12 additions & 0 deletions layout/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends partial/layout

block container
include mixins/post
+posts()

block pagination
include mixins/paginator
+home()

block copyright
include partial/copyright
23 changes: 23 additions & 0 deletions layout/mixins/paginator.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mixin home()
- var prev = page.prev_link
- var next = page.next_link
hr
.flex-center.top-gap
if page.prev
.unit.site-box
a(href=url_for(prev))!= __('prev')
if page.next
.unit.site-box
a(href=url_for(next))!= __('next')

mixin post()
- var prev = page.prev ? page.prev.path : false;
- var next = page.next ? page.next.path : false;
hr
.flex-center.top-gap
if prev
.unit.site-box
a(href=url_for(prev))!= __('prev_post')
if next
.unit.site-box
a(href=url_for(next))!= __('next_post')
44 changes: 44 additions & 0 deletions layout/mixins/post.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
mixin postInfo(item)
h5
!= full_date(item.date, 'll')
if item.from && (is_home() || is_post())
a(href=item.from target="_blank" title=item.from) 翻译 · 原文地址

//- Index Page
mixin posts()
- page.posts.each(function (item) {
h3
a(href= url_for(item.path))
!= item.title
div
- })

//- Archive Page
mixin postList()
.archive
- var year = 0;
- var change = false;
- page.posts.each(function (item) {
- var itemYear = date(item.date, 'YYYY') - 0;
- change = year !== itemYear;
- year = change ? itemYear : year;
if change
h6.archive-year!= year
hr
div
h2
a(href= url_for(item.path))
!= item.title
+postInfo(item)
br
- })

//- Post Page
mixin post(item)
.post
article
h1
!= item.title
+postInfo(item)
div
!= item.content
27 changes: 27 additions & 0 deletions layout/partial/comment.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
if theme.duoshuo
.ds-thread(data-thread-key=page.path, data-title=page.title, data-url=page.permalink, data-author-key='1')
script.
var duoshuoQuery = {short_name:"#{theme.duoshuo}"};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();


if theme.disqus
#disqus_thread
script.
var disqus_shortname = '#{theme.disqus}';
var disqus_identifier = '#{page.path}';
var disqus_title = '#{page.title}';
var disqus_url = '#{config.url}/#{page.path}';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
script(id='dsq-count-scr' src='//#{theme.disqus}.disqus.com/count.js' async)
9 changes: 9 additions & 0 deletions layout/partial/copyright.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
br
hr
.copyright
- var hexoURL = "https://hexo.io/";
- var mobiURL = "http://getmobicss.com/";
- var currentDate = new Date();
- var year = currentDate.getFullYear();
- year = year == theme.startyear ? year : theme.startyear + ' - ' + year;
p © #{year} Base on #[a(href=hexoURL, target="_blank") Hexo] and #[a(href=mobiURL, target="_blank") Mobi.css].
16 changes: 16 additions & 0 deletions layout/partial/head.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
meta(charset="utf-8")
meta(name="X-UA-Compatible", content="IE=edge")

title
block site_title
= config.title
block description
meta(name="description", content= config.description ? config.description : 'A Blog Powered By Hexo')

meta(name="viewport", content="width=device-width, initial-scale=1")
meta(name="theme-color" content="#00bcd4")
link(rel="short icon", href=url_for(theme.favicon))
link(rel="stylesheet", href=url_for("mobi.min.css"))

- var xml = config.url + '/atom.xml'
link(rel="search", type="application/opensearchdescription+xml", href=xml, title=config.title)
16 changes: 16 additions & 0 deletions layout/partial/layout.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
doctype
html(lang=config.language)
head
include head
body
br
.flex-center
.container
header.theme-header
include nav
article
block container
footer
block pagination
block copyright
include scripts
8 changes: 8 additions & 0 deletions layout/partial/nav.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.flex-left.top-gap
each value, key in theme.menu
.unit.site-box
- var re = /^(http|https):\/\/*/gi;
- var tar = re.test(value) ? "_blank" : "_self"
a(class={active: is_home() && value === "/"} href=value target=tar)
!= key.toUpperCase()
hr
Empty file added layout/partial/scripts.jade
Empty file.
20 changes: 20 additions & 0 deletions layout/post.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends partial/layout

block site_title
!= page.title + " · " + config.title

block description
- var desc = page.desc || page.title + ' - ' + config.author;
meta(name="description", content=desc)

block container
include mixins/post
+post(page)

block pagination
include mixins/paginator
+post()
include partial/comment

block copyright
include partial/copyright
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "hexo-theme-mbxo",
"version": "1.0.0",
"description": "A hexo mobile theme base on mobi.css",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/Alleysakura/hexo-theme-mbxo"
},
"keywords": [
"hexo",
"theme",
"mbxo"
],
"author": "SakaraHiroya",
"license": "MIT",
"bugs": {
"url": "https://github.com/Alleysakura/hexo-theme-mbxo/issues"
},
"homepage": "https://github.com/Alleysakura/hexo-theme-mbxo",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.0.2",
"gulp-sass": "^2.0.4",
"gulp-sourcemaps": "^1.6.0"
}
}
2 changes: 2 additions & 0 deletions source/mobi.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9668c78

Please sign in to comment.