Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
yiichou committed Sep 9, 2016
0 parents commit 03cda94
Show file tree
Hide file tree
Showing 22 changed files with 855 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.swp
*~
.DS_Store
.sass-cache
20 changes: 20 additions & 0 deletions LICENSE.md
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2014 Ivan Chou

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.
75 changes: 75 additions & 0 deletions README.md
@@ -0,0 +1,75 @@
# Vec

Vec is a minimal, clean and beautiful theme for [Hugo](http://gohugo.io/).

![Vec screenshot](https://github.com/IvanChou/hugo-theme-vec/blob/master/images/screenshot.png)

[Demo](http://yii.im).

## Installation

```
mkdir themes
cd themes
git clone https://github.com/IvanChou/hugo-theme-vec vec
```

See the [official docs](http://gohugo.io/themes/installing) for more information.

## Configuration
You could add `params` into your site's `config.toml` file:

```
[params]
Keywords = "key, 关键字, キーワード"
Description = "There is some words to describe your site"
Avater = "//chou.oss-cn-hangzhou.aliyuncs.com/yii.im/avatar.jpg"
SelfIntro = "Just a worm, seek for true, live in shadow, no more..."
GithubID = "Your Github ID"
TwitterID = "Your Twitter ID"
FacebookID = "Your Facebook ID"
LinkedInID = "Your LinkedIn ID"
GoogleplusID = "Your Googleplus ID"
AnalyticsID = "Your Google Analytics tracking code"
DisqusID = "Your Disqus shortname"
```

If you use `config.yaml`, plz reformat them to yaml.

### Enable Disqus to your post

1. Add your Disqus Shortname to the site config file;
2. You can enable Disqus per-post, by adding `comments: true` (YAML) or `comments = true` (TOML) in the front matter of your post. To disable it, you can either change the value to `false` or just not include `comments` variable and its value at all.

### Enable TOC to your post

If you need show table of contents per-post, adding `toc: true` (YAML) or `toc = true` (TOML) in the front matter of your post.

Please notice that TOC will be hidden when browser width is less than 920px.

## Build your site

Add `theme = "vec"` to your `config.toml`, then

```
# Build
hugo
# Run a server
hugo server
```
OR

```
hugo -t vec
hugo server -t vec
```


## License

Open sourced under [MIT license](https://github.com/IvanChou/hugo-theme-vec/blob/master/LICENSE.md).


6 changes: 6 additions & 0 deletions archetypes/default.md
@@ -0,0 +1,6 @@
+++
toc = false
draft = true
comments = false
slug = ""
+++
Binary file added images/screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tn.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions layouts/_default/list.html
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">

<head>
<title> {{ .Title }} &middot; {{ .Site.Title }} </title>

{{ partial "head.html" . }}
</head>

<body>

{{ partial "header.html" . }}
<div class="content">
<section class="posts">
{{ $paginator := .Paginate (.Data.Pages.GroupByDate "2006-01") 20 }}
{{ range $paginator.PageGroups }}
<div class="posts-archive">
{{ $month := (print .Key "-01") }}
<time class="posts-archive-month" datetime="{{ $month }}">{{ dateFormat "Jan 2006" $month }}</time>
<ol class="posts-list">
{{ range .Pages }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ol>
</div>
{{ end }}
</section>
{{ partial "pagination.html" . }}
</div>

{{ partial "footer.html" . }}

{{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }}

</body>

</html>
44 changes: 44 additions & 0 deletions layouts/_default/single.html
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>

<head>
<title> {{ .Title }} &middot; {{ .Site.Title }} </title>

{{ partial "head.html" . }}
</head>

<body>
{{ partial "header.html" . }}
<div class="content">
{{ if .Params.Toc }}{{ .TableOfContents }}{{ end }}

<section class="post">
<h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<span class="post-date">{{ .Date.Format "Jan 2, 2006 " }}</span>
<div class="post-content">
{{ .Content }}
</div>
</section>

<section class="pagination clearfix">
{{ with .PrevInSection }}
<a class="btn previous " href="{{.Permalink}}"> {{ .Title }} </a>
{{ end }}
{{ with .NextInSection }}
<a class="btn next " href="{{.Permalink}}"> {{ .Title }} </a>
{{ end }}
</section>

{{ if .Params.comments }}{{ partial "disqus.html" . }}{{ end }}
</div>

{{ partial "footer.html" . }}

<script src="{{ .Site.BaseURL }}/js/highlight.min.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
{{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }}
</body>

</html>
49 changes: 49 additions & 0 deletions layouts/index.html
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
<title> {{ .Site.Title }} </title>

{{ with .Site.Params.Keywords }}<meta name="keywords" content="{{.}}">{{ end }}
{{ with .Site.Params.Description }}<meta name="description" content="{{.}}">{{ end }}

{{ partial "head.html" . }}

</head>

<body>
{{ partial "header.html" . }}

<section class="user-profile">
<figure class="user-avatar">
<img alt="avater" src="{{ .Site.Params.Avater }}">
<figcaption class="user-socials">

{{ with .Site.Params.TwitterID }}
<a href="https://twitter.com/{{.}}" title="Twitter"><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
{{ end }}

{{ with .Site.Params.GoogleplusID }}
<a href="https://plus.google.com/{{.}}/about" title="Google+"><i class="fa fa-google-plus-square" aria-hidden="true"></i></a>
{{ end }}

{{ with .Site.Params.FacebookID }}
<a href="https://facebook.com/{{.}}" title="Facebook"><i class="fa fa-facebook-square" aria-hidden="true"></i></a>
{{ end }}

{{ with .Site.Params.GithubID }}
<a href="https://github.com/{{.}}" title="GitHub"><i class="fa fa-github-square" aria-hidden="true"></i></a>
{{ end }}

{{ with .Site.Params.LinkedInID }}
<a href="http://linkedin.com/in/{{.}}" title="LinkedIn"><i class="fa fa-linkedin-square" aria-hidden="true"></i></a>
{{ end }}

</figcaption>
</figure>
<h2 class="user-motivation">{{ .Site.Params.SelfIntro }}</h2>
</section>

{{ partial "footer.html" . }}

</body>
</html>
26 changes: 26 additions & 0 deletions layouts/page/single.html
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>

<head>
<title> {{ .Title }} &middot; {{ .Site.Title }} </title>

{{ partial "head.html" . }}
</head>

<body>
{{ partial "header.html" . }}
<div class="content">
<section class="post">
<h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class="post-content">
{{ .Content }}
</div>
</section>
</div>
{{ partial "footer.html" . }}

{{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }}

</body>

</html>
10 changes: 10 additions & 0 deletions layouts/partials/analytics.html
@@ -0,0 +1,10 @@
<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', '{{.}}', 'auto');
ga('send', 'pageview');

</script>
16 changes: 16 additions & 0 deletions layouts/partials/disqus.html
@@ -0,0 +1,16 @@
{{ if .Site.Params.DisqusShortname }}
<section id="disqus_thread" class='disqus'></section>
<script>
var disqus_config = function () {
this.page.url = {{ .Permalink }};
// this.page.identifier = PAGE_IDENTIFIER;
};
(function() {
var d = document, s = d.createElement('script');
s.src = '//{{ .Site.Params.DisqusID }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
{{ end }}
12 changes: 12 additions & 0 deletions layouts/partials/footer.html
@@ -0,0 +1,12 @@
<footer>
<div class="footer-info">
<p>
<a href="mailto:{{ .Site.Params.Email }}?subject="><i class="fa fa-envelope-o"></i> {{ .Site.Params.Email }} </a>
{
<a href="https://gohugo.io/" title="Hugo :: A fast and modern static website engine">Hugo {{ .Hugo.Version }}</a>,
<a href="https://github.com/IvanChou/yii.im" title="vec">Vec</a>
}
{<a href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="CC BY-NC-ND 3.0">CC BY-NC-ND 3.0</a>}
</p>
</div>
</footer>
13 changes: 13 additions & 0 deletions layouts/partials/head.html
@@ -0,0 +1,13 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
{{ .Hugo.Generator }}

<!-- CSS -->
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/vec.css">

<!-- Icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="/favicon.ico">

<!-- RSS -->
<link href="{{ .RSSlink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
19 changes: 19 additions & 0 deletions layouts/partials/header.html
@@ -0,0 +1,19 @@
<header>
<nav>
<ul>
{{ $title := lower .Title }}
{{ $section := lower .Section }}
<li class="pull-left {{ if .IsHome }}current{{ end }}">
<a href="{{ .Site.BaseURL }}">/home/{{ lower .Site.Title}}</a>
</li>
{{ range .Site.Menus.main }}
{{ $name := lower .Name }}
<li class="pull-left {{ if eq $name $title }}current{{ else if eq $section $name }}current{{ end }}">
<a href="{{ .URL }}">~/{{ lower .Name }}</a>
</li>
{{end}}

<li class="pull-right"><a href="{{ .RSSlink }}"><i class="fa fa-rss"></i></a></li>
</ul>
</nav>
</header>
5 changes: 5 additions & 0 deletions layouts/partials/pagination.html
@@ -0,0 +1,5 @@
<div class="pagination">
{{ if .Paginator.HasPrev }}
<a class="btn previous" href="{{ .Paginator.Prev.URL }}">Newer</a> {{ end }} {{ if .Paginator.HasNext }}
<a class="btn next" href="{{ .Paginator.Next.URL }}">Older</a> {{ end }}
</div>

0 comments on commit 03cda94

Please sign in to comment.