This commit is contained in:
Niklas Buschmann 2020-11-25 20:51:00 +01:00
parent aa7b9056cf
commit 80ab8e36c3
9 changed files with 5 additions and 56602 deletions

View File

@ -13,37 +13,6 @@ Second, specify `contrast-hugo` as your default theme in the `config.yaml` file.
at the top of the file. at the top of the file.
## 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.
An example `config.yaml` section could look like this:
```yaml
params:
sidebar: true
show_excerpts: true
description: 'Made by <a href="">Blog Author</a>'
menu:
main:
- {name: "Home", url: "/", identifier: "home", weight: 1}
- {name: "About", url: "/about/", identifier: "address-card", weight: 2}
remote:
- {name: "Mail", url: "mailto:", identifier: "envelope", weight: 3}
- {name: "Github", url: "https://github.com/", identifier: "github", weight: 4}
- {name: "Subscribe", url: "/index.xml", identifier: "rss", weight: 5}
```
## Features
- supports dark mode on macOS Mojave
- optional sidebar
- MathJax support
- no external resources
- responsive
## Based on ## Based on
- [Hyde](https://github.com/poole/hyde) - [Hyde](https://github.com/poole/hyde)

View File

@ -1,36 +0,0 @@
license = """
Font Awesome Free License
-------------------------
Font Awesome Free is free, open source, and GPL friendly. You can use it for
commercial projects, open source projects, or really almost whatever you want.
Full Font Awesome Free license: https://fontawesome.com/license/free.
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
packaged as SVG and JS file types.
# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
In the Font Awesome Free download, the SIL OFL license applies to all icons
packaged as web and desktop font files.
# Code: MIT License (https://opensource.org/licenses/MIT)
In the Font Awesome Free download, the MIT license applies to all non-font and
non-icon files.
# Attribution
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
Awesome Free files already contain embedded comments with sufficient
attribution, so you shouldn't need to do anything additional when using these
files normally.
We've kept attribution comments terse, so we ask that you do not actively work
to remove them from files, especially code. They're a great way for folks to
learn about Font Awesome.
# Brand Icons
All brand icons are trademarks of their respective owners. The use of these
trademarks does not indicate endorsement of the trademark holder by Font
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
to represent the company, product, or service to which they refer.**
"""

File diff suppressed because one or more lines are too long

View File

@ -8,45 +8,25 @@
{{- end }} {{- end }}
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/index.css"> <link rel="stylesheet" href="{{ .Site.BaseURL }}css/index.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/classes.css">
{{- if .Site.Params.sidebar }}
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/sidebar.css" media="screen and (min-width: 70em)">
{{- end }}
<link rel="canonical" href="{{ .Permalink }}"> <link rel="canonical" href="{{ .Permalink }}">
<link rel="alternate" type="application/rss+xml" href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" title="{{ .Site.Title }}"> <link rel="alternate" type="application/rss+xml" href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" title="{{ .Site.Title }}">
{{- if or .Params.math .Site.Params.math }} {{- if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }} {{ partial "math.html" . }}
{{- end }} {{- end }}
<body> <header>
<header class="icons">
{{ if not (gt (len .Site.Menus) 1) }} {{ if not (gt (len .Site.Menus) 1) }}
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
{{ end }} {{ end }}
{{ range $menu, $items := .Site.Menus }} {{ range $menu, $items := .Site.Menus }}
<nav> <nav>
{{ range $items }} {{ range $items }}
<a href="{{ .URL }}" {{ if (eq $.RelPermalink .URL) }}class="selected"{{ end }}> <a href="{{ .URL }}">{{ .Name }}</a>
{{ if and .Identifier (index $.Site.Data.fontawesome.icons .Identifier) }}
{{ $icon := index $.Site.Data.fontawesome.icons .Identifier }}
{{ $svg := $icon.svg.solid | default $icon.svg.regular | default $icon.svg.brands }}
<span {{ if eq $menu "main" }}class="hidden"{{ end }}>{{ safeHTML $svg.raw }}</span>
<span {{ if not (eq $menu "main") }}class="hidden"{{ end }}>{{ .Name }}</span>
{{ else }}
{{ .Name }}
{{ end }}
</a>
{{ end }} {{ end }}
</nav> </nav>
{{ end }} {{ end }}
{{ with .Site.Params.description }}
<div class="hidden description">{{ safeHTML . }}</div>
{{ end }}
</header> </header>
{{- block "main" . }}{{- end }} {{- block "main" . }}{{- end }}
</body>
</html> </html>

View File

@ -6,29 +6,12 @@
{{ $Pages = where site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $Pages = where site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ end }} {{ end }}
{{ if .Site.Params.show_excerpts }}
{{- range $Pages }}
<article>
<header>
<h1>{{ .Title }}</h1>
{{ if .Date }}<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "January 02, 2006" }}</time>{{ end }}
</header>
{{ .Summary }}
{{- if .Truncated }}
<div class="more"><a href="{{ .RelPermalink }}">read more</a></div>
{{- end }}
</article>
{{- end }}
{{ else }}
<article> <article>
<header><h1>{{ .Title | default "Posts" | humanize }}</h1></header> <header><h1>{{ .Title | default "Posts" | humanize }}</h1></header>
<ul class="archive"> <ul>
{{- range $Pages }} {{- range $Pages }}
<li> <li style="font-size: 1.1em;">
{{ if .Date }}<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>{{ end }} {{ if .Date }}<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" style="display: inline-block; min-width: 10ch; margin: 0 .2em;">{{ .Date.Format "2006-01-02" }}</time>{{ end }}
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Title }}</a>
</li> </li>
{{- end }} {{- end }}
@ -37,5 +20,3 @@
</article> </article>
{{ end }} {{ end }}
{{ end }}

View File

@ -2,10 +2,6 @@
<article> <article>
<header> <header>
{{ range $index, $tag := .Params.categories }}
{{- if gt $index 0 }}, {{ end -}}
<a href="{{ ($.Site.GetPage (printf "/%s/%s" "categories" $tag)).Permalink }}">{{ $tag | upper }}</a>
{{- end -}}
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
{{ if .Date }}<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "January 02, 2006" }}</time>{{ end }} {{ if .Date }}<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "January 02, 2006" }}</time>{{ end }}
</header> </header>

View File

@ -1,39 +0,0 @@
.archive li {
font-size: 1.1em;
}
.archive time {
display: inline-block;
min-width: 10ch;
margin: 0 .2em;
}
.hidden {
display: none;
}
.more {
margin: 2em 0 1em;
}
.more a {
border-radius: 2px;
border: 1.5px solid #68f;
padding: .4em .8em;
transition: .2s;
}
.more a:hover {
color: #fff;
background: #68f;
text-decoration: inherit;
}
.icons svg {
height: 1em;
width: 1em;
fill: currentColor;
transition: .2s color;
vertical-align: middle;
margin-bottom: .15em;
}

View File

@ -51,10 +51,6 @@ body {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
}
b, strong, th { b, strong, th {
font-weight: 600; font-weight: 600;
} }
@ -81,10 +77,6 @@ hr {
margin: 2em 0; margin: 2em 0;
} }
article:not(:last-child) {
border-bottom: 1px solid rgba(142, 142, 145, 0.12);
}
blockquote { blockquote {
background: rgba(142, 142, 145, 0.06); background: rgba(142, 142, 145, 0.06);
border-left: 3px solid rgba(142, 142, 145, 0.9); border-left: 3px solid rgba(142, 142, 145, 0.9);

View File

@ -1,64 +0,0 @@
body {
font-size: 1.08em;
margin: 0 0 0 16em;
overscroll-behavior: none;
}
body > article, body > footer {
margin: 0 5em;
padding: 2em 0;
max-width: 50em;
}
body > header {
display: block;
position: fixed;
background: #17181c;
color: #fff;
border: none;
box-shadow: none;
opacity: .98;
margin: 0;
padding: 2.2em 2em;
width: 12em;
top: 0;
bottom: 0;
left: 0;
}
nav {
margin: 0 -2em;
}
nav a {
display: block;
margin: 0;
padding: .5em 2em;
}
nav a:hover, nav a.selected {
background: #212228;
text-decoration: inherit;
}
body > header > a {
display: block;
font-size: 1.5em;
margin-bottom: 1em;
}
article header h1 {
font-size: 2em;
}
.icons svg {
margin-right: 1rem;
}
.description {
margin: 2em 0;
}
.hidden {
display: inline-block;
}