diff --git a/README.md b/README.md index 9b35d07..55ec83b 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ # Casper Two -[Casper Two](https://github.com/eueung/hugo-casper-two) is a port of the [Casper](https://github.com/TryGhost/Casper), the default personal blogging theme for Ghost. While a legacy version (v1.x) has [already been ported](https://github.com/vjeantet/hugo-theme-casper) to Hugo years ago, it is incompatible with the recent 2.x version. So I ended up porting this new Casper version. It is currently functional, but not covered all page templates yet. They may be added in the future updates. +[Casper Two](https://github.com/eueung/hugo-casper-two) is a port of the [Casper](https://github.com/TryGhost/Casper), the default personal blogging theme for Ghost. While a legacy version (v1.x) has [already been ported](https://github.com/vjeantet/hugo-theme-casper) to Hugo years ago, it is incompatible with the recent 2.x version. So I ended up porting this new Casper version. ![Screenshot](https://raw.githubusercontent.com/eueung/hugo-casper-two/master/images/screenshot.png) ## Theme Demo -- [Sample Site](//eueung.github.io/hugo-casper-two/) +- [Sample Site](//eueung.github.io/hugo-casper-new/) ## Installation Inside the folder of your Hugo site run: $ cd themes - $ git clone https://github.com/eueung/hugo-casper-two.git casper-two + $ git clone https://github.com/eueung/hugo-casper-new.git casper-new For more information read the official [setup guide](//gohugo.io/overview/installing/) of Hugo. @@ -57,6 +57,9 @@ paginate = 6 pageNotFoundTitle = "404 - Page not found" + #casper or caspertwo + singleViewStyle = "casper" + [permalinks] post = "/:slug/" @@ -83,6 +86,7 @@ paginate = 6 Sample content structure is given in the `exampleSite` folder. Have fun! +![Screenshot](https://raw.githubusercontent.com/eueung/hugo-casper-two/master/images/single.jpg) ## License diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 2626b00..672d9a0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -9,7 +9,7 @@ canonifyurls = true [params] title = "Hugo Casper Two" subtitle = "Port of Casper 2.x for Hugo" - copyright = "Released under the MIT license." + copyright = "© 2018" cover = "img/blog-cover.jpg" description = "Here is a description of your site." @@ -35,6 +35,9 @@ canonifyurls = true pageNotFoundTitle = "404 - Page not found" + #casper or caspertwo + singleViewStyle = "casper" + [permalinks] post = "/post/:slug/" @@ -49,8 +52,8 @@ canonifyurls = true weight = 100 [[menu.main]] - name = "Food" - url = "/categories/food/" + name = "Categories" + url = "/categories/" weight = 99 [[menu.main]] diff --git a/images/single.jpg b/images/single.jpg new file mode 100644 index 0000000..f4c64e2 Binary files /dev/null and b/images/single.jpg differ diff --git a/layouts/404.html b/layouts/404.html index 0407c2b..fbaccfc 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,13 +1,18 @@ {{ partial "head" . }} -
- -{{ partial "header" . }} +{{if eq .Site.Params.singleViewStyle "casper"}} +
+ {{ partial "header-sori-error" . }} +{{else}} +
+ {{ partial "header" . }} +{{end}}
+{{if eq .Site.Params.singleViewStyle "casper"}} + +{{end}} + {{ partial "footer" . }}
{{ partial "js" . }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1f06616..0369b5b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,11 +1,15 @@ {{ partial "head" . }} -
+{{if ne .Site.Params.singleViewStyle "casper"}} +{{else}}{{end}} +
-{{ partial "header" . }} +{{if ne .Site.Params.singleViewStyle "casper"}}{{ partial "header" . }} +{{else}}{{ partial "header-sori" . }}{{end}}
+ {{if ne .Site.Params.singleViewStyle "casper"}}
{{ partial "post-single" . }}
@@ -19,9 +23,35 @@ Previous Post {{end}} + + {{else}} + {{ partial "post-single-sori" . }} + {{end}} + {{ partial "disqus" . }}
+{{if eq .Site.Params.singleViewStyle "casper"}} + + +{{ partial "header-floating-sori" . }} +{{end}} + {{ partial "footer" . }} -
{{ partial "js" . }} +
+{{ partial "js" . }} +{{if eq .Site.Params.singleViewStyle "casper"}}{{ partial "js-sori" . }}{{end}} + diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html new file mode 100644 index 0000000..54c5cc9 --- /dev/null +++ b/layouts/_default/taxonomy.html @@ -0,0 +1,30 @@ +{{ partial "head" . }} + +{{if eq .Site.Params.singleViewStyle "casper"}} +
+ {{ partial "header-sori-tag" . }} +{{else}} +
+ {{ partial "header" . }} +{{end}} + +
+
+
+ {{ partial "post-list" . }} +
+ + +
+
+ +{{ partial "footer" . }} +
{{ partial "js" . }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..0396bfc --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,36 @@ +{{ partial "head" . }} + +{{if eq .Site.Params.singleViewStyle "casper"}} +
+ {{ partial "header-sori-term" . }} +{{else}} +
+ {{ partial "header" . }} +{{end}} + +
+
+ {{if ne .Site.Params.singleViewStyle "casper"}} +
+ {{ partial "post-list" . }} +
+ + + {{else}} +
+ {{ partial "post-list-term" . }} +
+ {{end}} +
+
+ +{{ partial "footer" . }} +
{{ partial "js" . }} diff --git a/layouts/page/single.html b/layouts/page/single.html index f1f6be0..a997f36 100644 --- a/layouts/page/single.html +++ b/layouts/page/single.html @@ -1,14 +1,22 @@ {{ partial "head" . }} -
+{{if ne .Site.Params.singleViewStyle "casper"}} +{{else}}{{end}} +
+ +{{if ne .Site.Params.singleViewStyle "casper"}}{{ partial "header" . }} +{{else}}{{ partial "header-sori" . }}{{end}} -{{ partial "header" . }}
+ {{if ne .Site.Params.singleViewStyle "casper"}}
{{ partial "page-single" . }}
+ {{else}} + {{ partial "page-single-sori" . }} + {{end}}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 7cb97f2..bc5e1c0 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,7 +1,7 @@
+ \ No newline at end of file diff --git a/layouts/partials/header-sori-term.html b/layouts/partials/header-sori-term.html new file mode 100644 index 0000000..c2d3f6f --- /dev/null +++ b/layouts/partials/header-sori-term.html @@ -0,0 +1,45 @@ +
+ \ No newline at end of file diff --git a/layouts/partials/header-sori.html b/layouts/partials/header-sori.html new file mode 100644 index 0000000..ef0fdaa --- /dev/null +++ b/layouts/partials/header-sori.html @@ -0,0 +1,35 @@ +
+ \ No newline at end of file diff --git a/layouts/partials/js-sori.html b/layouts/partials/js-sori.html new file mode 100644 index 0000000..36c4c76 --- /dev/null +++ b/layouts/partials/js-sori.html @@ -0,0 +1,63 @@ + \ No newline at end of file diff --git a/layouts/partials/page-single-sori.html b/layouts/partials/page-single-sori.html new file mode 100644 index 0000000..bb2193f --- /dev/null +++ b/layouts/partials/page-single-sori.html @@ -0,0 +1,11 @@ +
+
+

{{.Title | title}}

+
+ +
+
+ {{ .Content }} +
+
+
\ No newline at end of file diff --git a/layouts/partials/post-list-term.html b/layouts/partials/post-list-term.html new file mode 100644 index 0000000..f4c81e7 --- /dev/null +++ b/layouts/partials/post-list-term.html @@ -0,0 +1,38 @@ +{{ $pages := ((where .Site.Pages "Type" "post") | shuffle) }} +{{ range first 3 $pages}} + + +{{ end }} diff --git a/layouts/partials/post-single-sori.html b/layouts/partials/post-single-sori.html new file mode 100644 index 0000000..97eb815 --- /dev/null +++ b/layouts/partials/post-single-sori.html @@ -0,0 +1,30 @@ +
+
+
+ {{if .Params.tags }} + / {{ range $index, $tag := .Params.tags }}{{if lt $index 2}}#{{$tag}} {{end}}{{end}}{{ end }} +
+

{{.Title}}

+
+ {{if .Params.image}} +
+
{{else}} +
+
{{end}} + +
+
+ {{ .Content }} +
+
+ + +
\ No newline at end of file diff --git a/layouts/partials/readnext-article-sori.html b/layouts/partials/readnext-article-sori.html new file mode 100644 index 0000000..9e5f321 --- /dev/null +++ b/layouts/partials/readnext-article-sori.html @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/layouts/partials/readnext-random-sori.html b/layouts/partials/readnext-random-sori.html new file mode 100644 index 0000000..c251581 --- /dev/null +++ b/layouts/partials/readnext-random-sori.html @@ -0,0 +1,23 @@ +{{ $posts := (where .Site.RegularPages "Section" "==" "post") }}{{ $postCount := len $posts }}{{if ge $postCount 4}}{{ $currentPage := . }} + +{{end}} diff --git a/static/css/casper-two.css b/static/css/casper-two.css index b55ff67..2501c61 100644 --- a/static/css/casper-two.css +++ b/static/css/casper-two.css @@ -69,4 +69,8 @@ .copyright { text-align: center; } -} \ No newline at end of file +} + +.post-full-content pre code { + color: #e5eff5; +} \ No newline at end of file