Initial commit.

This commit is contained in:
tastytea 2019-11-20 19:56:22 +01:00
commit 4c365d552e
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
15 changed files with 356 additions and 0 deletions

29
README.adoc Normal file
View File

@ -0,0 +1,29 @@
= nocolor
A Hugo theme with no predefined colors. If you want source code highlighting,
take a look at https://github.com/mozmorris/tomorrow-pygments[].
The theme is based on https://github.com/spookey/slick[Slick].
== Installation
Just download the theme or clone it into your `themes/` directory:
[source,shell]
----
cd themes && git clone https://schlomp.space/tastytea/hugo-theme-nocolor.git
----
Then reference it in your `config`:
[source,toml]
----
theme = "nocolor"
----
Or when building the site, pass it in to the CLI:
[source,shell]
----
hugo -t nocolor
----

15
archetypes/default.md Normal file
View File

@ -0,0 +1,15 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
slug: {{ replace .TranslationBaseName "_" "-" | urlize }}
description: null
date: {{ .Date }}
type: {{ .Type }}
draft: true
menu: main
categories:
- General
tags:
-
series:
-
---

14
archetypes/posts.md Normal file
View File

@ -0,0 +1,14 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
slug: {{ replace .TranslationBaseName "_" "-" | urlize }}
description: null
date: {{ .Date }}
type: {{ .Type }}
draft: true
categories:
- General
tags:
-
series:
-
---

View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode | default "en" }}">
<head>
<meta charset="utf-8" />
<title>{{ if and (.Title) (not (eq .Title .Site.Title)) }}{{ .Title }} | {{ end }}{{ .Site.Title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta name="author" content="{{ .Site.Author.name }}" />
{{ if .Site.Params.opengraph }}{{ template "_internal/opengraph.html" . }}{{ end -}}
{{ if .Site.Params.schema }}{{ template "_internal/schema.html" . }}{{ end -}}
{{ if .Site.Params.twitter_cards }}{{ template "_internal/twitter_cards.html" . }}{{ end -}}
{{ .Hugo.Generator }}
{{- with .Site.RSSLink }}
<link href="{{ . }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }} Feed" />
{{- end }}
{{- $favicon := .Site.Params.favicon | default "favicon.ico" }}
{{- $favtype := cond (eq (path.Ext $favicon) ".png") "image/png" "image/x-icon" }}
<link rel="shortcut icon" href="{{ .Site.BaseURL }}{{ $favicon }}" type="{{ $favtype }}" />
<link rel="stylesheet" href="{{ .Site.BaseURL }}assets/style.css" />
</head>
<body>
{{ partial "header.html" . }}
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }}
</body>
</html>

View File

@ -0,0 +1,17 @@
{{- define "main" }}
<div>
<p>{{ .Title }}:</p>
<ul>
{{- range .Paginator.Pages }}
<li>
<div class="post-title">
{{- if .Draft }}DRAFT: {{ end }}
<a href="{{ .Permalink }}">{{ .Title }}</a>
</div>
{{ partial "post_meta.html" . }}
</li>
{{- end }}
</ul>
</div>
{{ partial "pagination.html" . }}
{{- end }}

36
layouts/_default/rss.xml Normal file
View File

@ -0,0 +1,36 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo {{ .Hugo.Version }} -- gohugo.io</generator>
{{- with .Site.LanguageCode }}
<language>{{ . }}</language>
{{- end }}
{{- with .Site.Author.email }}
<managingEditor>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</managingEditor>
<webMaster>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{end}}</webMaster>
{{- end }}
{{- with .Site.Copyright }}
<copyright>{{ . }}</copyright>
{{- end }}
{{- if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
{{- end }}
{{- with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}
{{- range .Data.Pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with .Site.Author.email }}
<author>{{.}}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</author>
{{- end }}
<guid>{{ .Permalink }}</guid>
<description>{{- .Content | html -}}</description>
</item>
{{- end }}
</channel>
</rss>

View File

@ -0,0 +1,6 @@
{{- define "main" }}
<h1 class="post-title">{{ if .Draft }}DRAFT: {{ end }}{{ .Title }}</h1>
{{ partial "post_meta.html" . }}
<div>{{ .Content }}</div>
{{- end }}

View File

@ -0,0 +1,17 @@
{{- define "main" }}
<div>
<p>{{ .Title }}:</p>
<ul>
{{- $type := .Type }}
{{- range $.Data.Terms.ByCount }}
{{- $count := .Count }}
{{- with $.Site.GetPage (lower (printf "/%s/%s" $type (urlize .Name))) }}
<li>
<a href="{{ .Permalink }}">{{ .Name }}</a>
<span>&#40;{{ $count }}&#41;</span>
</li>
{{- end }}
{{- end }}
</ul>
</div>
{{- end }}

18
layouts/index.html Normal file
View File

@ -0,0 +1,18 @@
{{- define "main" }}
{{ $showfull := cond (isset $.Site.Params "showfullcontent") $.Site.Params.showfullcontent false }}
{{- range $idx, $_ := .Paginator.Pages }}
<p {{ if and $showfull $idx }}class="post-divider"{{ end }}>
<div>
<h2 class="post-title">
{{ if .Draft }}DRAFT: {{ end }}
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h2>
{{ partial "post_meta.html" . }}
</div>
<div>
{{ cond $showfull .Content .Summary }}
</div>
</p>
{{- end }}
{{ partial "pagination.html" . }}
{{- end }}

View File

@ -0,0 +1,25 @@
<div class="footer">
<div class="nav nav-bottom">
<ul>
{{- range .Site.Menus.footer }}
<li>
{{- if .URL }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{- else }}
{{ .Name }}
{{- end }}
</li>
{{- end }}
{{- with .Site.RSSLink }}
<li>
<a href="{{ . }}">RSS</a>
</li>
{{- end }}
</ul>
</div>
{{- with .Site.Copyright }}
<div class="copyright">
&copy; {{ now.Format "2006" }} &mdash; {{ . }}
</div>
{{- end }}
</div>

View File

@ -0,0 +1,17 @@
<div class="header">
<a class="title" href="{{ .Site.Home.URL }}">{{ .Site.Title }}</a>
{{- with .Site.Params.subtitle }}
<span class="description"> {{ . }}</span>
{{- end }}
</div>
<div class="nav nav-top">
<ul>
{{- $curr := . }}
{{- range .Site.Menus.main }}
{{- $selected := cond (or ($curr.IsMenuCurrent "main" .) ($curr.HasMenuCurrent "main" .)) " pure-menu-selected" "" }}
<li>
<a href="{{.URL}}">{{ .Name }}</a>
</li>
{{- end }}
</ul>
</div>

View File

@ -0,0 +1,48 @@
{{ $pag := .Paginator }}
<div class="pagination">
<span>Pages:</span>
<ul>
<li>
<a href="{{ $pag.First.URL }}">First</a>
</li>
{{- with $pag.HasPrev }}
{{- if ne $pag.Prev.PageNumber $pag.First.PageNumber }}
{{- $ppage := $pag.Prev }}
{{- with $ppage.HasPrev }}
{{- if ne $ppage.Prev.PageNumber $pag.First.PageNumber }}
<li>
<a href="{{ $ppage.Prev.URL }}">{{ sub $pag.PageNumber 2 }}</a>
</li>
{{- end }}
{{- end }}
<li>
<a href="{{ $ppage.URL }}">{{ sub $pag.PageNumber 1 }}</a>
</li>
{{- end }}
{{- end }}
{{- if and (ne $pag.PageNumber $pag.First.PageNumber) (ne $pag.PageNumber $pag.Last.PageNumber) }}
<li class="selected">
<a href="{{ $pag.URL }}">{{ $pag.PageNumber }}</a>
</li>
{{- end }}
{{- with $pag.HasNext }}
{{- if ne $pag.Next.PageNumber $pag.Last.PageNumber }}
{{- $npage := $pag.Next }}
<li>
<a href="{{ $npage.URL }}">{{ add $pag.PageNumber 1 }}</a>
</li>
{{- with $npage.HasNext }}
{{- if ne $npage.Next.PageNumber $pag.Last.PageNumber }}
<li>
<a href="{{ $npage.Next.URL }}">{{ add $pag.PageNumber 2 }}</a>
</li>
{{- end }}
{{- end }}
{{- end }}
{{- end }}
<li>
<a href="{{ $pag.Last.URL }}">Last</a>
</li>
</ul>
</div>

View File

@ -0,0 +1,18 @@
<div class="post-meta">
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Date.Format (cond (isset $.Site.Params "datefmt") $.Site.Params.datefmt "01-02-2006") -}}
</time>
{{- range $taxo := (slice "Categories" "Series" "Tags") }}
{{- $elems := $.Param $taxo }}
{{- if $elems }}
{{ $taxo }}: &#x5b;
{{- range $name := $elems }}
{{- with $.Site.GetPage (lower (printf "/%s/%s" $taxo (urlize $name))) }}
<a href="{{ .Permalink }}">{{ $name }}</a>
{{- end }}
{{- end }}
&#x5d;
{{- end }}
{{- end }}
</div>

51
static/assets/style.css Normal file
View File

@ -0,0 +1,51 @@
html
{
font-family: serif;
}
body
{
max-width: 100ch;
margin: auto;
}
.header
{
font-size: 150%;
margin-bottom: 1em;
font-family: sans-serif;
}
.header .description
{
font-size: 75%;
}
.nav ul, .pagination ul
{
font-family: sans-serif;
margin: 0;
padding: 0;
display:inline-block;
}
.nav li, .pagination li
{
list-style: none;
display:inline-block;
margin-right: 0.5em;
padding: 0;
}
h1, h2, h3, h4, h5, h6, h7, h8
{
font-family: sans-serif;
}
.footer
{
margin-top: 1em;
}
.copyright
{
margin-top: 1em;
}

17
theme.toml Normal file
View File

@ -0,0 +1,17 @@
name = "nocolor"
license = "MIT"
licenselink = "http://opensource.org/licenses/MIT"
description = "A Hugo theme with no predefined colors."
homepage = "https://schlomp.space/tastytea/hugo-theme-nocolor"
tags = ["blog", "minimal", "high contrast"]
features = ["responsive", "black-and-white", "fulltext rss feed"]
min_version = "0.43"
[author]
name = "tastytea"
homepage = "https://tastytetea.de/"
[original]
name = "Slick"
homepage = "https://themes.gohugo.io/slick"
repo = "https://github.com/spookey/slick"