diff options
| author | Lee <nanxiaobei@gmail.com> | 2018-01-09 00:28:39 +0800 |
|---|---|---|
| committer | Lee <nanxiaobei@gmail.com> | 2018-01-09 00:28:39 +0800 |
| commit | 6315d0ab8f4a7ded53342d2f97d47305901bbdb8 (patch) | |
| tree | 79085165b7e2586b6b07a3f13e7c2560842adf40 | |
| parent | ae9627cb6fb805d95fa28038a662066bdafd1492 (diff) | |
Initial commit
| -rwxr-xr-x[-rw-r--r--] | README.md | 19 | ||||
| -rw-r--r-- | archetypes/default.md | 2 | ||||
| -rw-r--r-- | images/screenshot.png | bin | 0 -> 68797 bytes | |||
| -rw-r--r-- | images/tn.png | bin | 0 -> 36318 bytes | |||
| -rw-r--r-- | layouts/404.html | 3 | ||||
| -rw-r--r-- | layouts/_default/list.html | 44 | ||||
| -rw-r--r-- | layouts/_default/single.html | 23 | ||||
| -rw-r--r-- | layouts/partials/footer.html | 34 | ||||
| -rw-r--r-- | layouts/partials/header.html | 56 | ||||
| -rw-r--r-- | static/css/style.css | 492 | ||||
| -rw-r--r-- | static/img/apple-touch-icon.png | bin | 0 -> 1261 bytes | |||
| -rw-r--r-- | static/img/favicon.png | bin | 0 -> 1261 bytes | |||
| -rw-r--r-- | theme.toml | 22 |
13 files changed, 693 insertions, 2 deletions
diff --git a/README.md b/README.md index b402c4c..625e934 100644..100755 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ -# hugo-paper -A simple & clean hugo theme +Hugo Paper +======== + +Hugo Paper is a responsive simple & clean hugo theme. + + + +## 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.* diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..ac36e06 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,2 @@ ++++ ++++ diff --git a/images/screenshot.png b/images/screenshot.png Binary files differnew file mode 100644 index 0000000..d10dcdb --- /dev/null +++ b/images/screenshot.png diff --git a/images/tn.png b/images/tn.png Binary files differnew file mode 100644 index 0000000..856a5a6 --- /dev/null +++ b/images/tn.png diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..aab2e1f --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,3 @@ +{{ partial "header.html" . }} +<div class="not-found">404</div> +{{ partial "footer.html" . }}
\ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..f3f5497 --- /dev/null +++ b/layouts/_default/list.html @@ -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" . }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..70b88b8 --- /dev/null +++ b/layouts/_default/single.html @@ -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" . }}
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..fa6fa54 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,34 @@ +</main> +<footer class="footer"> + <span>© {{ if eq now.Year 2017 }}2017{{ else }}2017-{{ now.Year }}{{ end }} {{ .Site.Title }} 🎉</span> + <span>·</span> + <span>Powered by <a href="https://gohugo.io/" target="_blank">Hugo❤️️</a></span> + <span>·</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>
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..3c96282 --- /dev/null +++ b/layouts/partials/header.html @@ -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">
\ No newline at end of file diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..ca2d435 --- /dev/null +++ b/static/css/style.css @@ -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; + } +} diff --git a/static/img/apple-touch-icon.png b/static/img/apple-touch-icon.png Binary files differnew file mode 100644 index 0000000..75824d5 --- /dev/null +++ b/static/img/apple-touch-icon.png diff --git a/static/img/favicon.png b/static/img/favicon.png Binary files differnew file mode 100644 index 0000000..75824d5 --- /dev/null +++ b/static/img/favicon.png diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..9f0375c --- /dev/null +++ b/theme.toml @@ -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 = "" + |
