Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cntrump committed Nov 28, 2019
1 parent 835a87a commit f327de6
Show file tree
Hide file tree
Showing 12 changed files with 449 additions and 344 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# hugo-notepadium ![](https://img.shields.io/badge/license-MIT-blue.svg)

a fast [gohugo](https://gohugo.io) theme, HTML + CSS, 100% JavaScript-free.

- built-in `syntanx highlight`
- custom `404 page`

![](https://lvv.me/posts/2019-11-24_a_simple_hugo_theme/01.png)

the core CSS is `core.css`, transferred size < 3KB.

preview this theme: https://lvv.me

## Quick Start

```shell
git submodule add https://github.com/cntrump/hugo-notepadium.git themes/hugo-notepadium
```

demo `config.toml`:

```toml
baseURL = "/"
languageCode = "zh-cn"
title = "Lvv's notepad"
theme = "hugo-notepadium"
copyright = "Copyright &copy;2019 lvv. All rights reserved."
hasCJKLanguage = true
enableRobotsTXT = true
paginate = 5
pygmentsUseClasses = true
pygmentsCodeFences = true
pygmentsCodeFencesGuessSyntax = true
```

custom your `404 page`:

add `/* /404.html 404` to your `content/_redirects`

if `_redirects` not exists, you can create a new one.
9 changes: 9 additions & 0 deletions layouts/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

{{ define "main"}}
<main id="main">
<div>
<h1 id="title"><a href="{{ "/" | relURL }}">Go Home</a></h1>
<div><b>404</b>, I am lost.</div>
</div>
</main>
{{ end }}
4 changes: 3 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<html>
{{- partial "head.html" . -}}
<body>
<div class="base-body max-width">
{{- partial "header.html" . -}}
<div id="content" class="body">
<div id="content" class="flex-body max-body-width">
{{- block "main" . }}{{- end }}
</div>
{{- partial "footer.html" . -}}
</div>
</body>
</html>
4 changes: 2 additions & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="article-title">{{ .Title | plainify }}</div>
<time class="article-date">{{ .Date.Format "2006-01-02" }}</time>
</div>
<div id="article" class="article-body">
<article class="markdown-body">
{{ .Content }}
</div>
</article>
{{ end }}
42 changes: 22 additions & 20 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,32 @@
{{ end }}

{{ if gt $paginator.TotalPages 1 }}
<ul class="pagination">
{{ if $paginator.HasPrev }}
<li>
<a href="{{ $paginator.Prev.URL }}" class="previous_page">&laquo;</a>
</li>
{{ end }}

{{ range $paginator.Pagers }}
{{ $pageNumber := .PageNumber }}
{{ $active := "" }}
{{ if eq . $paginator }}
{{ $active = "active" }}
{{ end }}
<div class="pagination">
<ul>
{{ if $paginator.HasPrev }}
<li>
<a class="{{ $active }}" href="{{ .URL }}">{{ $pageNumber }}</a>
<a href="{{ $paginator.Prev.URL }}" class="previous_page">&laquo;</a>
</li>
{{ end }}

{{ if $paginator.HasNext }}
<li>
<a href="{{ $paginator.Next.URL }}" class="next_page">&raquo;</a>
</li>
{{ end }}
</ul>
{{ range $paginator.Pagers }}
{{ $pageNumber := .PageNumber }}
{{ $active := "" }}
{{ if eq . $paginator }}
{{ $active = "active" }}
{{ end }}
<li>
<a class="{{ $active }}" href="{{ .URL }}">{{ $pageNumber }}</a>
</li>
{{ end }}

{{ if $paginator.HasNext }}
<li>
<a href="{{ $paginator.Next.URL }}" class="next_page">&raquo;</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}

{{ end }}
3 changes: 2 additions & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div id="footer" class="footer">
<div id="footer" class="footer max-body-width text-gray">
{{ if .Site.Copyright }}
<div> {{ .Site.Copyright | safeHTML }}</div>
{{ end }}
<div>Built <a href="https://github.com/cntrump/hugo-notepadium">hugo-notepadium</a>. 100% JavaScript-free.</div>
</div>
4 changes: 2 additions & 2 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme">

{{- block "title" . }}{{- end }}

<link rel="stylesheet" href="{{ `css/layout.css` | relURL }}">
<link rel="stylesheet" href="{{ `css/syntax.css` | relURL }}">
<link rel="stylesheet" href="{{ `css/core.css` | relURL }}">
4 changes: 2 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="header" class="header">
<div class="header-content">
<div id="header" class="header max-body-width">
<div>
<a class="header-home" href="{{ .Site.BaseURL }}">
{{ .Site.Title }}
</a>
Expand Down
Loading

0 comments on commit f327de6

Please sign in to comment.