merge upstream

This commit is contained in:
Niklas Buschmann 2020-02-05 21:54:37 +01:00
parent 068f48121b
commit 5047a8d02e
4 changed files with 47 additions and 68 deletions

View File

@ -7,50 +7,46 @@ To install Contrast as your default theme, first install this repository in the
$ cd themes/ $ cd themes/
$ git clone https://github.com/niklasbuschmann/contrast-hugo.git $ git clone https://github.com/niklasbuschmann/contrast-hugo.git
Second, specify `contrast-hugo` as your default theme in the `config.toml` file. Just add the line Second, specify `contrast-hugo` as your default theme in the `config.yaml` file. Just add the line
theme = "contrast-hugo" theme: "contrast-hugo"
at the top of the file. at the top of the file.
## Options
In the `params` section of your config, you can enable a dark header style with `darkheader = true` and [icon](https://fontawesome.com/icons) support with `fontawesome = true` - which can be used by adding `pre` entries to your site's [menu](https://gohugo.io/content-management/menus/). The site title in the header can also be hidden with `hidetitle = true`.
## Sidebar ## Sidebar
Instead of the horizontal menu, a sidebar can be enabled with `sidebar = true`. See [here](https://niklasbuschmann.github.io/contrast/) for an example of the sidebar in action. Adding a `hidden` class to the icon tag will hide the icon on mobile devices. Instead of the horizontal menu, a sidebar can be enabled with `sidebar: true`. See [here](https://niklasbuschmann.github.io/contrast/) for an example of the sidebar in action. Adding a `hidden` class to the icon tag will hide the icon on mobile devices.
An example `config.yaml` could look like this: An example `config.yaml` section could look like this:
```yaml ```yaml
params: params:
sidebar = true sidebar: true
fontawesome = true fontawesome: true
description = 'Made by <a href="">John Doe</a>' description: 'Made by <a href="">Blog Author</a>'
menu: menu:
main: main:
- identifier = "home" - identifier: "home"
name = "Home" name: "Home"
url = "/" url: "/"
weight = 1 weight: 1
pre = "<span class='fas fa-home hidden'></span>" pre: "<span class='fas fa-home hidden'></span>"
- identifier = "about" - identifier: "about"
name = "About" name: "About"
url = "/about/" url: "/about/"
weight = 2 weight: 2
pre = "<span class='fas fa-address-card hidden'></span>" pre: "<span class='fas fa-address-card hidden'></span>"
- identifier = "github" - identifier: "github"
name = "Github" name: "Github"
url = "https://github.com/" url: "https://github.com/"
weight = 3 weight: 3
pre = "<span class='fab fa-github hidden'></span>" pre: "<span class='fab fa-github hidden'></span>"
- identifier = "feed" - identifier: "feed"
name = "Subscribe" name: "Subscribe"
url = "/index.xml" url: "/index.xml"
weight = 4 weight: 4
pre = "<span class='fas fa-rss hidden'></span>" pre: "<span class='fas fa-rss hidden'></span>"
``` ```
## Features ## Features

View File

@ -22,10 +22,9 @@
{{ partial "math.html" . }} {{ partial "math.html" . }}
{{- end }} {{- end }}
<header class="{{ if .Site.Params.darkheader }}dark{{ end }} {{ if gt (len .Site.Menus) 1 }}full{{ end }}"> <header>
{{ $url := .RelPermalink }} {{ if not (gt (len .Site.Menus) 1) }}<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>{{ end }}
{{ if not .Site.Params.hidetitle }}<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>{{ end }} {{ range .Site.Menus }}<nav>{{ range . }}<a href="{{ .URL }}" {{ if (eq $.RelPermalink .URL) }}class="selected"{{ end }}>{{ .Pre }}{{ .Name }}{{ .Post }}</a>{{ end }}</nav>{{ end }}
{{ range .Site.Menus }}<nav>{{ range . }}<a href="{{ .URL }}" {{ if (eq $url .URL) }}class="selected"{{ end }}>{{ .Pre }}{{ .Name }}{{ .Post }}</a>{{ end }}</nav>{{ end }}
{{ with .Site.Params.description }}<div class="hidden">{{ safeHTML . }}</div>{{ end }} {{ with .Site.Params.description }}<div class="hidden">{{ safeHTML . }}</div>{{ end }}
</header> </header>

View File

@ -1,9 +1,3 @@
.dark {
background: #1e1f25;
color: #fff;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.archive li { .archive li {
font-size: 1.1em; font-size: 1.1em;
} }
@ -14,16 +8,10 @@
margin: 0 .2em; margin: 0 .2em;
} }
.full > a {
font-size: 1.5em;
width: 100%;
margin: .1em 0 .6em;
}
.hidden { .hidden {
display: none; display: none;
} }
.fa, .fab, .fad, .fal, .far, .fas { .fa, .fab, .fad, .fal, .far, .fas {
margin-right: .6em; margin-right: 1.2em;
} }

View File

@ -1,11 +1,10 @@
body { body {
font-size: 18px; font-size: 1.08em;
padding: 0 4em;
margin-left: 16em; margin-left: 16em;
} }
body > article, body > footer { body > article {
margin: 0 auto; margin: 0 4em;
padding: 2em 0; padding: 2em 0;
max-width: 55em; max-width: 55em;
} }
@ -17,7 +16,7 @@ body > header {
color: #fff; color: #fff;
border: none; border: none;
box-shadow: none; box-shadow: none;
opacity: .96; opacity: .98;
margin: 0; margin: 0;
padding: 2.2em 2em; padding: 2.2em 2em;
width: 12em; width: 12em;
@ -37,30 +36,27 @@ nav a {
} }
nav a:hover, nav a.selected { nav a:hover, nav a.selected {
background: #23242a; background: #212228;
text-decoration: inherit; text-decoration: inherit;
} }
nav a svg { body > header > a {
margin-right: 1.2em; font-family: "PT Serif", Georgia;
font-size: 2.2em;
display: block;
margin: 0 0 1.5rem;
} }
article header h1 { article header h1 {
font-size: 2em; font-size: 2em;
} }
header > div {
position: absolute;
margin: 2em 0;
bottom: 0;
}
.hidden { .hidden {
display: inline-block; display: inline-block;
} }
header > div {
margin-top: 3em;
}
body > header > a {
display: none;
}
.fa, .fab, .fad, .fal, .far, .fas {
margin-right: 1.2em;
}