casper3 | new theme!

This commit is contained in:
Don Harper 2021-04-04 22:38:49 -05:00
parent afc968f2fd
commit 79bd0dfa77
27 changed files with 1989 additions and 0 deletions

21
themes/casper3/LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Jonathan Janssens
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

36
themes/casper3/README.md Normal file
View file

@ -0,0 +1,36 @@
## Demo
A demo with feature images is available in the repository [jonathanjanssens/hugo-casper3-demo](https://github.com/jonathanjanssens/hugo-casper3-demo).
## Installation
```$ mkdir themes
$ cd themes
$ git clone git@github.com:jonathanjanssens/hugo-casper3.git
```
Either set the theme in your config to `casper3` or build with the `-t casper3` flag.
## Using the theme
This theme is very image heavy so it is recommended to set a `feature_image` parameter in the front matter of any content.
Content types you wish to appear on the homepage should be set in your [mainSections](https://gohugo.io/functions/where/#mainsections).
## Development Roadmap
[ ] Use SCSS from original theme instead of compiled CSS - also needs Hugo Pipes setting up
[ ] Multi author support and author taxonomy
## Support
It would be nice if you leave the credit to me in the footer, unless you make a donation to show support. I can't really police this though, it's MIT licensed anyway so you can do whatever you want with the theme...
If you would like to show your appreciation to me for working on this theme you can <a href="https://paypal.me/JonathanJanssens">donate with Paypal</a> here.
BTC: 1812FGaAJ19hokDoUFP6kK22dzT6zttkw5
LTC: MQh5n9BzXAVzdreMo9ff3DxF7gqqmZkUNJ
ETH: 0x6c6DCa4cA98816Bb319A4B923b159991C97368B7

View file

@ -0,0 +1,3 @@
+++
featured_image = ""
+++

View file

@ -0,0 +1,5 @@
.post-content > div {
width: 100%;
}
post-content:a {text-decoration: line; background-color:transparent; text-underline-position: under;color:green; background-color:blue}
a:active,a:hover {outline:1; text-underline-position: above; color:hotpink;}

View file

@ -0,0 +1 @@
a,abbr,acronym,address,applet,article,aside,audio,big,blockquote,body,canvas,caption,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,ul,var,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}img{max-width:100%}html{box-sizing:border-box;font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}*,:after,:before{box-sizing:inherit}a{background-color:transparent}a:active,a:hover{outline:0}b,strong{font-weight:700}dfn,em,i{font-style:italic}h1{margin:.67em 0;font-size:2em}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}mark{background-color:#fdffb6}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;color:inherit;font:inherit}button{overflow:visible;border:none}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input:focus{outline:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}legend{padding:0;border:0}textarea{overflow:auto}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}html{overflow-y:scroll;font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}body,html{overflow-x:hidden}body{color:#313b3f;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-size:1.6rem;line-height:1.6em;font-weight:400;font-style:normal;letter-spacing:0;text-rendering:optimizeLegibility;background:#fff;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-moz-font-feature-settings:"liga" on}::-moz-selection{text-shadow:none;background:#cbeafb}::selection{text-shadow:none;background:#cbeafb}hr{position:relative;display:block;width:100%;margin:2.5em 0 3.5em;padding:0;height:1px;border:0;border-top:1px solid #e3e9ed}audio,canvas,iframe,img,svg,video{vertical-align:middle}fieldset{margin:0;padding:0;border:0}textarea{resize:vertical}blockquote,dl,ol,p,ul{margin:0 0 1.5em}ol,ul{padding-left:1.3em;padding-right:1.5em}ol ol,ol ul,ul ol,ul ul{margin:.5em 0 1em}ul{list-style:disc}ol{list-style:decimal}ol,ul{max-width:100%}li{margin:.5em 0;padding-left:.3em;line-height:1.6em}dt{float:left;margin:0 20px 0 0;width:120px;color:#15171a;font-weight:500;text-align:right}dd{margin:0 0 5px;text-align:left}blockquote{margin:1.5em 0;padding:0 1.6em;border-left:.5em solid #e5eff5}blockquote p{margin:.8em 0;font-size:1.2em;font-weight:300}blockquote small{display:inline-block;margin:.8em 0 .8em 1.5em;font-size:.9em;opacity:.8}blockquote small:before{content:"\2014 \00A0"}blockquote cite{font-weight:700}blockquote cite a{font-weight:400}a{color:#26a8ed;text-decoration:none}a:hover{text-decoration:underline}h1,h2,h3,h4,h5,h6{margin-top:0;line-height:1.15;font-weight:600;text-rendering:optimizeLegibility}h1{margin:0 0 .5em;font-size:5.5rem;font-weight:600}@media (max-width:500px){h1{font-size:2.2rem}}h2{margin:1.5em 0 .5em;font-size:2.2rem}@media (max-width:500px){h2{font-size:1.8rem}}h3{margin:1.5em 0 .5em;font-size:1.8rem;font-weight:500}@media (max-width:500px){h3{font-size:1.7rem}}h4{margin:1.5em 0 .5em;font-size:1.6rem;font-weight:500}h5,h6{margin:1.5em 0 .5em;font-size:1.4rem;font-weight:500}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
{{ $title := print .Title " · " .Site.Title }}
{{ if .IsHome }}{{ $title = .Site.Title }}{{ end }}
<title>{{ $title }}</title>
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{ $styles := resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "style.main.scss" . | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" />
</head>
<body class="{{ block "body_class" . }} {{ end }}">
<div class="site-wrapper">
{{- block "main" . }}{{- end }}
<footer class="site-footer outer">
<div class="site-footer-content inner">
<section class="copyright"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> &copy; {{ .Date.Format "2006" }}</section>
<nav class="site-footer-nav">
<a href="{{ .Site.BaseURL }}">Latest Posts</a>
{{ if .Site.Params.facebook }}<a href="{{ .Site.Params.facebook }}" target="_blank" rel="noopener">Facebook</a>{{ end }}
{{ if .Site.Params.twitter }}<a href="{{ .Site.Params.twitter }}" target="_blank" rel="noopener">Twitter</a>{{ end }}
{{ if .Site.Params.github }}<a href="{{ .Site.Params.github }}" target="_blank" rel="noopener">Github</a>{{ end }}
<a href="https://jonathanjanssens.com" target="_blank" rel="noopener" style="opacity: 0.5;">Hugo Casper3 by Jonathan Janssens</a>
</nav>
</div>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,32 @@
{{ define "body_class" }} tag-template {{ end }}
{{ define "main" }}
<header class="site-header">
{{- partial "site-header.html" $ -}}
{{- partial "header-background.html" $ -}}
<div class="inner site-header-content">
<h1 class="site-title">{{ .Title }}</h1>
<h2 class="site-description">
{{ if .Param "description" }}
{{ .Param "description" }}
{{ else }}
A collection of {{ len .Pages }} post{{ if gt (len .Pages) 1 }}s{{ end }}
{{ end }}
</h2>
</div>
</div>
</header>
<main id="site-main" class="site-main outer">
<div class="inner posts">
<div class="post-feed">
{{ range $index, $element := .Pages }}
{{- partial "post-card.html" (dict "context" . "index" $index "home" $.IsHome) -}}
{{ end }}
</div>
</div>
</main>
{{ end }}

View file

@ -0,0 +1,71 @@
{{ define "body_class" }} post-template {{ end }}
{{ define "main" }}
<header class="site-header">
{{- partial "site-header.html" $ -}}
</header>
<main id="site-main" class="site-main outer">
<div class="inner">
<article class="post-full post {{ if not (.Param "featured_image") }} no-image {{ end }}">
<header class="post-full-header">
{{ with .Params.tags }}
{{ $primaryTag := (index . 0) }}
<section class="post-full-tags">
<a href="{{ "/tags/" | relLangURL }}{{ $primaryTag | urlize }}">{{ $primaryTag }}</a>
</section>
{{ end }}
<h1 class="post-full-title">{{ .Title }}</h1>
{{ if .Param "summary" }}
<p class="post-full-custom-excerpt">{{ .Summary }}</p>
{{ end }}
<div class="post-full-byline">
<section class="post-full-byline-content">
{{ if .Param "author" }}
{{- partial "post-author.html" . -}}
{{ end }}
<section class="post-full-byline-meta">
{{ if .Param "author" }}
<h4 class="author-name">{{ .Param "author" }}</h4>
{{ end }}
<div class="byline-meta-content">
<time class="byline-meta-date" datetime="{{.Date.Format "2006-31-01"}}">{{.Date.Format "2 January 2006"}}</time>
<span class="byline-reading-time"><span class="bull">&bull;</span> {{ .ReadingTime }} min read</span>
</div>
</section>
</section>
</div>
</header>
{{ if .Param "featured_image" }}
<figure class="post-full-image">
<img src="{{ .Param "featured_image" }}" alt="{{ .Title }}" />
</figure>
{{ end }}
<section class="post-full-content">
<div class="post-content">
{{ .Content }}
</div>
</section>
</article>
</div>
</main>
{{- partial "post-navigation.html" . -}}
{{ end }}

View file

@ -0,0 +1,36 @@
{{ define "body_class" }} home-template {{ end }}
{{ define "main" }}
<header class="site-home-header">
{{ .Scratch.Set "background" .Params.featured_image }}
{{- partial "header-background.html" . -}}
<div class="inner">
{{- partial "site-nav.html" . -}}
<div class="site-header-content">
<h1 class="site-title">
{{ if $.Site.Params.logo }}
<img class="site-logo" src="{{ $.Site.Params.logo }}" alt="{{ .Site.Title }}" />
{{ else }}
{{ $.Site.Title }}
{{ end }}
</h1>
<h2 class="site-description">{{ $.Site.Params.description }}</h2>
</div>
</div>
</div>
</header>
<main id="site-main" class="site-main outer">
<div class="inner posts">
<div class="post-feed">
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ range $index, $element := $pages }}
{{- partial "post-card.html" (dict "context" . "index" $index "home" $.IsHome) -}}
{{ end }}
</div>
</div>
</main>
{{ end }}

View file

@ -0,0 +1,10 @@
{{ if .Scratch.Get "background" }}
<style type="text/css">
.responsive-header-img {
background-image: url('{{ .Scratch.Get "background" }}');
}
</style>
<div class="outer site-header-background responsive-header-img">
{{ else }}
<div class="outer site-header-background no-image">
{{ end }}

View file

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M3.513 18.998C4.749 15.504 8.082 13 12 13s7.251 2.504 8.487 5.998C18.47 21.442 15.417 23 12 23s-6.47-1.558-8.487-4.002zM12 12c2.21 0 4-2.79 4-5s-1.79-4-4-4-4 1.79-4 4 1.79 5 4 5z" fill="#FFF"/></g></svg>

After

Width:  |  Height:  |  Size: 307 B

View file

@ -0,0 +1 @@
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M16 0c8.837 0 16 7.163 16 16s-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0zm5.204 4.911h-3.546c-2.103 0-4.443.885-4.443 3.934.01 1.062 0 2.08 0 3.225h-2.433v3.872h2.509v11.147h4.61v-11.22h3.042l.275-3.81h-3.397s.007-1.695 0-2.187c0-1.205 1.253-1.136 1.329-1.136h2.054V4.911z" /></svg>

After

Width:  |  Height:  |  Size: 350 B

View file

@ -0,0 +1,11 @@
<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
<path opacity="0.2" fill="#000" d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946
s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634
c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z" />
<path fill="#000" d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0
C22.32,8.481,24.301,9.057,26.013,10.047z">
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 20 20" to="360 20 20"
dur="0.5s" repeatCount="indefinite" />
</path>
</svg>

After

Width:  |  Height:  |  Size: 923 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="6.18" cy="17.82" r="2.18"/><path d="M4 4.44v2.83c7.03 0 12.73 5.7 12.73 12.73h2.83c0-8.59-6.97-15.56-15.56-15.56zm0 5.66v2.83c3.9 0 7.07 3.17 7.07 7.07h2.83c0-5.47-4.43-9.9-9.9-9.9z"/></svg>

After

Width:  |  Height:  |  Size: 262 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M30.063 7.313c-.813 1.125-1.75 2.125-2.875 2.938v.75c0 1.563-.188 3.125-.688 4.625a15.088 15.088 0 0 1-2.063 4.438c-.875 1.438-2 2.688-3.25 3.813a15.015 15.015 0 0 1-4.625 2.563c-1.813.688-3.75 1-5.75 1-3.25 0-6.188-.875-8.875-2.625.438.063.875.125 1.375.125 2.688 0 5.063-.875 7.188-2.5-1.25 0-2.375-.375-3.375-1.125s-1.688-1.688-2.063-2.875c.438.063.813.125 1.125.125.5 0 1-.063 1.5-.25-1.313-.25-2.438-.938-3.313-1.938a5.673 5.673 0 0 1-1.313-3.688v-.063c.813.438 1.688.688 2.625.688a5.228 5.228 0 0 1-1.875-2c-.5-.875-.688-1.813-.688-2.75 0-1.063.25-2.063.75-2.938 1.438 1.75 3.188 3.188 5.25 4.25s4.313 1.688 6.688 1.813a5.579 5.579 0 0 1 1.5-5.438c1.125-1.125 2.5-1.688 4.125-1.688s3.063.625 4.188 1.813a11.48 11.48 0 0 0 3.688-1.375c-.438 1.375-1.313 2.438-2.563 3.188 1.125-.125 2.188-.438 3.313-.875z"/></svg>

After

Width:  |  Height:  |  Size: 888 B

View file

@ -0,0 +1,13 @@
<ul class="author-list">
<li class="author-list-item">
<div class="author-card">
<div class="author-profile-image">{{- partial "icons/avatar.html" -}}</div>
<div class="author-info">
<div class="author-info">
<h2>{{ .Param "author" }}</h2>
</div>
</div>
</div>
<a href="#" class="author-avatar author-profile-image">{{- partial "icons/avatar.html" -}}</a>
</li>
</ul>

View file

@ -0,0 +1,49 @@
<article class="post-card post
{{ if not (.context.Param "featured_image") }} no-image
{{ else }}
{{ if (eq (mod .index 6) 0) }} post-card-large {{ end }}
{{ end }} ">
{{ if .context.Param "featured_image" }}
<a class="post-card-image-link" href="{{ .context.Permalink }}">
<img class="post-card-image"src="{{ .context.Param "featured_image" }}" alt="{{ .context.Title }}"/>
</a>
{{ end }}
<div class="post-card-content">
<a class="post-card-content-link" href="{{ .context.Permalink }}">
<header class="post-card-header">
{{ with .context.Params.tags }}
{{ $primaryTag := (index . 0) }}
<div class="post-card-primary-tag">{{ $primaryTag }}</div>
{{ end }}
<h2 class="post-card-title">{{ .context.Title }}</h2>
</header>
<section class="post-card-excerpt">
<p>{{ .context.Summary }}</p>
</section>
</a>
<footer class="post-card-meta">
<ul class="author-list">
<li class="author-list-item">
<div class="author-name-tooltip">{{ .context.Param "author" }}</div>
<a href="#" class="static-avatar author-profile-image">{{- partial "icons/avatar.html" -}}</a>
</li>
</ul>
<div class="post-card-byline-content">
<span>{{ .context.Param "author" }}</span>
<span class="post-card-byline-date"><time datetime="{{ .context.Date.Format "2006-31-01" }}">{{ .context.Date.Format "2 January 2006" }}</time>
<span class="bull">&bull;</span> {{ .context.ReadingTime }} min read</span>
</div>
</footer>
</div>
</article>

View file

@ -0,0 +1,17 @@
<aside class="read-next outer">
<div class="inner">
<div class="read-next-feed">
{{- partial "read-next.html" . -}}
{{ with .PrevInSection}}
{{- partial "post-card.html" (dict "context" . "index" 1) -}}
{{end}}
{{ with .NextInSection}}
{{- partial "post-card.html" (dict "context" . "index" 1) -}}
{{end}}
</div>
</div>
</aside>

View file

@ -0,0 +1,22 @@
{{ with .Params.tags }}
{{ $primaryTag := (index . 0) }}
<article class="read-next-card">
<header class="read-next-card-header">
<h3><span>More in</span> <a href="{{ "/tags/" | relLangURL }}{{ $primaryTag | urlize }}">{{ $primaryTag }}</a></h3>
</header>
<div class="read-next-card-content">
<ul>
{{ range first 3 (where (index $.Site.Taxonomies.tags $primaryTag).Pages "Section" "post") }}
<li>
<h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
<div class="read-next-card-meta">
<p><time datetime="{{.Date.Format "2006-31-01"}}">{{.Date.Format "01 Jan 2006"}}</time>
{{ if .Params.reading_time }} {{ .Params.reading_time }} {{ end }}
</p>
</div>
</li>
{{ end }}
</ul>
</div>
</article>
{{ end }}

View file

@ -0,0 +1,6 @@
<div class="outer site-nav-main">
<div class="inner">
{{- partial "site-nav.html" . -}}
{{ partial "victorhugo.html" . }}
</div>
</div>

View file

@ -0,0 +1,19 @@
<nav class="site-nav">
<div class="site-nav-left">
{{ if eq $.Site.Params.logo "thisshouldfail" }}
<a class="site-nav-logo" href="{{ $.Site.BaseURL }}"><img src="{{ $.Site.Params.logo }}" alt="{{ $.Site.Title }}" /></a>
{{ else }}
<a class="site-nav-logo" href="{{ $.Site.BaseURL }}">{{ $.Site.Title }}</a>
{{ end }}
<div class="site-nav-content">
<ul class="nav" role="menu">
{{ range $.Site.Menus.main }}
<li class="nav-home" role="menuitem"><a href="{{ .URL }}">{{- .Name -}}</a></li>
{{ end }}
</ul>
</div>
</div>
</nav>

File diff suppressed because it is too large Load diff

19
themes/casper3/theme.toml Normal file
View file

@ -0,0 +1,19 @@
name = "casper3"
license = "MIT"
licenselink = "https://github.com/jonathanjanssens/hugo-casper3/blob/master/LICENSE"
description = "The default Casper version 3 theme from Ghost CMS ported over to Hugo"
tags = ["blog", "dark", "light"]
features = ["darkmode"]
min_version = "0.54.0"
[author]
name = "Jonathan Janssens"
homepage = "https://jonathanjanssens.com"
repo = "https://github.com/jonathanjanssens/projects/hugo-casper3"
[original]
name = "Ghost"
homepage = "https://ghost.org"
repo = "https://github.com/TryGhost/Casper"