Skip to content

Commit

Permalink
v3
Browse files Browse the repository at this point in the history
  • Loading branch information
geekwen committed Sep 7, 2017
1 parent b16b546 commit 80b4b80
Show file tree
Hide file tree
Showing 32 changed files with 227 additions and 587 deletions.
45 changes: 7 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
## Hexo theme v2: ON THE WAY
## Hexo theme v3: Crude

一个简单的hexo主题

历史主题请查看[releases](https://github.com/geekwen/hexo-theme/releases)。如有需要可自行下载,按照对应的readme说明使用。

## Screenshots

![1](https://raw.githubusercontent.com/geekwen/hexo-theme/master/screenshot/v2/1.jpg)
![1](https://raw.githubusercontent.com/geekwen/hexo-theme/master/screenshot/v3/1.jpg)

![2](https://raw.githubusercontent.com/geekwen/hexo-theme/master/screenshot/v2/2.jpg)

![3](https://raw.githubusercontent.com/geekwen/hexo-theme/master/screenshot/v2/3.jpg)
![2](https://raw.githubusercontent.com/geekwen/hexo-theme/master/screenshot/v3/2.jpg)

## DEMO

Expand All @@ -31,23 +29,16 @@ menu:
# 博客建设时间:显示在页脚
blog_since: 2015
# 网站链接:显示在首页左上角
# 网站链接:显示在左上角
site_url: geekwen.com
# 网站logo链接:显示在首页左上角
# 网站logo链接:显示在左上角
logo_url: /images/logo.png
# 首页正文内容:分别对应第一行和第二行
index_content:
1: 岁 月 静 好
2: 安 然 前 行
# 非首页页面侧边栏内容
# image_number 是侧边栏背景图片数量。侧边栏背景图片在source/images/sidebar-bg下,命名必须为"数字.jpg"
sidebar_content:
1: GEEKWEN
2: .com
image_number: 16
1: Geekwen
2: 一个前端开发工程师的博客
```

### 关闭归档页面的分页功能
Expand Down Expand Up @@ -100,28 +91,6 @@ page_subtitle: "这是关于我的页面"
---
```

### 侧边栏背景图片自定义

给文章/页面添加一个 ```sidebar_bg```。如:

```
title: 关于
date: 2015-10-14 15:33:51
sidebar_bg: /images/sidebar-bg/0.jpg
---
```

如果需要修改侧边栏左下角图片的来源介绍,需要同时填写 ```sidebar_bg```(该图片的地址),```sidebar_bg_src```(该图片的来源地址),```sidebar_bg_info```(图片的介绍)

```
title: 关于
date: 2015-10-14 15:33:51
sidebar_bg: /images/sidebar-bg/0.jpg
sidebar_bg_src: https://unsplash.com
sidebar_bg_info: Photo by unsplash
---
```

### 给站点添加订阅功能

首先安装插件:
Expand Down
15 changes: 4 additions & 11 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@ menu:
# 博客建设时间:显示在页脚
blog_since: 2015

# 网站链接:显示在首页左上角
# 网站链接:显示在左上角
site_url: geekwen.com

# 网站logo链接:显示在首页左上角
# 网站logo链接:显示在左上角
logo_url: /images/logo.png

# 首页正文内容:分别对应第一行和第二行
index_content:
1: 岁 月 静 好
2: 安 然 前 行

# 非首页页面侧边栏内容
# image_number 是侧边栏背景图片数量。侧边栏背景图片在source/images/sidebar-bg下,命名必须为"数字.jpg"
sidebar_content:
1: GEEKWEN
2: .com
image_number: 16
1: Geekwen
2: 一个前端开发工程师的博客
2 changes: 1 addition & 1 deletion layout/archive.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<article>
<h3><a href="<%- url_for(post.path) %>"><%= post.title %></a></h3>
<ul class="post-meta list-inline">
<li>时间:<time><%= date(post.date, 'MM-DD') %></time></li>
<li>时间:<time><%= date(post.date, 'YYYY-MM-DD') %></time></li>
<% if (post.tags && post.tags.length){ %>
<li>
<%- list_tags(post.tags, {
Expand Down
48 changes: 18 additions & 30 deletions layout/index.ejs
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
<header id="masthead">
<div id="home-head">
<% if (theme.logo_url) { %>
<img id="logo" src="<%= theme.logo_url %>" alt="logo">
<% } %>
<% if (theme.site_url) { %>
<%= theme.site_url %>
<% } %>
<br>
<% if (config.subtitle) { %>
<small><%= config.subtitle %></small>
<% } %>
<main id="main-container">
<div id="home-content">
<h1>
<% if (theme.index_content['1']) { %>
<p><%= theme.index_content['1'] %></p>
<% } else {%>
Hello
<% } %>
</h1>
<p>
<% if (theme.index_content['2']) { %>
<p><%= theme.index_content['2'] %></p>
<% } else { %>
This is a blog
<% } %>
</p>
</div>
</header>

<aside id="sidebar">
<nav id="site-nav">
<ul class="list-unstyled">
<ul class="list-inline">
<% for(var key in theme.menu){ %>
<% if (theme.menu.hasOwnProperty(key)){ %>
<% if (theme.menu.hasOwnProperty(key) && key !== '首页'){ %>
<li><a href="<%- theme.menu[key] %>"><%= key %></a></li>
<% } %>
<% } %>
</ul>
</nav>
</aside>

<main id="main-container">
<div id="home-content">
<% if (theme.index_content['1']) { %>
<p><%= theme.index_content['1'] %></p>
<% } %>
<% if (theme.index_content['2']) { %>
<p><%= theme.index_content['2'] %></p>
<% } %>
</div>
</main>

<footer id="mastfoot">
Expand All @@ -47,6 +38,3 @@
<a href="/atom.xml">RSS</a>
</p>
</footer>

<a href="https://unsplash.com" target="_blank" id="image-source" class="align-right hidden-xs"
data-content="Photo from unsplash.com">i</a>
107 changes: 47 additions & 60 deletions layout/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,73 +14,61 @@
<meta http-equiv="x-ua-compatible" content="IE=edge"/>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>

<% if(config.author){ %>
<meta name="author" content="<%= config.author %>">
<% } %>

<% if(config.description){ %>
<meta name="description" content="<%= config.description %>">
<% } %>

<% if(config.keywords){ %>
<meta name="keywords" content="<%= config.keywords %>">
<% } %>

<title>
<% if (title){ %>
<%= title %> |
<% } %>
<%= config.title %></title>
<%= config.title %>
</title>

<% if (is_home()) { %>
<%- css('stylesheets/index.min.css') %>
<% } else { %>
<%- css('stylesheets/style.min.css') %>
<% } %>
</head>
<body>

<% if (is_home()){ %>
<%- body %>
<% }else{ %>
<span id="top"> </span>
<%
var sidebar_bg = '';
if (page.sidebar_bg) {
sidebar_bg = 'style="background-image: url(' + page.sidebar_bg + ')"';
}
%>
<aside id="sidebar" <%- sidebar_bg %>>
<div id="sidebar-overlay">
<div id="sidebar-inner-wrap">
<nav id="site-nav">
<ul class="list-unstyled">
<% for(var key in theme.menu){ %>
<% if (theme.menu.hasOwnProperty(key)){ %>
<li><a href="<%- theme.menu[key] %>"><%= key %></a></li>
<% } %>
<% } %>
</ul>
</nav>
<div id="site-intro">
<p>
<% if (theme.sidebar_content['1']) { %>
<%= theme.sidebar_content['1'] %>
<% } %>
<% if (theme.sidebar_content['2']) { %>
<small><%= theme.sidebar_content['2'] %></small>
<% } %>
</p>
<% if (config.subtitle) { %>
<p><%= config.subtitle %></p>
<% } %>
</div>
</div>
<span id="#"></span>
<% if (page.sidebar_bg && page.sidebar_bg_src && page.sidebar_bg_info) { %>
<a href="<%= page.sidebar_bg_src || '#' %>" target="_blank" id="image-source" class="align-left hidden-xs"
data-content="<%= page.sidebar_bg_info %>">i</a>
<% } else if (!page.sidebar_bg) { %>
<a href="https://unsplash.com" target="_blank" id="image-source" class="align-left hidden-xs"
data-content="Photo from unsplash.com">i</a>
<header id="masthead">
<a href="/">
<% if (theme.logo_url) { %>
<img id="logo" src="<%= theme.logo_url %>" alt="logo">
<% } %>
</div>
</aside>
<% if (theme.site_url) { %>
<%= theme.site_url %>
<% } else { %>
Home
<% } %>
</a>
<nav id="site-nav">
<ul class="list-inline">
<% for(var key in theme.menu){ %>
<% if (theme.menu.hasOwnProperty(key)){ %>
<li><a href="<%- theme.menu[key] %>"><%= key %></a></li>
<% } %>
<% } %>
</ul>
</nav>
</header>
<main id="main-container">
<div id="main-inner-wrap">
Expand All @@ -99,27 +87,26 @@
<%- body %>
</div>
<footer id="mastfoot">
<p>
Powered by <a href="http://www.hexo.io" target="_blank">Hexo</a> |
<a href="https://github.com/geekwen/hexo-theme" target="_blank">Theme</a> by
<a href="http://geekwen.com">Geekwen</a> |
<a href="/atom.xml">RSS</a>
</p>
<% if (theme.blog_since) { %>
<p>Since <%= theme.blog_since %></p>
<% } %>
</footer>
</div>
</main>
<script>
var sidebar = document.getElementById('sidebar');
if (!sidebar.getAttribute('style')) {
sidebar.setAttribute('style', 'background-image: url(/images/sidebar-bg/' + Math.floor(Math.random() * parseInt('<%= theme.sidebar_content.image_number %>')) + '.jpg)');
}
</script>
<% if (!is_home()) { %>
<a id="back-to-top" href="#">TOP</a>
<% } %>
<footer id="mastfoot">
<p>
Powered by <a href="http://www.hexo.io" target="_blank">Hexo</a> |
<a href="https://github.com/geekwen/hexo-theme" target="_blank">Theme</a> by
<a href="http://geekwen.com">Geekwen</a> |
<a href="/atom.xml">RSS</a>
</p>
<% if (theme.blog_since) { %>
<p>Since <%= theme.blog_since %></p>
<% } %>
</footer>
<% } %>

</body>
</html>
Binary file removed source/images/home-bg-xs.jpg
Binary file not shown.
Binary file removed source/images/home-bg.jpg
Binary file not shown.
Binary file modified source/images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed source/images/sidebar-bg/0.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/1.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/10.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/11.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/12.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/13.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/14.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/15.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/2.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/3.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/4.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/5.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/6.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/7.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/8.jpg
Binary file not shown.
Binary file removed source/images/sidebar-bg/9.jpg
Binary file not shown.
2 changes: 1 addition & 1 deletion source/stylesheets/index.min.css

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

0 comments on commit 80b4b80

Please sign in to comment.