Skip to content

Commit 0ab68a1

Browse files
committed
Updates from main repo, plus reading time and the number of posts shown on the homepage.
1 parent 9582e98 commit 0ab68a1

File tree

8 files changed

+91
-48
lines changed

8 files changed

+91
-48
lines changed

layouts/_default/baseof.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{{ end }}
2222
</body>
2323

24-
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
25-
<script src="/lib/jquery/jquery.min.js"></script>
26-
<script src="/js/main.js"></script>
24+
<link rel="stylesheet" href={{ "/lib/font-awesome/css/all.min.css" | relURL }}>
25+
<script src={{ "/lib/jquery/jquery.min.js" | relURL }}></script>
26+
<script src={{ "/js/main.js" | relURL }}></script>
2727
</html>

layouts/index.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
</section>
88

99
<section id="writing">
10-
<!-- TODO: use built in mainSections parameter https://gohugo.io/functions/where/#mainsections -->
1110
<span class="h1"><a href="{{ .Site.Params.mainSection | absURL }}">Writings</a></span>
1211
{{ if (and (and (isset .Site.Params "tagsoverview") (eq .Site.Params.tagsOverview true)) (gt (len .Site.Taxonomies.tags) 0)) }}
1312
<span class="h2">Most recent</span>
@@ -18,9 +17,10 @@
1817
{{ $showAllPostsOnHomePage = .Site.Params.ShowAllPostsOnHomePage }}
1918
{{ end }}
2019
{{ $dataFormat := .Site.Params.dateFormat | default "2006-01-02" }}
20+
{{ $mainPosts := (sort ( where site.RegularPages "Type" "in" site.Params.mainSections ) "Date" "desc") }}
2121
{{ if $showAllPostsOnHomePage }}
2222
<ul class="post-list">
23-
{{ range (sort .Paginator.Pages "Date" "desc") }}
23+
{{ range (.Paginate $mainPosts).Pages }}
2424
<li class="post-item">
2525
<div class="meta"><time datetime="{{ time .Date }}" itemprop="datePublished">{{ .Date.Format $dataFormat }}</time></div>
2626
<span><a href="{{ .Permalink }}">{{ if .Title }} {{- .Title -}} {{ else }} {{- print "Untitled" -}}{{ end }}</a></span>
@@ -29,15 +29,14 @@
2929
</ul>
3030

3131
{{ partial "pagination.html" . }}
32-
<!--<p><a href="https://natehn.com/posts" target="_blank">[see all writings]</a></p>-->
3332

3433
{{ else }}
3534
<ul class="post-list">
3635
{{ .Scratch.Set "count" 5 }}
3736
{{ if isset .Site.Params "postsonhomepage" }}
3837
{{ .Scratch.Set "count" .Site.Params.postsOnHomePage }}
3938
{{ end }}
40-
{{ range (first (.Scratch.Get "count") (sort .Site.RegularPages "Date" "desc")) }}
39+
{{ range (first (.Scratch.Get "count") $mainPosts) }}
4140
<li class="post-item">
4241
<div class="meta"><time datetime="{{ time .Date }}" itemprop="datePublished">{{ .Date.Format $dataFormat }}</time></div>
4342
<span><a href="{{ .Permalink }}">{{ if .Title }} {{- .Title -}} {{ else }} {{- print "Untitled" -}}{{ end }}</a></span>
@@ -46,6 +45,8 @@
4645
</ul>
4746
{{ end }}
4847

48+
<!--<div style="text-align: center"><span color="#999999"> Showing X of {{ len (where .Site.RegularPages "Section" "==" "posts") }} posts. <a href="https://natehn.com/posts">See more</a>. </span></div>-->
49+
4950
<span class="h2">Topics</span>
5051
<span class="widget tagcloud">
5152
{{ $AllRegularPagesCount := len .Site.RegularPages }}
@@ -65,7 +66,7 @@
6566
{{ end }}
6667
{{ if $showProjectsList }}
6768
{{ $projectsUrl := "#" }}
68-
{{ if isset .Site.Params "projectsUrl" }}
69+
{{ if isset .Site.Params "projectsurl" }}
6970
{{ $projectsUrl = .Site.Params.projectsUrl }}
7071
{{ end }}
7172
<section id="projects">

layouts/partials/footer.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
<div class="footer-right">
77
<nav>
88
<ul>
9-
{{ range .Site.Menus.main }}
9+
<!-- {{ range .Site.Menus.main }}
1010
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
11-
{{ end }}
11+
{{ end }} -->
1212
<li><a href="https://natehn.com/feed" >Feed</a></li>
1313
<li><a href="https://natehn.com/library" >Library</a></li>
14+
<li><a href="http://tilde.town/~natehn/" >Tilde</a></li>
1415
<li><a href="https://webring.xxiivv.com/#random" target='_blank'>Webring</a> <a href='https://webring.xxiivv.com/#random' target='_blank'><img src='https://natehn.com/icon.gray.svg' alt="Webring" height="9" width="9" ></a></li>
1516
</ul>
1617
</nav>

layouts/partials/header.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{{ if (isset .Site.Params "gravatar") }}
44
<div id="logo" style="background-image: url(https://www.gravatar.com/avatar/{{ md5 .Site.param.gravatar }}?s=100&d=identicon)"></div>
55
{{ else if (isset .Site.Params "logo") }}
6-
<div id="logo" style="background-image: url({{ .Site.Params.logo }})"></div>
6+
<div id="logo" style="background-image: url({{ .Site.Params.logo | absURL }})"></div>
77
{{ else }}
8-
<div id="logo" style="background-image: url({{ "images/logo.png" | absURL }})"></div>
8+
<div id="logo" style="background-image: url({{ "images/logo.png" | absURL }})"></div>
99
{{ end}}
1010
<div id="title">
1111
<h1>{{ .Site.Title }}</h1>
@@ -22,4 +22,4 @@ <h1>{{ .Site.Title }}</h1>
2222
</ul>
2323
</div>
2424
</header>
25-
25+

layouts/partials/share.html

-20
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
{{ .Scratch.Set "description" .Summary }}
77
{{ end }}
88
{{ $description := .Scratch.Get "description" }}
9-
<li>
10-
<a class="icon" href="http://www.facebook.com/sharer.php?u={{ .Permalink }}">
11-
<i class="fab fa-facebook {{ $icon_class_name }}" aria-hidden="true"></i>
12-
</a>
13-
</li>
149
<li>
1510
<a class="icon" href="https://twitter.com/share?url={{ .Permalink }}&text={{ .Title }}">
1611
<i class="fab fa-twitter {{ $icon_class_name }}" aria-hidden="true"></i>
@@ -21,11 +16,6 @@
2116
<i class="fab fa-linkedin {{ $icon_class_name }}" aria-hidden="true"></i>
2217
</a>
2318
</li>
24-
<li>
25-
<a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url={{ .Permalink }}&is_video=false&description={{ .Title }}">
26-
<i class="fab fa-pinterest {{ $icon_class_name }}" aria-hidden="true"></i>
27-
</a>
28-
</li>
2919
<li>
3020
<a class="icon" href="mailto:?subject={{ .Title }}&body=Check out this article: {{ .Permalink }}">
3121
<i class="fas fa-envelope {{ $icon_class_name }}" aria-hidden="true"></i>
@@ -41,16 +31,6 @@
4131
<i class="fab fa-reddit {{ $icon_class_name }}" aria-hidden="true"></i>
4232
</a>
4333
</li>
44-
<li>
45-
<a class="icon" href="http://www.stumbleupon.com/submit?url={{ .Permalink }}&title={{ .Title }}">
46-
<i class="fab fa-stumbleupon {{ $icon_class_name }}" aria-hidden="true"></i>
47-
</a>
48-
</li>
49-
<li>
50-
<a class="icon" href="http://digg.com/submit?url={{ .Permalink }}&title={{ .Title }}">
51-
<i class="fab fa-digg {{ $icon_class_name }}" aria-hidden="true"></i>
52-
</a>
53-
</li>
5434
<li>
5535
<a class="icon" href="http://www.tumblr.com/share/link?url={{ .Permalink }}&name={{ .Title }}&description={{ $description }}">
5636
<i class="fab fa-tumblr {{ $icon_class_name }}" aria-hidden="true"></i>

layouts/partials/share.html.save

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<ul>
2+
{{ $icon_class_name := .Scratch.Get "icon_class_name"}}
3+
{{ if .Description }}
4+
{{ .Scratch.Set "description" .Description }}
5+
{{ else }}
6+
{{ .Scratch.Set "description" .Summary }}
7+
{{ end }}
8+
{{ $description := .Scratch.Get "description" }}
9+
<li>
10+
<a class="icon" href="https://twitter.com/share?url={{ .Permalink }}&text={{ .Title }}">
11+
<i class="fab fa-twitter {{ $icon_class_name }}" aria-hidden="true"></i>
12+
</a>
13+
</li>
14+
<li>
15+
<a class="icon" href="http://www.linkedin.com/shareArticle?url={{ .Permalink }}&title={{ .Title }}">
16+
<i class="fab fa-linkedin {{ $icon_class_name }}" aria-hidden="true"></i>
17+
</a>
18+
</li>
19+
<li>
20+
<a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url={{ .Permalink }}&is_video=false&description={{ .Title }}">
21+
<i class="fab fa-pinterest {{ $icon_class_name }}" aria-hidden="true"></i>
22+
</a>
23+
</li>
24+
<li>
25+
<a class="icon" href="mailto:?subject={{ .Title }}&body=Check out this article: {{ .Permalink }}">
26+
<i class="fas fa-envelope {{ $icon_class_name }}" aria-hidden="true"></i>
27+
</a>
28+
</li>
29+
<li>
30+
<a class="icon" href="https://getpocket.com/save?url={{ .Permalink }}&title={{ .Title }}">
31+
<i class="fab fa-get-pocket {{ $icon_class_name }}" aria-hidden="true"></i>
32+
</a>
33+
</li>
34+
<li>
35+
<a class="icon" href="http://reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}">
36+
<i class="fab fa-reddit {{ $icon_class_name }}" aria-hidden="true"></i>
37+
</a>
38+
</li>
39+
<li>
40+
<a class="icon" href="http://www.stumbleupon.com/submit?url={{ .Permalink }}&title={{ .Title }}">
41+
<i class="fab fa-stumbleupon {{ $icon_class_name }}" aria-hidden="true"></i>
42+
</a>
43+
</li>
44+
<li>
45+
<a class="icon" href="http://digg.com/submit?url={{ .Permalink }}&title={{ .Title }}">
46+
<i class="fab fa-digg {{ $icon_class_name }}" aria-hidden="true"></i>
47+
</a>
48+
</li>
49+
<li>
50+
<a class="icon" href="http://www.tumblr.com/share/link?url={{ .Permalink }}&name={{ .Title }}&description={{ $description }}">
51+
<i class="fab fa-tumblr {{ $icon_class_name }}" aria-hidden="true"></i>
52+
</a>
53+
</li>
54+
<li>
55+
<a class="icon" href="https://news.ycombinator.com/submitlink?u={{ .Permalink }}&t={{ .Title }}">
56+
<i class="fab fa-hacker-news {{ $icon_class_name }}" aria-hidden="true"></i>
57+
</a>
58+
</li>
59+
</ul>

layouts/posts/single.html

+15-13
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,26 @@ <h1 class="posttitle" itemprop="name headline">
2929
{{ if (and .Site.Params.show_updated (ne .Lastmod .Date)) }}
3030
(Updated: <time datetime="{{ .Lastmod }}" itemprop="dateModified">{{ .Lastmod.Format $dataFormat }}</time>)
3131
{{ end }}
32-
</div>
32+
</div>
33+
<span>
34+
| <i class="far fa-clock"></i> {{ math.Round (div (countwords .Content) 220.0) }} min
35+
</span>
3336
{{ if gt .Params.categories 0 }}
3437
<div class="article-category">
35-
<i class="fas fa-archive"></i>
36-
{{ range $index, $value := .Params.categories }}
37-
{{ if gt $index 1 }} {{ print ", " }} {{ end }}
38-
<a class="category-link" href="{{ "/categories/" | relLangURL }}{{ $value | urlize }}">{{ $value }}</a>
39-
{{ end }}
38+
<i class="far fa-archive"></i>
39+
{{ range $index, $value := .Params.categories}}
40+
{{ if gt $index 0 }} {{ print ", " }}{{ end }}
41+
<a class="category-link" href="{{ "/categories/" | relLangURL }}{{ $value | urlize }}">{{$value}}</a> {{ end }}
4042
</div>
4143
{{ end }}
4244
{{ if gt .Params.tags 0 }}
4345
<div class="article-tag">
4446
<i class="fas fa-tag"></i>
45-
{{ range $index, $value := .Params.tags }}
46-
{{ if gt $index 1 }} {{ print ", " }} {{ end }}
47-
<a class="tag-link" href="{{ "/tags/" | relLangURL }}{{ $value | urlize }}" rel="tag">{{ $value }}</a>
47+
{{ range $index, $value := .Params.tags}}
48+
{{ if gt $index 0 }} {{ print ", " }}{{ end }}
49+
<a class="tag-link" href="{{ "/tags/" | relLangURL }}{{ $value | urlize }}" rel="tag">{{$value}}</a>
4850
{{ end }}
49-
</div>
51+
</div>
5052
{{ end }}
5153
</div>
5254
</header>
@@ -74,9 +76,9 @@ <h1 class="posttitle" itemprop="name headline">
7476
</div>
7577
</body>
7678

77-
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
78-
<script src="/lib/jquery/jquery.min.js"></script>
79-
<script src="/js/main.js"></script>
79+
<link rel="stylesheet" href={{ "/lib/font-awesome/css/all.min.css" | relURL }}>
80+
<script src={{ "/lib/jquery/jquery.min.js" | relURL }}></script>
81+
<script src={{ "/js/main.js" | relURL }}></script>
8082
{{ $mathjax := false }}
8183
{{ if isset .Params "mathjax" }}
8284
{{ $mathjax = .Params.mathjax }}

theme.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "A clean, responsive hugo theme for personal blog. Forked from hex
55
homepage = "https://github.com/monkeyWzr/hugo-theme-cactus"
66
tags = ["blog", "responsive", "clean"]
77
features = ["mathjax", "customizable", "color"]
8-
min_version = "0.48"
8+
min_version = "0.55"
99

1010
# If the theme has a single author
1111
[author]
@@ -16,4 +16,4 @@ min_version = "0.48"
1616
[original]
1717
author = "Pieter Robberechts"
1818
homepage = "https://github.com/probberechts"
19-
repo = "https://github.com/probberechts/hexo-theme-cactus"
19+
repo = "https://github.com/probberechts/hexo-theme-cactus"

0 commit comments

Comments
 (0)