Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/4ever9/less.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAiden X <caichao.xu@gmail.com>2020-08-23 17:59:31 +0300
committerAiden X <caichao.xu@gmail.com>2020-08-23 17:59:31 +0300
commit1cccd9bdb2dc20a165afa49f24ca4f278e79d5e9 (patch)
treee1ad52da37ad577d84d2dd8b127ff2ac299993d6 /layouts
parent3a223545b912db31bd2cf46f2921e303edc296f5 (diff)
feat(*): use baseof page
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html17
-rw-r--r--layouts/_default/single.html41
-rw-r--r--layouts/index.html58
-rw-r--r--layouts/partials/footer.html29
-rw-r--r--layouts/partials/head.html13
-rw-r--r--layouts/partials/header.html22
6 files changed, 107 insertions, 73 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 5f8e2ec..0c2e761 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,11 +1,8 @@
-<!DOCTYPE html>
-<html>
- {{- partial "head.html" . -}}
- <body>
- {{- partial "header.html" . -}}
- <div id="content">
- {{- block "main" . }}{{- end }}
- </div>
- {{- partial "footer.html" . -}}
- </body>
+<html lang="en">
+{{ partial "head.html" . }}
+<body>
+{{ partial "header.html" . }}
+{{ block "main" . }} {{ end }}
+{{ partial "footer.html" . }}
+</body>
</html>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index cf0926a..b63d448 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,16 +1,33 @@
-{{ partial "header.html" . }}
-
-<div class="container">
- <div class="row">
- <div class="column is-md-8 is-offset-2 main">
- <div class="single">
- <div class="single-title">
- {{.Title}}
+{{ define "main" }}
+ <div class="container">
+ <div class="row">
+ <div class="column is-md-8 is-12 is-offset-md-2 main">
+ <div class="single">
+ <div class="single-title">
+ {{.Title}}
+ </div>
+ <div class="single-meta">
+ <div class="single-date">
+ {{ .Date.Format "2006-01-02" }}
+ </div>
+ {{ if .Params.tags }}
+ <div class="single-tags">
+ {{ range $k, $v := .Params.tags }}
+ <a class="single-tag" href="{{ "tags/" | absLangURL }}{{ . }}">
+ #{{ . }}
+ </a>
+ {{ end }}
+ </div>
+ {{ end }}
+ </div>
+ <div class="single-content">
+ {{.Content}}
+ </div>
</div>
- {{.Content}}
+ </div>
+ <div class="column is-md-2" style="position: relative">
+ <div class="single-toc"></div>
</div>
</div>
</div>
-</div>
-
-{{partial "footer.html" . }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/index.html b/layouts/index.html
index 04da3f9..16274ff 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,36 +1,36 @@
-{{ partial "header.html" . }}
-
-<div class="container">
- <div class="row">
- <div class="column is-md-8 is-offset-2 main">
- {{ range (.Site.RegularPages.GroupByDate "2006") }}
- <div class="posts">
- <div class="year">{{ .Key }}</div>
- {{ range .Pages }}
- <div class="post">
- <div class="post-left">
+{{ define "main" }}
+ <div class="container">
+ <div class="row">
+ <div class="column is-md-8 is-offset-md-2 main">
+ {{ range (.Site.RegularPages.GroupByDate "2006") }}
+ <div class="posts">
+ <div class="year">{{ .Key }}</div>
+ {{ range .Pages }}
+ <div class="post">
+ <div class="post-left">
<span class="post-date">
{{ .Date.Format "01-02" }}
</span>
- </div>
- <div class="post-right">
- <a class="post-title" href="{{.Permalink}}">
- {{.Title}}
- </a>
- <div class="post-summary">
- {{ $length := (len .Summary) }}
- {{ if gt (len .Summary) 100 }}
- {{ $length = 100 }}
- {{ end }}
- {{ slicestr .Summary 0 $length | plainify | htmlUnescape }}
+ </div>
+ <div class="post-right">
+ <a class="post-title" href="{{.Permalink}}">
+ {{.Title}}
+ </a>
+ <div class="post-summary">
+ {{ $length := (len .Summary) }}
+ {{ if gt $length 0 }}
+ {{ if gt $length 100 }}
+ {{ $length = 100 }}
+ {{ end }}
+ {{ slicestr .Summary 0 $length | plainify | htmlUnescape }}
+ {{ end }}
+ </div>
</div>
</div>
- </div>
- {{ end }}
- </div>
- {{ end }}
+ {{ end }}
+ </div>
+ {{ end }}
+ </div>
</div>
</div>
-</div>
-
-{{ partial "footer.html" . }} \ No newline at end of file
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 74164f0..d9ad6cd 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,10 +1,35 @@
-
<div class="container">
<footer>
<div>Less is More</div>
- <span class="copyright">©2018-{{now.Year}}</span>
+ <span class="copyright">
+ {{ $year := "2020" }}
+ {{ $created := $.Site.Params.siteCreated }}
+ {{ if and $created (lt $created now.Year) }}
+ {{ $year = printf "%d - %d" $created now.Year }}
+ {{ else }}
+ {{ $year = printf "%d" now.Year }}
+ {{ end }}
+ © {{ $year }}
+ </span>
<a href="">粤ICP备120011798号</a>
</footer>
</div>
</body>
+<script src="https://cdn.staticfile.org/tocbot/4.11.2/tocbot.min.js"></script>
+<script>
+ tocbot.init({
+ // Where to render the table of contents.
+ tocSelector: '.single-toc',
+ // Where to grab the headings to build the table of contents.
+ contentSelector: '.single-content',
+ // Which headings to grab inside of the contentSelector element.
+ headingSelector: 'h1, h2, h3',
+ // For headings inside relative or absolute positioned containers within content.
+ hasInnerContainers: false,
+ collapseDepth: 4
+ });
+</script>
+<script crossorigin="anonymous" integrity="sha384-LVoNJ6yst/aLxKvxwp6s2GAabqPczfWh6xzm38S/YtjUyZ+3aTKOnD/OJVGYLZDl" src="https://lib.baomitu.com/jquery/3.5.0/jquery.min.js"></script>
+{{ $built := resources.Get "js/less.js" | js.Build "less.js" }}
+<script type="text/javascript" src="{{ $built.RelPermalink }}"></script>
</html> \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index e69de29..72ba546 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -0,0 +1,13 @@
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport"
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ {{ $options := (dict "targetPath" "less.css" "outputStyle" "compressed" "enableSourceMap" true) }}
+ {{ $style := resources.Get "scss/less.scss" | resources.ToCSS $options }}
+ <link href="/images/logo.png" rel="icon" type="image/ico">
+ <link rel="stylesheet" href="{{ $style.Permalink }}">
+ <link rel="stylesheet" href="//at.alicdn.com/t/font_1995642_5r07rt5x862.css">
+ <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/tocbot/4.11.1/tocbot.css">
+ <title>面向自由编程</title>
+</head> \ No newline at end of file
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index b330262..4c6bb51 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,18 +1,3 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- {{ $options := (dict "targetPath" "less.css" "outputStyle" "compressed" "enableSourceMap" true) }}
- {{ $style := resources.Get "scss/less.scss" | resources.ToCSS $options }}
- <link href="/images/logo.png" rel="icon" type="image/ico">
- <link rel="stylesheet" href="{{ $style.Permalink }}">
- <link rel="stylesheet" href="//at.alicdn.com/t/font_1995642_svj67i6zduq.css">
- <title>面向自由编程</title>
-</head>
-<body>
<div class="container">
<div class="nav">
<a class="logo" href="/">
@@ -20,12 +5,9 @@
</a>
<ul class="nav-menu">
<li>
- <a href="">系列</a>
- </li>
- <li>
- <a href="">关于</a>
+ <a href="/about">关于</a>
</li>
</ul>
- <i class="icon icon-search"></i>
+ <i class="icon icon-moon" id="btn-dark"></i>
</div>
</div> \ No newline at end of file