Skip to content

Commit

Permalink
Tags not working fixed (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
chollinger93 authored Jan 31, 2022
1 parent 6cdb44d commit 412d9b4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 15 deletions.
1 change: 1 addition & 0 deletions exampleSite/content/posts/post-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: "Hugo shortcodes"
date: 2021-07-04T12:13:36+05:30
description: Here is a demo of all shortcodes available in Hugo.
tags: [markdown]
---

## Images
Expand Down
33 changes: 32 additions & 1 deletion layouts/_default/term.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,38 @@
<div class="container wrapper tags">
{{ partial "head.html" . }}

<h1 class="page-title">All tags</h1>
<h1 class="page-title">Tag: {{ .Title }}</h1>

{{ with (.Site.GetPage .Title) }}
<ul class="posts flat">
{{ range .Pages }}
<li class="post">
<div class="post-header">
<div class="meta">
<div class="date">
<span class="day">{{ dateFormat "02" .Date }}</span>
<span class="rest">{{ if $.Site.Data.month }}{{ index $.Site.Data.month (printf "%d" .Date.Month) }} {{ .Date.Year }}{{ else }}{{ dateFormat "Jan 2006" .Date }}{{ end }}</span>
</div>
</div>
<div class="matter">
<h4 class="title small">
<a href="{{ .RelPermalink }}">{{.Title}}{{ if .Draft }}<sup class="draft-label">DRAFT</sup>{{ end }}</a>
</h4>
<span class="description">
{{ if isset .Params "description" }}
{{ .Description }}
{{ else if gt (len .RawContent) 120 }}
{{ slicestr .RawContent 0 120 }}...
{{ else }}
{{ .RawContent }}
{{ end }}
</span>
</div>
</div>
</li>
{{ end }}
</ul>
{{ end }}
</div>

{{ partial "footer.html" . }}
Expand Down
3 changes: 1 addition & 2 deletions layouts/_default/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ partial "head.html" . }}

<h1 class="page-title">{{ .Name }}</h1>

{{ $biggest := 1 }}
{{ $smallest := 1 }}
{{ $max := 3 }}
Expand All @@ -26,5 +26,4 @@ <h1 class="page-title">{{ .Name }}</h1>

{{ partial "footer.html" . }}
</body>

</html>
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="footer wrapper">
<nav class="nav">
<div>{{ default 2020 .Date.Year}} {{ with .Site.Copyright }} {{ . | safeHTML }} {{ end }}</div>
<div>{{ default 2022 .Date.Year}} {{ with .Site.Copyright }} {{ . | safeHTML }} {{ end }}</div>
<!-- <a href="https://github.com/knadh/hugo-ink">Ink</a> theme on <a href="https://gohugo.io">Hugo</a></div> -->
</nav>
</div>
Expand Down
25 changes: 14 additions & 11 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@ document.addEventListener("DOMContentLoaded", function(){
scheme = savedScheme;
}

if(scheme == "dark") {
darkscheme(toggle, container);
} else {
lightscheme(toggle, container);
}

toggle.addEventListener("click", () => {
if (toggle.className === "light") {
if (toggle) {
if(scheme == "dark") {
darkscheme(toggle, container);
} else if (toggle.className === "dark") {
lightscheme(toggle, container);
} else {
lightscheme(toggle, container);
}
});

toggle.addEventListener("click", () => {
if (toggle.className === "light") {
darkscheme(toggle, container);
} else if (toggle.className === "dark") {
lightscheme(toggle, container);
}
});
}
});


function darkscheme(toggle, container) {
localStorage.setItem("scheme", "dark");
toggle.innerHTML = feather.icons.sun.toSvg();
Expand Down

0 comments on commit 412d9b4

Please sign in to comment.