summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-12-26 13:04:18 +0100
committerDimitri Sokolyuk <demon@dim13.org>2017-12-26 13:04:18 +0100
commitc3e64686145b5b2c31e72a182b3f8ff6c3ae3ef9 (patch)
tree219a56b651b50f7021e27b1cbc38360f8b876a0e /template
parentaa3789452fd34c174268aaaa088e1fd97601a2d3 (diff)
Switch to bootstrap
Diffstat (limited to 'template')
-rw-r--r--template/article.tmpl12
-rw-r--r--template/doc.tmpl16
-rw-r--r--template/home.tmpl4
-rw-r--r--template/index.tmpl23
-rw-r--r--template/root.tmpl107
5 files changed, 85 insertions, 77 deletions
diff --git a/template/article.tmpl b/template/article.tmpl
index 7d38dda..e461ce2 100644
--- a/template/article.tmpl
+++ b/template/article.tmpl
@@ -5,15 +5,11 @@
{{define "content"}}
{{with .Doc}}
{{template "doc" .}}
- {{with .Related}}
- <section>
- <h3>Related articles</h3>
+ {{with .Related}}
+ <h5>Related articles</h5>
<ul>
- {{range .}}
- <li><a href="{{.Path}}">{{.Title}}</a></li>
- {{end}}
+ {{range .}}<li><a href="{{.Path}}">{{.Title}}</a></li>{{end}}
</ul>
- </section>
- {{end}}
+ {{end}}
{{end}}
{{end}}
diff --git a/template/doc.tmpl b/template/doc.tmpl
index 26b9624..f82bec4 100644
--- a/template/doc.tmpl
+++ b/template/doc.tmpl
@@ -24,7 +24,9 @@
</ul>
{{end}}
-{{define "newline"}}{{end}}
+{{define "newline"}}
+{{/* newline */}}
+{{end}}
{{define "section"}}
<h4 id="TOC_{{.FormattedNumber}}">{{.Title}}</h4>
@@ -51,21 +53,25 @@
{{end}}
{{define "code"}}
- <code>{{.Text}}</code>
+ <div class="code">{{.Text}}</div>
{{end}}
{{define "image"}}
- <img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} alt="image">
+ <img src="https://www.dim13.org/{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} alt="image">
{{end}}
{{define "caption"}}
- <div class="figcaption">{{style .Text}}</div>
+ <figcaption>{{style .Text}}</figcaption>
{{end}}
{{define "iframe"}}
+<div class="iframe">
<iframe src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen></iframe>
+</div>
{{end}}
-{{define "link"}}<p><a href="{{.URL}}" target="_blank">{{style .Label}}</a></p>{{end}}
+{{define "link"}}
+ <p class="link"><a href="{{.URL}}" target="_blank">{{style .Label}}</a></p>
+{{end}}
{{define "html"}}{{.HTML}}{{end}}
diff --git a/template/home.tmpl b/template/home.tmpl
index ca16bb0..2c622b5 100644
--- a/template/home.tmpl
+++ b/template/home.tmpl
@@ -4,9 +4,7 @@
{{define "content"}}
{{range .Data}}
- {{template "doc" .}}
+ {{template "doc" .}}
{{end}}
- <footer>
<p>See the <a href="{{.BasePath}}/index">index</a> for more articles.</p>
- </footer>
{{end}}
diff --git a/template/index.tmpl b/template/index.tmpl
index 843a791..1803dd5 100644
--- a/template/index.tmpl
+++ b/template/index.tmpl
@@ -3,15 +3,22 @@
{{define "title"}}Article index{{end}}
{{define "content"}}
-<section>
+ <section>
<h2>{{template "title"}}</h2>
- <dl>
+ <ul class="list-group">
{{range .Data}}
- <dt><a href="{{.Path}}">{{.Title}}</a></dt>
- <dd>{{template "time" .Time}}
- {{with .Tags}}<div class="tags">{{range .}}{{.}} {{end}}</div>{{end}}
- </dd>
+ <li class="list-group-item">
+ <div class="d-flex justify-content-between">
+ <a href="{{.Path}}">{{.Title}}</a>
+ {{with .Tags}}
+ <span>
+ {{range .}}<span class="badge badge-default">{{.}}</span> {{end}}
+ </span>
+ {{end}}
+ </div>
+ <div>{{template "time" .Time}}</div>
+ </li>
{{end}}
- </dl>
-</section>
+ </ul>
+ </section>
{{end}}
diff --git a/template/root.tmpl b/template/root.tmpl
index 831ac72..817662a 100644
--- a/template/root.tmpl
+++ b/template/root.tmpl
@@ -1,62 +1,65 @@
{{/* This template is combined with other templates to render blog pages. */}}
-{{define "ga"}}
-<script type="text/javascript" async>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', 'UA-22272807-1', 'auto');
- ga('send', 'pageview');
-</script>
-{{end}}
-
-{{define "aside"}}
-<aside>
- <header>
- <h1><a href="{{.BasePath}}/">dim13·blog</a></h1>
- </header>
-
- {{with .Doc}}
- {{with .Older}}
- <h4>Previous article</h4>
- <p><a href="{{.Path}}">{{.Title}}</a></p>
- {{end}}
- {{with .Newer}}
- <h4>Next article</h4>
- <p><a href="{{.Path}}">{{.Title}}</a></p>
- {{end}}
- {{end}}
-
- <h4>Links</h4>
- <ul>
- <li><a href="{{.BasePath}}/index">Blog Index</a></li>
- <li><a href="//github.com/dim13">GitHub</a></li>
- <li><a href="//git.dim13.org">Local Git</a></li>
- <li><a href="ftp://ftp.dim13.org/pub/">Public FTP</a></li>
- <li><a href="{{.BasePath}}/Who-am-I">Who am I</a></li>
- </ul>
-
- <p><img src="avatar/cloupur.png" alt="avatar"></p>
-</aside>
-{{end}}
-
{{define "root" -}}
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>{{template "title" .}}</title>
- <meta charset="UTF-8">
+
+ <meta charset="utf-8">
<meta name="google-site-verification" content="3cwuN4OwVfNZEGTw5Q9UotI2AJCTzr8F7QB8uhtfAWo">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" type="text/css" href="/static/fonts.css">
- <link rel="stylesheet" type="text/css" href="/static/style.css">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
+
+ <link rel="stylesheet" type="text/css" href="static/fonts.css">
+ <link rel="stylesheet" type="text/css" href="static/style.css">
+
<link rel="alternate" type="application/atom+xml" title="Atom Feed" href="/feed.atom">
-{{template "ga"}}
</head>
<body>
-{{template "aside" .}}
-{{template "content" .}}
+ <nav class="navbar navbar-expand-sm">
+ <div class="container-fluid">
+ <a class="navbar-brand" href="{{.BasePath}}/">dim13·blog</a>
+ <ul class="navbar-nav">
+ <li class="nav-item"><a class="nav-link" href="{{.BasePath}}/Who-am-I">Who am I</a></li>
+ <li class="nav-item"><a class="nav-link" href="//github.com/dim13">GitHub</a></li>
+ <li class="nav-item"><a class="nav-link" href="//git.dim13.org">Local Git</a></li>
+ <li class="nav-item"><a class="nav-link" href="//ftp.dim13.org">Public FTP</a></li>
+ <li class="nav-item"><a class="nav-link" href="{{.BasePath}}/index">Blog Index</a></li>
+ </ul>
+ </div>
+ </nav>
+
+ <div class="container">
+ {{template "content" .}}
+ </div>
+
+ {{with .Doc}}
+ <nav class="navbar navbar-expand-sm">
+ <div class="container-fluid">
+ <ul class="navbar-nav">
+ {{with .Older}}
+ <li class="nav-item"><a class="nav-link" href="{{.Path}}">&larr; {{.Title}}</a></li>
+ {{end}}
+ </ul>
+ <ul class="navbar-nav">
+ {{with .Newer}}
+ <li class="nav-item"><a class="nav-link" href="{{.Path}}">{{.Title}} &rarr;</a></li>
+ {{end}}
+ </ul>
+ </div>
+ </nav>
+ {{end}}
+
+ <script type="text/javascript" async>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ ga('create', 'UA-22272807-1', 'auto');
+ ga('send', 'pageview');
+ </script>
</body>
</html>
{{end}}
@@ -65,14 +68,12 @@
<article>
<header>
<h2><a href="{{.Path}}">{{.Title}}</a></h2>
- <p>{{template "time" .Time}}</p>
+ {{template "time" .Time}}
</header>
{{.HTML}}
- {{with .Authors}}
<footer>
- <address>By {{authors .}}</address>
+ {{with .Authors}}<address>By {{authors .}}</address>{{end}}
</footer>
- {{end}}
</article>
{{end}}