Merge pull request #1 from nanxiaobei/master

rebase
This commit is contained in:
Ryan Harter 2020-05-22 17:12:46 -05:00 committed by GitHub
commit 98a6d49c5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 63 deletions

View File

@ -1,4 +1,4 @@
# Paper <sup><sup><sub>v4.5 (Dark Mode)</sub></sup></sup>
# Paper <sup><sup><sub>v4.7 (Dark Mode)</sub></sup></sup>
A simple, clean, flexible Hugo theme.
@ -39,3 +39,7 @@ theme = "paper"
```
For more information read the official [guide](https://gohugo.io/getting-started/quick-start/#step-3-add-a-theme) of Hugo.
## Dark Mode
It's automatic, according to the natural time of day and night.

View File

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

View File

@ -1,16 +1,21 @@
{{ partial "header.html" . }}
{{- partial "header.html" . }}
{{ if not .IsHome }}
<header class="page-header">
<h1>{{ if eq .Data.Singular "tag" }}{{ .Data.Term }}{{ else }}Posts{{ end }}</h1>
</header>
{{- $scope := .Site }}
{{- if .Title }}
<header class="page-header"><h1>{{ .Title }}</h1></header>{{ $scope = . }}
{{ end }}
{{ $paginator := .Paginate (where .Site.RegularPages ".Params.type" "!=" "page") }}
{{- $paginator := .Paginate (where $scope.RegularPages ".Params.type" "!=" "page") }}
{{ range $index, $page := $paginator.Pages }}
<article class="{{ if and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) }}first-entry{{ else }}post-entry{{ end }}">
{{- range $index, $page := $paginator.Pages }}
{{- $class := "post-entry" }}
{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0)) }}
{{- $class = "first-entry" }}
{{- else if .Data.Term }}
{{- $class = "post-entry tag-entry" }}
{{- end }}
<article class="{{ $class }}">
<header class="entry-header">
<h2>{{ .Title }}</h2>
</header>
@ -22,19 +27,19 @@
</footer>
<a class="entry-link" href="{{ .Permalink }}"></a>
</article>
{{ end }}
{{- end }}
{{ if gt $paginator.TotalPages 1 }}
{{- if gt $paginator.TotalPages 1 }}
<footer class="page-footer">
<nav class="pagination">
{{ if $paginator.HasPrev }}
{{- if $paginator.HasPrev }}
<a class="prev" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a>
{{ end }}
{{ if $paginator.HasNext }}
{{- end }}
{{- if $paginator.HasNext }}
<a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a>
{{ end }}
{{- end }}
</nav>
</footer>
{{ end }}
{{- end }}
{{ partial "footer.html" . }}
{{- partial "footer.html" . }}

View File

@ -1,28 +1,28 @@
{{ partial "header.html" . }}
{{- partial "header.html" . }}
<article class="post-single">
<header class="post-header">
<h1 class="post-title">{{ .Title }}</h1>
<div class="post-meta">
{{- if or .Params.author .Site.Params.author -}}
{{ .Params.author | default .Site.Params.author }} · {{ end }}
{{- if or .Params.author .Site.Params.author }}
{{- .Params.author | default .Site.Params.author }} · {{ end }}
{{- .Date.Format "January 2, 2006" -}}
</div>
</header>
<div class="post-content">{{ .Content }}</div>
{{ if .Params.tags }}
{{- if .Params.tags }}
<footer class="post-footer">
<ul class="post-tags">
{{ range .Params.tags }}
{{ $href := print (absURL "tags/") (urlize .) }}
{{- range .Params.tags }}
{{- $href := print (absURL "tags/") (urlize .) }}
<li><a href="{{ $href }}">{{ . }}</a></li>
{{ end }}
{{- end }}
</ul>
</footer>
{{ end }}
{{- end }}
<!-- Comments area start -->
{{ if not (eq .Params.comments false) }}
{{ if .Site.DisqusShortname }}
{{- if not (eq .Params.comments false) }}
{{- if .Site.DisqusShortname }}
<div id="disqus_thread"></div>
<script>
var disqus_shortname = '{{ .Site.DisqusShortname }}';
@ -38,8 +38,8 @@
<a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
<!-- Comments area end -->
{{ end }}
{{ end }}
{{- end }}
{{- end }}
</article>
{{ partial "footer.html" . }}
{{- partial "footer.html" . }}

View File

@ -5,22 +5,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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>
<title>{{ if .Title }}{{ .Title }} - {{ 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 }}
{{- else }}
<meta name="description" content="{{ .Site.Params.description }}">
<meta name="author" content="{{ .Site.Params.author }}">
{{ end -}}
{{- end }}
<!-- Styles -->
<link href="{{ "an-old-hope.min.css" | absURL }}" rel="stylesheet">
<link href="{{ "style.css" | absURL }}" rel="stylesheet">
@ -29,14 +22,14 @@
<link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | absURL }}">
<link rel="icon" href="{{ "favicon.ico" | absURL }}">
<!-- Generator -->
{{ hugo.Generator }}
{{- hugo.Generator }}
<!-- RSS -->
<link rel="alternate" type="application/atom+xml" href="{{ "index.xml" | absURL }}" title="{{ .Site.Title }}">
<!-- Misc -->
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ template "_internal/google_analytics_async.html" . }}
{{ template "_internal/opengraph.html" . }}
{{ end }}
{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{- template "_internal/google_analytics_async.html" . }}
{{- template "_internal/opengraph.html" . }}
{{- end }}
<!-- Script -->
<script>
function setTheme() {
@ -81,26 +74,26 @@
}
</script>
</head>
<body class="{{if eq .Kind `page` }}single{{else}}list{{ if .IsHome }} home{{ end }}{{end}}">
<body class="{{ if eq .Kind `page` }}single{{ else }}list{{ if .IsHome }} home{{ end }}{{ end }}">
<script>
setTheme();
</script>
<header class="header">
<nav class="nav">
{{ if .IsHome }}
{{- if .IsHome }}
<h1 class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></h1>
{{ else }}
{{- else }}
<p class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></p>
{{ end }}
{{ if .Site.Menus.main }}
{{- end }}
{{- if .Site.Menus.main }}
<ul class="menu">
{{ range .Site.Menus.main }}
{{- range .Site.Menus.main }}
<li>
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
{{- end }}
</ul>
{{ end }}
{{- end }}
</nav>
</header>
<main class="main">

View File

@ -3,7 +3,7 @@
* A simple, clean, flexible Hugo theme
* https://github.com/nanxiaobei/hugo-paper
* Designed by MR.LEE (https://mrlee.me/)
* Updated in 2019.10.17
* Updated in 2020.5.15
*/
/* Theme
@ -18,29 +18,33 @@
--radius: 8px;
--theme: #fff;
--entry: #fff;
--primary: rgba(0, 0, 0, 0.88);
--secondary: rgba(0, 0, 0, 0.56);
--tertiary: rgba(0, 0, 0, 0.16);
--content: rgba(0, 0, 0, 0.88);
--hljs-bg: #1c1d21;
--code-bg: #f5f5f5;
--border: #eee;
}
.dark {
--theme: #3c3c3c;
--primary: rgba(255, 255, 255, 0.88);
--theme: #1d1d1d;
--entry: #333;
--primary: rgba(255, 255, 255, 0.8);
--secondary: rgba(255, 255, 255, 0.56);
--tertiary: rgba(255, 255, 255, 0.16);
--content: rgba(255, 255, 255, 0.64);
--hljs-bg: #2a2a2a;
--code-bg: #4f4f4f;
--code-bg: #333;
--border: #5f5f5f;
}
.list {
background: linear-gradient(135deg, #ddd, #f5f5f5, #d5d5d5);
}
.dark.list {
background: linear-gradient(135deg, #1c1c1c, #2a2a2a, #000);
background: linear-gradient(135deg, #1b1b1b, #252525, #000);
}
/* Reset
-------------------------------------------------- */
@ -56,7 +60,7 @@ body {
margin: 0;
color: var(--primary);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
'Open Sans', 'Helvetica Neue', sans-serif;
'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 18px;
line-height: 1.8;
word-break: break-word;
@ -82,6 +86,7 @@ h5,
h6 {
margin-top: 0;
margin-bottom: 0;
color: var(--primary);
line-height: 1.2;
}
p {
@ -238,13 +243,17 @@ img {
position: relative;
margin-bottom: var(--gap);
padding: var(--gap);
background: var(--theme);
background: var(--entry);
border-radius: var(--radius);
transition: transform 0.1s;
}
.post-entry:active {
transform: scale(0.96);
}
.tag-entry .entry-content,
.tag-entry .entry-footer {
display: none;
}
.entry-header h2 {
font-size: 24px;
}
@ -285,6 +294,9 @@ img {
color: var(--secondary);
font-size: 14px;
}
.post-content {
color: var(--content);
}
.post-content h1 {
margin-top: 40px;
margin-bottom: 32px;