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/
$ 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.
## 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
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
params:
sidebar = true
fontawesome = true
description = 'Made by <a href="">John Doe</a>'
sidebar: true
fontawesome: true
description: 'Made by <a href="">Blog Author</a>'
menu:
main:
- identifier = "home"
name = "Home"
url = "/"
weight = 1
pre = "<span class='fas fa-home hidden'></span>"
- identifier = "about"
name = "About"
url = "/about/"
weight = 2
pre = "<span class='fas fa-address-card hidden'></span>"
- identifier = "github"
name = "Github"
url = "https://github.com/"
weight = 3
pre = "<span class='fab fa-github hidden'></span>"
- identifier = "feed"
name = "Subscribe"
url = "/index.xml"
weight = 4
pre = "<span class='fas fa-rss hidden'></span>"
- identifier: "home"
name: "Home"
url: "/"
weight: 1
pre: "<span class='fas fa-home hidden'></span>"
- identifier: "about"
name: "About"
url: "/about/"
weight: 2
pre: "<span class='fas fa-address-card hidden'></span>"
- identifier: "github"
name: "Github"
url: "https://github.com/"
weight: 3
pre: "<span class='fab fa-github hidden'></span>"
- identifier: "feed"
name: "Subscribe"
url: "/index.xml"
weight: 4
pre: "<span class='fas fa-rss hidden'></span>"
```
## Features

View File

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

View File

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

View File

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