summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authornanxiaobei <nanxiaobei@gmail.com>2019-03-31 20:32:06 +0800
committernanxiaobei <nanxiaobei@gmail.com>2019-03-31 20:32:06 +0800
commit8088299ecb919f61daff669c9c25b6e1ca5924c1 (patch)
tree2c4b0dbe9b2787ed688d6feec2afce2707329ff6 /layouts
parent55dc991f4c5e269e81bc1a5fc16224191f980c7b (diff)
Update for 3.0
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.html46
-rw-r--r--layouts/_default/single.html6
-rw-r--r--layouts/partials/footer.html21
-rw-r--r--layouts/partials/header.html108
4 files changed, 95 insertions, 86 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 5433b17..94ad1b8 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,44 +1,46 @@
{{ 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>
+<header class="page-header">
+ {{ if eq .Data.Singular "tag" }}
+ <div class="tagged">Tagged in</div>
+ <h1>{{ .Data.Term }}</h1>
+ {{ else }}
+ <h1>Posts</h1>
{{ end }}
</header>
{{ end }}
-{{ $paginator := .Paginate (where .Pages ".Params.type" "!=" "page") (index .Site.Params "paginate" | default 10) }}
+
+{{ $paginator := .Paginate (where .Pages ".Params.type" "!=" "page") }}
+
{{ 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>
+<article class="post-entry">
+ <header class="entry-header">
+ <h2>{{ .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>
+ <section class="entry-content">
+ <p>{{ .Summary | plainify | htmlUnescape }}...</p>
+ </section>
+ <footer class="entry-footer">
+ <time >{{ .Date.Format "2006.1.2" }}</time>
</footer>
- <a class="post-link" href="{{ .Permalink }}"></a>
+ <a class="entry-link" href="{{ .Permalink }}"></a>
</article>
{{ end }}
{{ end }}
+
{{ if gt $paginator.TotalPages 1 }}
-<footer class="list-footer">
+<footer class="page-footer">
<nav class="pagination">
{{ if $paginator.HasPrev }}
- <a class="pagination-prev" href="{{ $paginator.Prev.URL }}">โ† {{ i18n "prevPage" }}</a>
+ <a class="prev" href="{{ $paginator.Prev.URL }}">โ† {{ i18n "prevPage" }}</a>
{{ end }}
{{ if $paginator.HasNext }}
- <a class="pagination-next" href="{{ $paginator.Next.URL }}">{{ i18n "nextPage" }} โ†’</a>
+ <a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "nextPage" }} โ†’</a>
{{ end }}
</nav>
</footer>
{{ end }}
+
{{ partial "footer.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 6d0935e..25fdb5c 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,12 +1,12 @@
{{ partial "header.html" . }}
-<article class="post post-view">
+<article class="post-single">
<header class="post-header">
<h1 class="post-title">{{ .Title }}</h1>
- <p class="post-meta">
+ <div class="post-meta">
{{- if or .Params.author .Site.Params.author -}}
{{ .Params.author | default .Site.Params.author }} ยท {{ end }}
{{- .Date.Format "2006.1.2" -}}
- </p>
+ </div>
</header>
<div class="post-content">{{ .Content }}</div>
<footer class="post-footer">
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index fc18635..d9eb238 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -10,15 +10,22 @@
<script data-no-instant>InstantClick.init();</script>
<script src="{{.Site.BaseURL}}js/highlight.min.js" data-no-instant></script>
<script data-no-instant>
- addMenuListener();
+ hljs.initHighlightingOnLoad();
+ setMenuListener();
+
InstantClick.on('change', function() {
- addMenuListener();
+ document.querySelectorAll('pre code').forEach((block) => {
+ hljs.highlightBlock(block);
+ });
+
+ setMenuListener();
});
- function addMenuListener() {
- var $toggle = document.querySelector('.menu-toggle');
- var $body = document.querySelector('body');
- $toggle.addEventListener('click', function() {
- $body.classList.toggle('noscroll');
+ function setMenuListener() {
+ var menuToggle = document.querySelector('.menu-toggle');
+ var body = document.querySelector('body');
+
+ menuToggle.addEventListener('click', function() {
+ body.classList.toggle('no-scroll');
}, false);
}
</script>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 674fd04..1c82e77 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,60 +1,60 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
-<head>
- <meta charset="utf-8">
- <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>
- <!-- 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="{{.Site.BaseURL}}css/font.css" rel="stylesheet">
- <link href="{{.Site.BaseURL}}css/atom-one-dark.min.css" rel="stylesheet">
- <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i" rel="stylesheet">
- <link href="{{.Site.BaseURL}}css/style.css" rel="stylesheet">
- <!-- Favicons -->
- <link rel="apple-touch-icon" href="{{.Site.BaseURL}}img/apple-touch-icon.png">
- <link rel="icon" href="{{.Site.BaseURL}}img/favicon.ico">
- <!-- Generator -->
- {{ .Hugo.Generator }}
- <!-- RSS -->
- <link rel="alternate" type="application/atom+xml" href="{{.Site.BaseURL}}index.xml" title="{{ .Site.Title }}">
- {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
- {{ template "_internal/google_analytics_async.html" . }}
- {{ end }}
- {{ partial "header-include.html" . }}
-</head>
-<body class="{{if eq .Kind `page` }}single{{else}}list{{ if .IsHome }} home{{ end }}{{end}}">
- <header class="header">
- {{ if .IsHome }}
- <h1 class="title"><a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a></h1>
+ <head>
+ <meta charset="utf-8">
+ <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>
+ <!-- Meta -->
+ {{- if eq .Kind "page" }}
+ <meta name="description" content="{{ .Summary }}">
+ <meta name="author" content="{{ .Params.author | default .Site.Params.author }}">
{{ else }}
- <p class="title"><a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a></p>
+ <meta name="description" content="{{ .Site.Params.description }}">
+ <meta name="author" content="{{ .Site.Params.author }}">
+ {{ end -}}
+ <!-- Styles -->
+ <link href="{{.Site.BaseURL}}css/github-gist.min.css" rel="stylesheet">
+ <link href="{{.Site.BaseURL}}css/style.css" rel="stylesheet">
+ <!-- Favicons -->
+ <link rel="apple-touch-icon" href="{{.Site.BaseURL}}img/apple-touch-icon.png">
+ <link rel="icon" href="{{.Site.BaseURL}}img/favicon.ico">
+ <!-- Generator -->
+ {{ .Hugo.Generator }}
+ <!-- RSS -->
+ <link rel="alternate" type="application/atom+xml" href="{{.Site.BaseURL}}index.xml" title="{{ .Site.Title }}">
+ {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
+ {{ template "_internal/google_analytics_async.html" . }}
{{ 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>
+ {{ partial "header-include.html" . }}
+ </head>
+ <body class="{{if eq .Kind `page` }}single{{else}}list{{ if .IsHome }} home{{ end }}{{end}}">
+ <header class="header">
+ <div class="wrap">
+ {{ if .IsHome }}
+ <h1 class="logo"><a href="{{.Site.BaseURL}}">{{ .Site.Title }} </a></h1>
+ {{ else }}
+ <p class="logo"><a href="{{.Site.BaseURL}}">{{ .Site.Title }} </a></p>
{{ end }}
- </ul>
+ <button class="menu-toggle" type="button"></button>
+ </div>
+ </header>
+ <nav class="nav">
+ <ul class="menu">
+ {{ $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">
+ <main class="main">