Initial commit

This commit is contained in:
Lee 2018-01-09 00:28:39 +08:00
parent ae9627cb6f
commit 6315d0ab8f
13 changed files with 693 additions and 2 deletions

19
README.md Normal file → Executable file
View File

@ -1,2 +1,17 @@
# hugo-paper Hugo Paper
A simple & clean hugo theme ========
Hugo Paper is a responsive simple & clean hugo theme.
![Hugo Paper Theme Screenshot](https://raw.githubusercontent.com/nanxiaobei/hugo-paper/master/images/screenshot.png)
## Installation
Inside the folder of your Hugo site run:
```bash
$ cd themes
$ git clone https://github.com/nanxiaobei/hugo-paper
```
*For more information read the official [setup guide](https://gohugo.io/overview/installing/) of Hugo.*

2
archetypes/default.md Normal file
View File

@ -0,0 +1,2 @@
+++
+++

BIN
images/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
images/tn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

3
layouts/404.html Normal file
View File

@ -0,0 +1,3 @@
{{ partial "header.html" . }}
<div class="not-found">404</div>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,44 @@
{{ partial "header.html" . }}
{{ if not .IsHome }}
<header class="list-header">
{{ if eq .Data.Singular "tag" }}<span>Tagged in</span>
<h1 class="list-title">{{ .Data.Term }}</h1>
{{ else }}<h1 class="list-title">Posts</h1>
{{ end }}
</header>
{{ end }}
{{ $paginator := .Paginate (where .Pages ".Params.type" "!=" "page") (index .Site.Params "paginate" | default 10) }}
{{ if gt $paginator.TotalPages 0 }}
{{ range $index, $page := $paginator.Pages }}
{{ if and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) }}
{{ .Scratch.Set "postClass" "first-entry" }}
{{ .Scratch.Set "firstEmoji" "<span class=\"welcome-emoji\">👉</span>" }}
{{ else }}
{{ .Scratch.Set "postClass" "post-entry" }}
{{ end }}
<article class="post {{ .Scratch.Get `postClass` }}">
<header class="post-header">
{{ safeHTML (.Scratch.Get `firstEmoji`) }}
<h2 class="post-title">{{ .Title }}</h2>
</header>
<p class="post-summary">{{ .Summary | plainify | htmlUnescape }}...</p>
<footer class="post-footer">
<p class="post-meta">{{ .Date.Format "2006.1.2" }}</p>
</footer>
<a class="post-link" href="{{ .Permalink }}"></a>
</article>
{{ end }}
{{ end }}
{{ if gt $paginator.TotalPages 1 }}
<footer class="list-footer">
<nav class="pagination">
{{ if $paginator.HasPrev }}
<a class="pagination-prev" href="{{ $paginator.Prev.URL }}">← 上一页</a>
{{ end }}
{{ if $paginator.HasNext }}
<a class="pagination-next" href="{{ $paginator.Next.URL }}">下一页 →</a>
{{ end }}
</nav>
</footer>
{{ end }}
{{ partial "footer.html" . }}

View File

@ -0,0 +1,23 @@
{{ partial "header.html" . }}
<article class="post post-view">
<header class="post-header">
<h1 class="post-title">{{ .Title }}</h1>
<p class="post-meta">
{{- if or .Params.author .Site.Params.author -}}
{{ .Params.author | default .Site.Params.author }} · {{ end }}
{{- .Date.Format "2006.1.2" -}}
</p>
</header>
<div class="post-content">{{ .Content }}</div>
<footer class="post-footer">
{{ if .Params.tags }}
<ul class="post-tags">
{{ range .Params.tags }}
<li><a href="{{ `/tags/` | absURL }}{{ . | urlize }}/">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
</footer>
<!-- Comments system area -->
</article>
{{ partial "footer.html" . }}

View File

@ -0,0 +1,34 @@
</main>
<footer class="footer">
<span>&copy; {{ if eq now.Year 2017 }}2017{{ else }}2017-{{ now.Year }}{{ end }} {{ .Site.Title }} 🎉</span>
<span>&middot;</span>
<span>Powered by <a href="https://gohugo.io/" target="_blank">Hugo❤</a></span>
<span>&middot;</span>
<span>Designed by <a href="http://21beats.com/" target="_blank">21beats⚡</a></span>
</footer>
<script src="https://cdn.bootcss.com/instantclick/3.0.1/instantclick.min.js" data-no-instant></script>
<script data-no-instant>InstantClick.init();</script>
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js" data-no-instant></script>
<script data-no-instant>
hljs.initHighlightingOnLoad();
menuToggle();
InstantClick.on('change', function() {
var blocks = document.querySelectorAll('pre code');
for (var i = 0; i < blocks.length; i++) {
hljs.highlightBlock(blocks[i]);
}
menuToggle();
});
function menuToggle() {
var $toggle = document.querySelector('.menu-toggle');
if (!$toggle.offsetParent) {
return;
}
var $body = document.querySelector('body');
$toggle.addEventListener('click', function() {
$body.classList.toggle('noscroll');
}, false);
}
</script>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Title -->
<title>
{{- if not .IsHome }}
{{- if eq .Kind "page" }}{{ .Title }}
{{- else if eq .Data.Singular "tag" }}{{ .Data.Term }}
{{- else }}Posts
{{- end }} - {{ end }}
{{- .Site.Title -}}
</title>
<!-- Meta -->
{{- if eq .Kind "page" }}
<meta name="description" content="{{ .Summary }}">
<meta name="author" content="{{ .Params.author | default .Site.Params.author }}">
{{ else }}
<meta name="description" content="{{ .Site.Params.description }}">
<meta name="author" content="{{ .Site.Params.author }}">
{{ end -}}
<!-- Styles -->
<link href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i" rel="stylesheet">
<link href="https://cdn.bootcss.com/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
<!-- Favicons -->
<link rel="apple-touch-icon" href="/img/apple-touch-icon.png">
<link rel="icon" href="/img/favicon.png">
<!-- Generator -->
<meta name="generator" content="Hugo {{ .Hugo.Version }}">
<!-- RSS -->
<link rel="alternate" type="application/atom+xml" href="/index.xml" title="{{ .Site.Title }}">
</head>
<body class="{{if eq .Kind `page` }}single{{else}}list{{end}}">
<header class="header">
{{ if .IsHome }}
<h1 class="title"><a href="{{ `/` | absURL }}"><span>🍱</span>{{ .Site.Title }}</a></h1>
{{ else }}
<p class="title"><a href="{{ `/` | absURL }}"><span>🍱</span>{{ .Site.Title }}</a></p>
{{ end }}
<button class="menu-toggle" type="button"></button>
<nav class="menu">
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<li class="{{ if $currentPage.IsMenuCurrent `main` . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
</nav>
</header>
<main class="main">

492
static/css/style.css Normal file
View File

@ -0,0 +1,492 @@
/*
* Paper v1.0.0
* A simple & clean hugo theme
* Designed by 21beats (http://21beats.com)
* Updated in 2018.1.8
*/
/* Reset
============================================================= */
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
-webkit-tap-highlight-color: transparent;
}
article, aside, figcaption, figure, footer, header, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: 'PT Sans', sans-serif;
color: rgba(0, 0, 0, .8);
font-size: 17px;
line-height: 1.7;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 0;
line-height: 1.2;
}
p {
margin-top: 0;
margin-bottom: 0;
}
ul {
margin: 0;
padding: 0;
}
a {
color: inherit;
text-decoration: none;
}
figure {
margin: 0;
}
img {
max-width: 100%;
vertical-align: middle;
}
button, input, textarea {
-webkit-appearance: none;
padding: 0;
font: inherit;
background: transparent;
border: 0;
outline: 0;
}
button, input[type=button], input[type=submit] {
cursor: pointer;
}
pre, code {
font-family: Menlo, Consolas, monospace;
font-size: inherit;
}
/* Header
============================================================= */
.header {
height: 65px;
padding-left: 30px;
padding-right: 30px;
line-height: 65px;
background: #fff;
}
.title {
float: left;
}
.title a {
display: block;
margin-top: 17px;
font-size: 28px;
font-weight: 700;
line-height: 35px;
}
.title span {
display: inline-block;
margin-right: 10px;
transform: translateY(1px);
}
.menu-toggle {
display: none;
}
.menu {
float: right;
}
.menu li {
display: inline-block;
margin-left: 20px;
}
.menu li.active a {
color: rgba(0, 0, 0, .4);
}
.menu a {
display: block;
font-size: 15px;
}
@media (max-width: 767px) {
.noscroll {
overflow: hidden;
}
.menu-toggle {
display: block;
}
.menu-toggle {
position: absolute;
top: 0;
right: 0;
z-index: 20;
width: 80px;
height: 65px;
}
.menu-toggle::before,
.menu-toggle::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 2px;
background: #000;
}
.menu-toggle::before {
transform: translate3d(-50%, -5px, 0);
}
.menu-toggle::after {
transform: translate3d(-50%, 4px, 0);
}
.noscroll .menu-toggle::before {
transform: translate3d(-50%, -1px, 0) rotateZ(45deg);
}
.noscroll .menu-toggle::after {
transform: translate3d(-50%, -1px, 0) rotateZ(-45deg);
}
.menu {
display: none;
}
.noscroll .menu {
display: block;
}
.menu ul {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
background: #fff;
display: flex;
justify-content: center;
flex-direction: column;
text-align: center;
}
.menu li {
width: 100%;
margin-left: 0;
}
.menu a {
font-size: 20px;
}
}
/* Main
======================================================================= */
.list {
background: #fafafa;
}
/* Main
------------------------------ */
.main {
min-height: calc(100vh - 130px);
overflow: hidden;
}
.list-header,
.first-entry > *,
.post-entry,
.list-footer {
max-width: 700px;
margin-left: auto;
margin-right: auto;
}
.list .main {
padding-bottom: 60px;
}
.list-header,
.list-footer {
padding-left: 30px;
padding-right: 30px;
}
.list-header {
margin-top: 30px;
margin-bottom: 30px;
}
.list-footer {
margin-top: 30px;
}
.single .main {
padding-top: 60px;
padding-bottom: 60px;
}
.post-view {
width: 640px;
margin-left: auto;
margin-right: auto;
}
@media (max-width: 767px) {
.main {
min-height: calc(100vh - 155px);
}
.list-header,
.first-entry > *,
.post-entry,
.list-footer,
.post-view {
width: 100%;
padding-left: 30px;
padding-right: 30px;
}
}
/* List header
------------------------------ */
.list-header span {
color: rgba(0, 0, 0, .4);
font-size: 12px;
letter-spacing: 2px;
text-transform: uppercase;
}
.list-title {
font-size: 50px;
}
/* Post
------------------------------ */
.post-meta {
margin-top: 5px;
color: rgba(0, 0, 0, .4);
font-size: 15px;
letter-spacing: .5px;
}
/* First entry */
.first-entry {
position: relative;
margin-bottom: 40px;
padding-top: 60px;
padding-bottom: 120px;
background: #fff;
}
.welcome-emoji {
font-size: 50px;
line-height: 1;
}
.first-entry .post-title {
font-size: 50px;
}
.post-summary {
margin-top: 10px;
color: rgba(0, 0, 0, .4);
}
@media (max-width: 767px) {
.first-entry {
margin-bottom: 25px;
}
}
/* Post entry */
.post-entry {
position: relative;
padding: 30px;
background: #fff;
border-radius: 6px;
}
.post-entry + .post-entry {
margin-top: 25px;
}
.post-entry:first-child {
margin-top: 40px;
}
.post-entry:hover {
box-shadow: 0 5px 40px -5px rgba(0, 0, 0, .1);
}
.post-entry .post-title {
font-size: 30px;
}
.post-link {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
/* Post view */
.post-view .post-title {
font-size: 40px;
}
.post-content {
padding-top: 30px;
word-wrap: break-word;
}
.post-content h1,
.post-content h2 {
margin-bottom: 15px;
}
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
color: rgba(0, 0, 0, .4);
font-weight: 400;
margin-bottom: 10px;
}
.post-content h1 {
font-size: 40px;
margin-top: 50px;
}
.post-content h2 {
font-size: 34px;
margin-top: 40px;
}
.post-content h3 {
font-size: 28px;
margin-top: 30px;
}
.post-content h4 {
font-size: 24px;
}
.post-content h5 {
font-size: 20px;
}
.post-content h6 {
font-size: 17px;
}
.post-content a {
border-bottom: 1px solid rgba(0, 0, 0, .8);
}
.post-content p,
.post-content ul,
.post-content ol,
.post-content dl {
margin-bottom: 20px;
}
.post-content ul,
.post-content ol {
padding-left: 20px;
}
.post-content li {
margin-bottom: 10px;
}
.post-content li > ul,
.post-content li > ol {
margin-top: 10px;
margin-bottom: 0;
}
.post-content dl {
display: flex;
flex-wrap: wrap;
margin: 0;
}
.post-content dt {
width: 25%;
font-weight: 700;
}
.post-content dd {
width: 75%;
margin-left: 0;
padding-left: 10px;
}
.post-content dt ~ dt,
.post-content dd ~ dd {
margin-top: 10px;
}
.post-content pre,
.post-content table {
margin-top: 30px;
margin-bottom: 30px;
}
.post-content table {
width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.post-content th,
.post-content td {
padding: 12px;
border: 1px solid #eee;
}
.post-content th {
text-align: left;
}
.post-content pre code {
padding: 20px;
}
.post-content code {
padding: 3px 6px;
font-size: 15px;
background: rgba(0, 0, 0, .05);
border-radius: 3px;
}
.post-content blockquote {
margin: 0 0 0 -23px;
padding: 0 0 0 20px;
color: rgba(0, 0, 0, .6);
font-style: italic;
border-left: 3px solid rgba(0, 0, 0, .8);
}
.post-content hr {
margin-top: 70px;
margin-bottom: 70px;
border: solid rgba(0, 0, 0, .1);
border-width: 1px 0 0;
}
.post-content iframe {
max-width: 100%;
}
.post-view .post-tags {
margin-bottom: 30px;
}
.post-tags li {
display: inline-block;
}
.post-tags a {
display: block;
padding: 4px 15px;
color: rgba(0, 0, 0, .6);
background: rgba(0, 0, 0, .05);
border-radius: 3px;
}
.post-tags li + li {
margin-left: 3px;
}
.post-tags a:hover {
background: rgba(0, 0, 0, .08);
}
@media (max-width: 767px) {
.post-content blockquote {
margin: 0 0 0 -30px;
padding: 0 0 0 27px;
}
}
/* List footer
------------------------------ */
.pagination {
overflow: hidden;
}
.pagination a {
display: block;
line-height: 30px;
}
.pagination-prev {
float: left;
}
.pagination-next {
float: right;
}
/* 404
------------------------------ */
.not-found {
text-align: center;
font-size: 180px;
font-weight: 700;
line-height: calc(100vh - 300px);
}
/* Footer
======================================================================= */
.footer {
padding: 20px;
font-size: 13px;
line-height: 25px;
text-align: center;
box-shadow: 0 -1px 0 rgba(0, 0, 0, .05);
}
.footer span {
margin-left: 2px;
margin-right: 2px;
}
.footer a:hover {
text-decoration: underline;
}
@media (max-width: 767px) {
.footer span:last-child {
display: block;
}
.footer span:nth-child(2n) {
display: none;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/img/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

22
theme.toml Normal file
View File

@ -0,0 +1,22 @@
# theme.toml template for a Hugo theme
# See https://github.com/gohugoio/hugoThemes#themetoml for an example
name = "Hugo Paper"
license = "MIT"
licenselink = "https://github.com/nanxiaobei/hugo-paper/blob/master/LICENSE.md"
description = "A simple & clean hugo theme"
homepage = "https://github.com/nanxiaobei/hugo-paper/"
tags = ["Responsive", "Simple", "Clean", "Light", "White", Blog"]
features = ["Responsive", "One Column", "Blog"]
min_version = "1.0.0"
[author]
name = "21beats"
homepage = "http://21beats.com/"
# If porting an existing theme
[original]
name = ""
homepage = ""
repo = ""