Skip to content

Commit

Permalink
Add pure theme
Browse files Browse the repository at this point in the history
  • Loading branch information
emosher committed Jun 5, 2016
1 parent 76a841e commit f3bb1ac
Show file tree
Hide file tree
Showing 32 changed files with 847 additions and 0 deletions.
66 changes: 66 additions & 0 deletions themes/pure/README.md
@@ -0,0 +1,66 @@
# Pure

A responsive pure theme for [Hexo](http://hexo.io/).

- Based on [Landscape](https://github.com/hexojs/hexo-theme-landscape/)
- Powered by [Pure.css](http://purecss.io/)
- [Preview](http://purecss.io/layouts/blog/)

## Installation

### Install

``` bash
git clone https://github.com/saintwinkle/hexo-theme-pure.git themes/pure
```

I use `jade` instead of `ejs`, so don't forget to:
```
npm install hexo-renderer-jade --save
```

### Enable

- Modify `theme` setting in `_config.yml` to `pure`.
- Modify `pagination` settings for `archive`, `category` and `tag` in `_config.yml`.

### Update

``` bash
cd themes/pure
git pull
```

## Configuration

``` yml
title: Pure # site title
author: Twinkle # your name
description: Creating a blog layout using Pure # description or subtitle
email: # used for gravatar

# if you copy an avatar file to ./source folder,
# just uncomment the variable below,
# and replace "avatar.png" to your image name.
# better to use 48x48 pixels.
#avatar: avatar.png

# menu buttons in header
menu:
archives: /archives
about: /about

# comments system
# disqus always goes first once configured
disqus_shortname:
duoshuo_shortname:

# social links
weibo: # id but not nickname, example: levicorpus / 1997375853
github: # username, example: saintwinkle
gplus: # google+ id, don't forget symbol "+", example: +周一
twitter: # username, example: saintwinkle

# google analytics, example: UA-12345678-1
google_analytics:
```
29 changes: 29 additions & 0 deletions themes/pure/_config.yml
@@ -0,0 +1,29 @@
title: emosher # site title
author: Eric Mosher # your name
description: Geek, coder/developer, musician, gamer. # description or subtitle
email: emoshmosh@gmail.com # used for gravatar

# if you copy an avatar file to ./source folder,
# just uncomment the variable below,
# and replace "avatar.png" to your image name.
# better to use 48x48 pixels.
#avatar: avatar.png

# menu buttons in header
menu:
archives: /archives
about: /about

# comments system
# disqus always goes first once configured
disqus_shortname:
duoshuo_shortname:

# social links
weibo: # id but not nickname, example: levicorpus / 1997375853
github: emosher # username, example: saintwinkle
gplus: # google+ id, don't forget symbol "+", example: +周一
twitter: emoshmosh # username, example: saintwinkle

# google analytics, example: UA-12345678-1
google_analytics:
23 changes: 23 additions & 0 deletions themes/pure/layout/_partial/after-footer.jade
@@ -0,0 +1,23 @@
!=js('js/script')
if theme.disqus_shortname
script.
var disqus_shortname = '#{theme.disqus_shortname}';
(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);
})();
noscript.
Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
else if theme.duoshuo_shortname
script.
var duoshuoQuery = {short_name: '#{theme.duoshuo_shortname}'};
(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);
})();
!=partial('ga')
10 changes: 10 additions & 0 deletions themes/pure/layout/_partial/archive-post.jade
@@ -0,0 +1,10 @@
h2.archive-post-title
!=partial('post/title')
p.archive-post-meta
!=partial('post/date', {date_format: 'MM-DD HH:mm'})
!=partial('post/category')
!=partial('post/tag')
if post.link
a(href!=url_for(post.link) target="_blank")
else
a(href!=url_for(post.path))
20 changes: 20 additions & 0 deletions themes/pure/layout/_partial/archive.jade
@@ -0,0 +1,20 @@
if pagination == 2
- page.posts.each(function (post) {
!=partial('article', {post: post, index: true})
- })
else
- var last
- page.posts.each(function (post) {
- var year = post.date.year()
if last != year
if last != null
- last = year
h1.archive-year
a(href!=url_for('archives/' + year))
=year
.archive-post
!=partial('archive-post', {post: post})
- })
if page.total > 1
nav#page-nav
!=paginator({prev_text: '&laquo; Prev', next_text: 'Next &raquo;'})
26 changes: 26 additions & 0 deletions themes/pure/layout/_partial/article.jade
@@ -0,0 +1,26 @@
.post
.post-header
!=partial('post/avatar')
if post.link || post.title
h2.post-title
!=partial('post/title')
p.post-meta
!=partial('post/date', {date_format: 'YYYY-MM-DD HH:mm'})
!=partial('post/category')
!=partial('post/tag')
.post-content
!=partial('post/gallery')
if post.excerpt && index
!=post.excerpt
if theme.excerpt_link
p.post-excerpt-link
a(href!=url_for(post.path) + "#more") #{theme.excerpt_link}
else
!=post.content
if !index
!=partial('post/nav')
if !index && post.comments
if theme.disqus_shortname
#disqus_thread
else if theme.duoshuo_shortname
.ds-thread(data-thread-key="#{post.layout}-#{post.slug}" data-title=post.title data-url=post.permalink)
13 changes: 13 additions & 0 deletions themes/pure/layout/_partial/footer.jade
@@ -0,0 +1,13 @@
.social-link
a(href="http://weibo.com/" + (theme.weibo ? theme.weibo : "") target="_blank")
i.icon-weibo
a(href="https://github.com/" + (theme.github ? theme.github : "") target="_blank")
i.icon-github
a(href="https://plus.google.com/" + (theme.gplus ? theme.gplus : "") target="_blank")
i.icon-gplus
a(href="https://twitter.com/" + (theme.twitter ? theme.twitter : "") target="_blank")
i.icon-twitter
.copyright
| &copy; #{date(new Date(), 'YYYY')} #{theme.author}.
| Powered by <a href="http://hexo.io" target="_blank">Hexo</a>
| using <a href="https://github.com/saintwinkle/hexo-theme-pure" target="_blank">Pure</a> theme.
8 changes: 8 additions & 0 deletions themes/pure/layout/_partial/ga.jade
@@ -0,0 +1,8 @@
if theme.google_analytics
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','//www.google-analytics.com/analytics.js','ga');
ga('create', '#{theme.google_analytics}', 'auto');
ga('send', 'pageview');
4 changes: 4 additions & 0 deletions themes/pure/layout/_partial/head.jade
@@ -0,0 +1,4 @@
meta(charset="utf-8")
meta(name="viewport" content="width=device-width, initial-scale=1.0")
title #{theme.title}
!=css(['css/pure-min.css', 'css/grids-responsive-min.css', 'css/style.css'])
8 changes: 8 additions & 0 deletions themes/pure/layout/_partial/header.jade
@@ -0,0 +1,8 @@
h1.brand-title
a(href!=url_for()) #{theme.title}
h2.brand-tagline #{theme.description}
nav.nav
ul.nav-list
each path, name in theme.menu
li.nav-item
a.pure-button(href!=url_for(path)) #{name}
4 changes: 4 additions & 0 deletions themes/pure/layout/_partial/post/avatar.jade
@@ -0,0 +1,4 @@
if theme.avatar
img.post-avatar(height="48" width="48" src!=url_for(theme.avatar))
else if theme.email
img.post-avatar(height="48" width="48" src!=gravatar(theme.email, 48))
6 changes: 6 additions & 0 deletions themes/pure/layout/_partial/post/category.jade
@@ -0,0 +1,6 @@
if (post.categories && post.categories.length)
span.post-categories
i.icon-book
- post.categories.each(function (category) {
a.post-category(href!=url_for(category.path)) #{category.name}
- })
3 changes: 3 additions & 0 deletions themes/pure/layout/_partial/post/date.jade
@@ -0,0 +1,3 @@
span.post-date
i.icon-clock
| #{date(post.date, date_format)}
7 changes: 7 additions & 0 deletions themes/pure/layout/_partial/post/gallery.jade
@@ -0,0 +1,7 @@
if post.photos && post.photos.length
.post-gallery
.post-gallery-photos
- post.photos.forEach(function (photo) {
a.post-gallery-img(href!=url_for(photo))
img(src!=url_for(photo))
- })
18 changes: 18 additions & 0 deletions themes/pure/layout/_partial/post/nav.jade
@@ -0,0 +1,18 @@
if post.prev || post.next
nav#post-nav
if post.prev
a#post-nav-newer.post-nav-link-wrap(href!=url_for(post.prev.path))
strong.post-nav-caption Newer
.post-nav-title
if post.prev.title
=post.prev.title
else
|(no title)
if post.next
a#post-nav-older.post-nav-link-wrap(href!=url_for(post.next.path))
strong.post-nav-caption Older
.post-nav-title
if post.next.title
=post.next.title
else
|(no title)
6 changes: 6 additions & 0 deletions themes/pure/layout/_partial/post/tag.jade
@@ -0,0 +1,6 @@
if (post.tags && post.tags.length)
span.post-tags
i.icon-tags
- post.tags.each(function (tag) {
a.post-tag(href!=url_for(tag.path)) #{tag.name}
- })
10 changes: 10 additions & 0 deletions themes/pure/layout/_partial/post/title.jade
@@ -0,0 +1,10 @@
if post.link
a(href!=url_for(post.link) target="_blank") #{post.title}
else
if post.title
if index
a(href!=url_for(post.path)) #{post.title}
else
=post.title
else
a(href!=url_for(post.path)) (no title)
1 change: 1 addition & 0 deletions themes/pure/layout/archive.jade
@@ -0,0 +1 @@
!=partial('_partial/archive', {pagination: config.archive, index: true})
1 change: 1 addition & 0 deletions themes/pure/layout/category.jade
@@ -0,0 +1 @@
!=partial('_partial/archive', {pagination: config.category, index: true})
1 change: 1 addition & 0 deletions themes/pure/layout/index.jade
@@ -0,0 +1 @@
!=partial('_partial/archive', {pagination: 2, index: true})
15 changes: 15 additions & 0 deletions themes/pure/layout/layout.jade
@@ -0,0 +1,15 @@
doctype html
html
head
!=partial('_partial/head')
body
#layout.pure-g
.sidebar.pure-u-1.pure-u-md-1-4
.header
!=partial('_partial/header')
.content.pure-u-1.pure-u-md-3-4
.posts
!=body
.footer
!=partial('_partial/footer')
!=partial('_partial/after-footer')
1 change: 1 addition & 0 deletions themes/pure/layout/page.jade
@@ -0,0 +1 @@
!=partial('_partial/article', {post: page, index: false})
1 change: 1 addition & 0 deletions themes/pure/layout/post.jade
@@ -0,0 +1 @@
!=partial('_partial/article', {post: page, index: false})
1 change: 1 addition & 0 deletions themes/pure/layout/tag.jade
@@ -0,0 +1 @@
!=partial('_partial/archive', {pagination: config.tag, index: true})
7 changes: 7 additions & 0 deletions themes/pure/source/css/grids-responsive-min.css

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

11 changes: 11 additions & 0 deletions themes/pure/source/css/pure-min.css

Large diffs are not rendered by default.

0 comments on commit f3bb1ac

Please sign in to comment.